Changeset 121469 in webkit
- Timestamp:
- Jun 28, 2012 2:10:12 PM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r121463 r121469 1 2012-06-28 Alpha Lam <hclam@chromium.org> 2 3 Unreviewed, rolling out r121463. 4 http://trac.webkit.org/changeset/121463 5 https://bugs.webkit.org/show_bug.cgi?id=90094 6 7 Broke Windows build. 8 9 * WebKit.gypi: 10 * WebKitUnitTests.gyp: 11 * public/WebDOMMessageEvent.h: 12 * tests/AssociatedURLLoaderTest.cpp: 13 (WebKit::AssociatedURLLoaderTest::AssociatedURLLoaderTest): 14 (WebKit::AssociatedURLLoaderTest::SetUp): 15 (WebKit::AssociatedURLLoaderTest::CheckMethodFails): 16 (WebKit::AssociatedURLLoaderTest::CheckHeaderFails): 17 (WebKit::AssociatedURLLoaderTest::CheckAccessControlHeaders): 18 (WebKit::TEST_F): 19 * tests/EventListenerTest.cpp: 20 * tests/FrameTestHelpers.cpp: 21 (WebKit::FrameTestHelpers::registerMockedURLLoad): 22 (FrameTestHelpers): 23 (WebKit::FrameTestHelpers::loadFrame): 24 * tests/FrameTestHelpers.h: 25 (FrameTestHelpers): 26 * tests/ListenerLeakTest.cpp: 27 (WebKit::ListenerLeakTest::RunTest): 28 * tests/PopupMenuTest.cpp: 29 (WebKit::SelectPopupMenuTest::registerMockedURLLoad): 30 (WebKit::SelectPopupMenuTest::loadFrame): 31 (WebKit::TEST_F): 32 * tests/RunAllTests.cpp: 33 * tests/URLTestHelpers.cpp: Removed. 34 * tests/URLTestHelpers.h: Removed. 35 * tests/WebFrameTest.cpp: 36 (WebKit::WebFrameTest::registerMockedHttpURLLoad): 37 (WebKit::WebFrameTest::registerMockedChromeURLLoad): 38 (WebKit::TEST_F): 39 * tests/WebPageNewSerializerTest.cpp: 40 (WebKit::WebPageNewSerializeTest::registerMockedURLLoad): 41 (WebPageNewSerializeTest): 42 (WebKit::WebPageNewSerializeTest::setUpCSSTestPage): 43 (WebKit::WebPageNewSerializeTest::loadURLInTopFrame): 44 (WebKit::WebPageNewSerializeTest::resourceVectorContains): 45 (WebKit::TEST_F): 46 * tests/WebPageSerializerTest.cpp: 47 (WebKit::WebPageSerializerTest::registerMockedURLLoad): 48 (WebKit::WebPageSerializerTest::loadURLInTopFrame): 49 (WebKit::WebPageSerializerTest::webVectorContains): 50 (WebKit::TEST_F): 51 * tests/WebViewTest.cpp: 52 (WebKit::TEST_F): 53 (WebKit::WebViewTest::testAutoResize): 54 (WebKit::WebViewTest::testTextInputType): 55 1 56 2012-06-28 Shawn Singh <shawnsingh@chromium.org> 2 57 -
trunk/Source/WebKit/chromium/WebKit.gypi
r121463 r121469 147 147 'tests/TreeTestHelpers.cpp', 148 148 'tests/TreeTestHelpers.h', 149 'tests/URLTestHelpers.cpp',150 'tests/URLTestHelpers.h',151 149 'tests/WebCompositorInputHandlerImplTest.cpp', 152 150 'tests/WebFrameTest.cpp', -
trunk/Source/WebKit/chromium/WebKitUnitTests.gyp
r121463 r121469 79 79 '../../Platform/chromium', 80 80 ], 81 'defines': [82 'WEBKIT_IMPLEMENTATION=1',83 ],84 81 'conditions': [ 85 82 ['inside_chromium_build==1 and component=="shared_library"', { -
trunk/Source/WebKit/chromium/public/WebDOMMessageEvent.h
r121463 r121469 47 47 class WebDOMMessageEvent : public WebDOMEvent { 48 48 public: 49 WebDOMMessageEvent() { }50 49 WEBKIT_EXPORT void initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId); 51 50 -
trunk/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
r121463 r121469 31 31 #include "config.h" 32 32 33 #include "URLTestHelpers.h"34 33 #include "WebFrame.h" 35 34 #include "WebFrameClient.h" … … 44 43 #include <wtf/text/WTFString.h> 45 44 45 #include <googleurl/src/gurl.h> 46 46 #include <gtest/gtest.h> 47 47 #include <webkit/support/webkit_support.h> 48 48 49 49 using namespace WebKit; 50 using WebKit::URLTestHelpers::toKURL;51 50 52 51 namespace { … … 78 77 { 79 78 // Reuse one of the test files from WebFrameTest. 80 std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data());79 std::string filePath = webkit_support::GetWebKitRootDir().utf8(); 81 80 filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html"; 82 m_frameFilePath = WebString::fromUTF8(filePath .c_str());81 m_frameFilePath = WebString::fromUTF8(filePath); 83 82 } 84 83 … … 89 88 90 89 // Load the frame before trying to load resources. 91 WebCore::KURL url = toKURL("http://www.test.com/iframes_test.html");90 GURL url = GURL("http://www.test.com/iframes_test.html"); 92 91 WebURLResponse response; 93 92 response.initialize(); … … 186 185 WebURLRequest request; 187 186 request.initialize(); 188 request.setURL( toKURL("http://www.test.com/success.html"));187 request.setURL(GURL("http://www.test.com/success.html")); 189 188 request.setHTTPMethod(WebString::fromUTF8(unsafeMethod)); 190 189 WebURLLoaderOptions options; … … 202 201 WebURLRequest request; 203 202 request.initialize(); 204 request.setURL( toKURL("http://www.test.com/success.html"));203 request.setURL(GURL("http://www.test.com/success.html")); 205 204 request.setHTTPHeaderField(WebString::fromUTF8(headerField), WebString::fromUTF8(headerValue)); 206 205 WebURLLoaderOptions options; … … 232 231 id.append(".html"); 233 232 234 WebCore::KURL url = toKURL(id);233 GURL url = GURL(id); 235 234 WebURLRequest request; 236 235 request.initialize(); … … 284 283 TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) 285 284 { 286 WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html");285 GURL url = GURL("http://www.test.com/SameOriginSuccess.html"); 287 286 WebURLRequest request; 288 287 request.initialize(); … … 307 306 { 308 307 // This is cross-origin since the frame was loaded from www.test.com. 309 WebCore::KURL url = toKURL("http://www.other.com/SameOriginRestriction.html");308 GURL url = GURL("http://www.other.com/SameOriginRestriction.html"); 310 309 WebURLRequest request; 311 310 request.initialize(); … … 318 317 { 319 318 // This is cross-origin since the frame was loaded from www.test.com. 320 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html");319 GURL url = GURL("http://www.other.com/CrossOriginSuccess.html"); 321 320 WebURLRequest request; 322 321 request.initialize(); … … 343 342 { 344 343 // This is cross-origin since the frame was loaded from www.test.com. 345 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html");344 GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html"); 346 345 WebURLRequest request; 347 346 request.initialize(); … … 369 368 { 370 369 // This is cross-origin since the frame was loaded from www.test.com. 371 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlFailure.html");370 GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlFailure.html"); 372 371 WebURLRequest request; 373 372 request.initialize(); … … 400 399 TEST_F(AssociatedURLLoaderTest, RedirectSuccess) 401 400 { 402 WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html");401 GURL url = GURL("http://www.test.com/RedirectSuccess.html"); 403 402 char redirect[] = "http://www.test.com/RedirectSuccess2.html"; // Same-origin 404 WebCore::KURL redirectURL = toKURL(redirect);403 GURL redirectURL = GURL(redirect); 405 404 406 405 WebURLRequest request; … … 437 436 TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure) 438 437 { 439 WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html");438 GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html"); 440 439 char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlFailure.html"; // Cross-origin 441 WebCore::KURL redirectURL = toKURL(redirect);440 GURL redirectURL = GURL(redirect); 442 441 443 442 WebURLRequest request; … … 469 468 TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess) 470 469 { 471 WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html");470 GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html"); 472 471 char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlSuccess.html"; // Cross-origin 473 WebCore::KURL redirectURL = toKURL(redirect);472 GURL redirectURL = GURL(redirect); 474 473 475 474 WebURLRequest request; … … 592 591 WebURLRequest request; 593 592 request.initialize(); 594 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html");593 GURL url = GURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html"); 595 594 request.setURL(url); 596 595 -
trunk/Source/WebKit/chromium/tests/EventListenerTest.cpp
r121463 r121469 32 32 33 33 #include "FrameTestHelpers.h" 34 #include "URLTestHelpers.h"35 34 #include "WebDOMEvent.h" 36 35 #include "WebDOMEventListener.h" … … 80 79 std::string fileName("listener/mutation_event_listener.html"); 81 80 bool executeScript = true; 82 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));81 FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); 83 82 m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); 84 83 } -
trunk/Source/WebKit/chromium/tests/FrameTestHelpers.cpp
r121463 r121469 32 32 #include "FrameTestHelpers.h" 33 33 34 #include "URLTestHelpers.h"35 34 #include <wtf/StdLibExtras.h> 36 35 #include "WebFrame.h" … … 42 41 #include "WebView.h" 43 42 #include "WebViewClient.h" 43 #include <googleurl/src/gurl.h> 44 44 #include <webkit/support/webkit_support.h> 45 45 … … 47 47 namespace FrameTestHelpers { 48 48 49 void registerMockedURLLoad(const std::string& base, const std::string& fileName) 50 { 51 registerMockedURLLoad(GURL(base + fileName), fileName); 52 } 53 54 void registerMockedURLLoad(GURL url, const std::string& fileName) 55 { 56 WebURLResponse response; 57 response.initialize(); 58 response.setMIMEType("text/html"); 59 60 std::string filePath = webkit_support::GetWebKitRootDir().utf8(); 61 filePath += "/Source/WebKit/chromium/tests/data/"; 62 filePath += fileName; 63 64 webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); 65 } 66 49 67 void loadFrame(WebFrame* frame, const std::string& url) 50 68 { 51 69 WebURLRequest urlRequest; 52 70 urlRequest.initialize(); 53 urlRequest.setURL( URLTestHelpers::toKURL(url));71 urlRequest.setURL(GURL(url)); 54 72 frame->loadRequest(urlRequest); 55 73 } -
trunk/Source/WebKit/chromium/tests/FrameTestHelpers.h
r121463 r121469 34 34 #include <string> 35 35 36 class GURL; 37 36 38 namespace WebKit { 37 39 … … 43 45 namespace FrameTestHelpers { 44 46 47 void registerMockedURLLoad(const std::string& base, const std::string& fileName); 48 // Like the previous overload, but it allows more flexibility in the url since it is given by the caller. 49 void registerMockedURLLoad(GURL, const std::string& fileName); 50 45 51 void loadFrame(WebFrame*, const std::string& url); 46 52 -
trunk/Source/WebKit/chromium/tests/ListenerLeakTest.cpp
r121463 r121469 32 32 33 33 #include "FrameTestHelpers.h" 34 #include "URLTestHelpers.h"35 34 #include "WebView.h" 36 35 #include <gtest/gtest.h> … … 92 91 std::string fileName(filename); 93 92 bool executeScript = true; 94 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));93 FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); 95 94 m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); 96 95 } -
trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp
r121463 r121469 44 44 #include "PopupMenuChromium.h" 45 45 #include "RuntimeEnabledFeatures.h" 46 #include "URLTestHelpers.h"47 46 #include "WebDocument.h" 48 47 #include "WebElement.h" … … 65 64 using namespace WebCore; 66 65 using namespace WebKit; 67 using WebKit::URLTestHelpers::toKURL;68 66 69 67 namespace { … … 252 250 void registerMockedURLLoad(const std::string& fileName) 253 251 { 254 URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromUTF8("text/html")); 252 WebURLResponse response; 253 response.initialize(); 254 response.setMIMEType("text/html"); 255 256 std::string filePath = webkit_support::GetWebKitRootDir().utf8(); 257 filePath += "/Source/WebKit/chromium/tests/data/popup/"; 258 filePath += fileName; 259 260 webkit_support::RegisterMockedURL(WebURL(GURL(baseURL + fileName)), response, WebString::fromUTF8(filePath)); 255 261 } 256 262 … … 264 270 WebURLRequest urlRequest; 265 271 urlRequest.initialize(); 266 urlRequest.setURL(WebURL( toKURL(baseURL + fileName)));272 urlRequest.setURL(WebURL(GURL(baseURL + fileName))); 267 273 frame->loadRequest(urlRequest); 268 274 } … … 422 428 // mousedown event is held by select node, and we don't simulate the event for the node. 423 429 // So we can only see mouseup and click event. 424 EXPECT_STREQ("upclick", element.innerText().utf8().data());430 EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); 425 431 426 432 // Disable the item at index 1. … … 434 440 435 441 // The item at index 1 is disabled, so the text should not be changed. 436 EXPECT_STREQ("upclick", element.innerText().utf8().data());442 EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); 437 443 438 444 showPopup(); … … 443 449 444 450 // The item is changed to the item at index 2, from index 0, so change event is fired. 445 EXPECT_STREQ("upclickchangeupclick", element.innerText().utf8().data());451 EXPECT_STREQ("upclickchangeupclick", std::string(element.innerText().utf8()).c_str()); 446 452 } 447 453 … … 464 470 WebElement element = m_webView->mainFrame()->document().getElementById("message"); 465 471 // We only can see change event but no other mouse related events. 466 EXPECT_STREQ("change", element.innerText().utf8().data());472 EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); 467 473 } 468 474 … … 486 492 487 493 WebElement element = m_webView->mainFrame()->document().getElementById("message"); 488 EXPECT_STREQ("change", element.innerText().utf8().data());494 EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); 489 495 } 490 496 … … 508 514 509 515 WebElement element = m_webView->mainFrame()->document().getElementById("message"); 510 EXPECT_STREQ("click", element.innerText().utf8().data());516 EXPECT_STREQ("click", std::string(element.innerText().utf8()).c_str()); 511 517 } 512 518 -
trunk/Source/WebKit/chromium/tests/RunAllTests.cpp
r121463 r121469 28 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 29 */ 30 31 #include "config.h"32 30 33 31 // FIXME: Avoid this source dependency on Chromium's base module. -
trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp
r121463 r121469 37 37 #include "FrameView.h" 38 38 #include "ResourceError.h" 39 #include "URLTestHelpers.h"40 39 #include "WebDataSource.h" 41 40 #include "WebDocument.h" … … 57 56 58 57 using namespace WebKit; 59 using WebKit::URLTestHelpers::toKURL;60 58 61 59 namespace { … … 76 74 void registerMockedHttpURLLoad(const std::string& fileName) 77 75 { 78 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));76 FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName); 79 77 } 80 78 81 79 void registerMockedChromeURLLoad(const std::string& fileName) 82 80 { 83 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL.c_str()), WebString::fromUTF8(fileName.c_str()));81 FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName); 84 82 } 85 83 … … 99 97 100 98 // Now retrieve the frames text and test it only includes visible elements. 101 std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());99 std::string content = webView->mainFrame()->contentAsText(1024).utf8(); 102 100 EXPECT_NE(std::string::npos, content.find(" visible paragraph")); 103 101 EXPECT_NE(std::string::npos, content.find(" visible iframe")); … … 159 157 160 158 // Now retrieve the frame's text and ensure it was modified by running javascript. 161 std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());159 std::string content = webView->mainFrame()->contentAsText(1024).utf8(); 162 160 EXPECT_NE(std::string::npos, content.find("Clobbered")); 163 161 } … … 178 176 179 177 // Now retrieve the frame's text and ensure it wasn't modified by running javascript. 180 std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());178 std::string content = webView->mainFrame()->contentAsText(1024).utf8(); 181 179 EXPECT_EQ(std::string::npos, content.find("Clobbered")); 182 180 } … … 190 188 191 189 // Send a message with the correct origin. 192 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create( toKURL(m_baseURL)));190 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL))); 193 191 WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent"); 194 192 WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); … … 198 196 199 197 // Send another message with incorrect origin. 200 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create( toKURL(m_chromeURL)));198 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL))); 201 199 webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message); 202 200 … … 205 203 206 204 // Verify that only the first addition is in the body of the page. 207 std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());205 std::string content = webView->mainFrame()->contentAsText(1024).utf8(); 208 206 EXPECT_NE(std::string::npos, content.find("Message 1.")); 209 207 EXPECT_EQ(std::string::npos, content.find("Message 2.")); … … 444 442 445 443 // Reload the page using the cache. 446 webViewImpl->mainFrame()->reloadWithOverrideURL( toKURL(m_baseURL + secondURL), false);444 webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + secondURL), false); 447 445 webkit_support::ServeAsynchronousMockedRequests(); 448 446 ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); … … 450 448 451 449 // Reload the page while ignoring the cache. 452 webViewImpl->mainFrame()->reloadWithOverrideURL( toKURL(m_baseURL + thirdURL), true);450 webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + thirdURL), true); 453 451 webkit_support::ServeAsynchronousMockedRequests(); 454 452 ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); … … 472 470 iframeDataSource->redirectChain(redirects); 473 471 ASSERT_EQ(2U, redirects.size()); 474 EXPECT_EQ( toKURL("about:blank"), toKURL(redirects[0].spec().data()));475 EXPECT_EQ( toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data()));472 EXPECT_EQ(GURL("about:blank"), GURL(redirects[0])); 473 EXPECT_EQ(GURL("http://www.test.com/visible_iframe.html"), GURL(redirects[1])); 476 474 477 475 webView->close(); … … 734 732 // Generate a simple test case. 735 733 const char simpleSource[] = "<div>Foo bar</div><div></div>baz"; 736 WebCore::KURL testURL = toKURL("about:blank");734 GURL testURL("about:blank"); 737 735 frame->loadHTMLString(simpleSource, testURL); 738 736 webkit_support::RunAllPendingMessages(); … … 741 739 const std::string expected("Foo bar\nbaz"); 742 740 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); 743 EXPECT_EQ(expected, std::string(text.utf8() .data()));741 EXPECT_EQ(expected, std::string(text.utf8())); 744 742 745 743 // Try reading the same one with clipping of the text. 746 744 const int length = 5; 747 745 text = frame->contentAsText(length); 748 EXPECT_EQ(expected.substr(0, length), std::string(text.utf8() .data()));746 EXPECT_EQ(expected.substr(0, length), std::string(text.utf8())); 749 747 750 748 // Now do a new test with a subframe. … … 760 758 761 759 text = frame->contentAsText(std::numeric_limits<size_t>::max()); 762 EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8() .data()));760 EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8())); 763 761 764 762 // Get the frame text where the subframe separator falls on the boundary of 765 763 // what we'll take. There used to be a crash in this case. 766 764 text = frame->contentAsText(12); 767 EXPECT_EQ("Hello world", std::string(text.utf8() .data()));765 EXPECT_EQ("Hello world", std::string(text.utf8())); 768 766 769 767 webView->close(); … … 777 775 // Generate a simple test case. 778 776 const char simpleSource[] = "<p>Hello</p><p>World</p>"; 779 WebCore::KURL testURL = toKURL("about:blank");777 GURL testURL("about:blank"); 780 778 frame->loadHTMLString(simpleSource, testURL); 781 779 webkit_support::RunAllPendingMessages(); 782 780 783 781 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); 784 EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8() .data()));785 786 const std::string html = std::string(frame->contentAsMarkup().utf8().data());782 EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); 783 784 const std::string html = frame->contentAsMarkup().utf8(); 787 785 788 786 // Load again with the output html. 789 frame->loadHTMLString( WebData(html.c_str(), html.length()), testURL);787 frame->loadHTMLString(html, testURL); 790 788 webkit_support::RunAllPendingMessages(); 791 789 792 EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8() .data()));790 EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8())); 793 791 794 792 text = frame->contentAsText(std::numeric_limits<size_t>::max()); 795 EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8() .data()));793 EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); 796 794 797 795 // Test selection check -
trunk/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp
r121463 r121469 31 31 #include "config.h" 32 32 33 #include "URLTestHelpers.h"34 33 #include "WebFrame.h" 35 34 #include "WebFrameClient.h" … … 43 42 #include "WebView.h" 44 43 44 #include <googleurl/src/gurl.h> 45 45 #include <gtest/gtest.h> 46 46 #include <webkit/support/webkit_support.h> 47 47 48 48 using namespace WebKit; 49 using WebKit::URLTestHelpers::toKURL;50 using WebKit::URLTestHelpers::registerMockedURLLoad;51 49 52 50 namespace { … … 113 111 } 114 112 113 void registerMockedURLLoad(const WebURL& url, const WebString& fileName, const WebString& mimeType) 114 { 115 WebURLResponse response; 116 response.initialize(); 117 response.setMIMEType(mimeType); 118 response.setHTTPStatusCode(200); 119 std::string filePath = webkit_support::GetWebKitRootDir().utf8(); 120 filePath.append("/Source/WebKit/chromium/tests/data/pageserializer/"); 121 filePath.append(fileName.utf8()); 122 webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); 123 } 124 115 125 WebURL setUpCSSTestPage() 116 126 { 117 WebURL topFrameURL = toKURL("http://www.test.com");118 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), WebString::fromUTF8("pageserializer/"),htmlMimeType());119 registerMockedURLLoad( toKURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType());120 registerMockedURLLoad( toKURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), WebString::fromUTF8("pageserializer/"), cssMimeType());121 registerMockedURLLoad( toKURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType());122 registerMockedURLLoad( toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());123 registerMockedURLLoad( toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());124 registerMockedURLLoad( toKURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());125 registerMockedURLLoad( toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());126 registerMockedURLLoad( toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());127 registerMockedURLLoad( toKURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());128 registerMockedURLLoad( toKURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());129 registerMockedURLLoad( toKURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());127 WebURL topFrameURL = GURL("http://www.test.com"); 128 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), htmlMimeType()); 129 registerMockedURLLoad(GURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), cssMimeType()); 130 registerMockedURLLoad(GURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), cssMimeType()); 131 registerMockedURLLoad(GURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), cssMimeType()); 132 registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); 133 registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); 134 registerMockedURLLoad(GURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), pngMimeType()); 135 registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); 136 registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); 137 registerMockedURLLoad(GURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), pngMimeType()); 138 registerMockedURLLoad(GURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), pngMimeType()); 139 registerMockedURLLoad(GURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), pngMimeType()); 130 140 return topFrameURL; 131 141 } 132 142 133 void loadURLInTopFrame(const WebURL& url)143 void loadURLInTopFrame(const GURL& url) 134 144 { 135 145 WebURLRequest urlRequest; 136 146 urlRequest.initialize(); 137 urlRequest.setURL( url);147 urlRequest.setURL(WebURL(url)); 138 148 m_webView->mainFrame()->loadRequest(urlRequest); 139 149 // Make sure any pending request get served. … … 152 162 static bool resourceVectorContains(const WebVector<WebPageSerializer::Resource>& resources, const char* url, const char* mimeType) 153 163 { 154 WebURL webURL = WebURL( toKURL(url));164 WebURL webURL = WebURL(GURL(url)); 155 165 for (size_t i = 0; i < resources.size(); ++i) { 156 166 const WebPageSerializer::Resource& resource = resources[i]; … … 175 185 { 176 186 // Register the mocked frames. 177 WebURL topFrameURL = toKURL("http://www.test.com");178 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), WebString::fromUTF8("pageserializer/"),htmlMimeType());179 registerMockedURLLoad( toKURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());180 registerMockedURLLoad( toKURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());181 registerMockedURLLoad( toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());182 registerMockedURLLoad( toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());183 registerMockedURLLoad( toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());187 WebURL topFrameURL = GURL("http://www.test.com"); 188 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), htmlMimeType()); 189 registerMockedURLLoad(GURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), htmlMimeType()); 190 registerMockedURLLoad(GURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), htmlMimeType()); 191 registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); 192 registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); 193 registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); 184 194 185 195 loadURLInTopFrame(topFrameURL); … … 191 201 // The first resource should be the main-frame. 192 202 const WebPageSerializer::Resource& resource = resources[0]; 193 EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com")));203 EXPECT_TRUE(resource.url == GURL("http://www.test.com")); 194 204 EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); 195 205 EXPECT_FALSE(resource.data.isEmpty()); … … 218 228 // The first resource should be the main-frame. 219 229 const WebPageSerializer::Resource& resource = resources[0]; 220 EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com")));230 EXPECT_TRUE(resource.url == GURL("http://www.test.com")); 221 231 EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); 222 232 EXPECT_FALSE(resource.data.isEmpty()); … … 240 250 { 241 251 // Register the mocked frame and load it. 242 WebURL topFrameURL = toKURL("http://www.test.com");243 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), WebString::fromUTF8("pageserializer/"),htmlMimeType());244 registerMockedURLLoad( toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());245 registerMockedURLLoad( toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());246 registerMockedURLLoad( toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());252 WebURL topFrameURL = GURL("http://www.test.com"); 253 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), htmlMimeType()); 254 registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); 255 registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); 256 registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); 247 257 248 258 loadURLInTopFrame(topFrameURL); … … 254 264 // The first resource should be the main-frame. 255 265 const WebPageSerializer::Resource& resource = resources[0]; 256 EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com")));266 EXPECT_TRUE(resource.url == GURL("http://www.test.com")); 257 267 EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); 258 268 EXPECT_FALSE(resource.data.isEmpty()); … … 270 280 TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration) 271 281 { 272 WebURL topFrameURL = toKURL("http://www.test.com/simple.xhtml");273 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), WebString::fromUTF8("pageserializer/"),xhtmlMimeType());282 WebURL topFrameURL = GURL("http://www.test.com/simple.xhtml"); 283 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), xhtmlMimeType()); 274 284 275 285 loadURLInTopFrame(topFrameURL); … … 281 291 // We expect only one resource, the XML. 282 292 ASSERT_EQ(1U, resources.size()); 283 std::string xml = std::string(resources[0].data.data());293 std::string xml = resources[0].data; 284 294 285 295 // We should have one and only one instance of the XML declaration. … … 301 311 302 312 // Read the MHTML data line per line and do some pseudo-parsing to make sure the right encoding is used for the different sections. 303 LineReader lineReader( std::string(mhtmlData.data()));313 LineReader lineReader(mhtmlData); 304 314 int sectionCheckedCount = 0; 305 315 const char* expectedEncoding = 0; -
trunk/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp
r121463 r121469 32 32 #include "WebPageSerializer.h" 33 33 34 #include "URLTestHelpers.h"35 34 #include "WebFrame.h" 36 35 #include "WebFrameClient.h" … … 41 40 #include "WebView.h" 42 41 42 #include <googleurl/src/gurl.h> 43 43 #include <gtest/gtest.h> 44 44 #include <webkit/support/webkit_support.h> 45 45 46 46 using namespace WebKit; 47 using WebKit::URLTestHelpers::toKURL;48 47 49 48 namespace { … … 75 74 } 76 75 77 void registerMockedURLLoad(const std::string& url, const WebString& fileName)76 void registerMockedURLLoad(const WebURL& url, const WebString& fileName) 78 77 { 79 URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::fromUTF8("pageserialization/"), WebString::fromUTF8("text/html")); 78 WebURLResponse response; 79 response.initialize(); 80 response.setMIMEType("text/html"); 81 std::string filePath = webkit_support::GetWebKitRootDir().utf8(); 82 filePath.append("/Source/WebKit/chromium/tests/data/pageserialization/"); 83 filePath.append(fileName.utf8()); 84 webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); 80 85 } 81 86 82 void loadURLInTopFrame(const WebURL& url)87 void loadURLInTopFrame(const GURL& url) 83 88 { 84 89 WebURLRequest urlRequest; 85 90 urlRequest.initialize(); 86 urlRequest.setURL( url);91 urlRequest.setURL(WebURL(url)); 87 92 m_webView->mainFrame()->loadRequest(urlRequest); 88 93 // Make sure any pending request get served. … … 92 97 static bool webVectorContains(const WebVector<WebURL>& vector, const char* url) 93 98 { 94 return vector.contains(WebURL( toKURL(std::string(url))));99 return vector.contains(WebURL(GURL(url))); 95 100 } 96 101 … … 112 117 { 113 118 // Register the mocked frame and load it. 114 WebURL topFrameURL = toKURL("http://www.test.com");115 registerMockedURLLoad( "http://www.test.com", WebString::fromUTF8("simple_page.html"));119 WebURL topFrameURL = GURL("http://www.test.com"); 120 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple_page.html")); 116 121 loadURLInTopFrame(topFrameURL); 117 122 … … 146 151 { 147 152 // Register the mocked frames. 148 WebURL topFrameURL = toKURL("http://www.test.com");149 registerMockedURLLoad( "http://www.test.com", WebString::fromUTF8("top_frame.html"));150 registerMockedURLLoad( "http://www.test.com/simple_iframe.html",153 WebURL topFrameURL = GURL("http://www.test.com"); 154 registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html")); 155 registerMockedURLLoad(GURL("http://www.test.com/simple_iframe.html"), 151 156 WebString::fromUTF8("simple_iframe.html")); 152 registerMockedURLLoad( "http://www.test.com/object_iframe.html",157 registerMockedURLLoad(GURL("http://www.test.com/object_iframe.html"), 153 158 WebString::fromUTF8("object_iframe.html")); 154 registerMockedURLLoad( "http://www.test.com/embed_iframe.html",159 registerMockedURLLoad(GURL("http://www.test.com/embed_iframe.html"), 155 160 WebString::fromUTF8("embed_iframe.html")); 156 161 // If we don't register a mocked resource for awesome.png, it causes the 157 162 // document loader of the iframe that has it as its src to assert on close, 158 163 // not sure why. 159 registerMockedURLLoad( "http://www.test.com/awesome.png",164 registerMockedURLLoad(GURL("http://www.test.com/awesome.png"), 160 165 WebString::fromUTF8("awesome.png")); 161 166 -
trunk/Source/WebKit/chromium/tests/WebViewTest.cpp
r121463 r121469 36 36 #include "FrameView.h" 37 37 #include "HTMLDocument.h" 38 #include "URLTestHelpers.h"39 38 #include "WebDocument.h" 40 39 #include "WebFrame.h" … … 44 43 #include "WebViewClient.h" 45 44 #include "WebViewImpl.h" 45 #include <googleurl/src/gurl.h> 46 46 #include <gtest/gtest.h> 47 47 #include <webkit/support/webkit_support.h> 48 48 49 49 using namespace WebKit; 50 using WebKit::URLTestHelpers::toKURL;51 50 52 51 namespace { … … 119 118 TEST_F(WebViewTest, FocusIsInactive) 120 119 { 121 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html");120 FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); 122 121 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); 123 122 … … 147 146 TEST_F(WebViewTest, ActiveState) 148 147 { 149 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html");148 FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); 150 149 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); 151 150 … … 171 170 AutoResizeWebViewClient client; 172 171 std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageHeight; 173 URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html");172 FrameTestHelpers::registerMockedURLLoad(GURL(url), "specify_size.html"); 174 173 WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true, 0, &client); 175 174 client.testData().setWebView(webView); … … 270 269 void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile) 271 270 { 272 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str()));271 FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile); 273 272 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile); 274 273 webView->setInitialFocus(false); … … 310 309 TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) 311 310 { 312 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html"));311 FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_populated.html"); 313 312 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html"); 314 313 webView->setInitialFocus(false); … … 324 323 webView->close(); 325 324 326 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html"));325 FrameTestHelpers::registerMockedURLLoad(m_baseURL, "content_editable_populated.html"); 327 326 webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_editable_populated.html"); 328 327 webView->setInitialFocus(false);
Note: See TracChangeset
for help on using the changeset viewer.