Unreviewed, rolling out r121463.
authorhclam@chromium.org <hclam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2012 21:10:12 +0000 (21:10 +0000)
committerhclam@chromium.org <hclam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2012 21:10:12 +0000 (21:10 +0000)
http://trac.webkit.org/changeset/121463
https://bugs.webkit.org/show_bug.cgi?id=90094

Broke Windows build.

* WebKit.gypi:
* WebKitUnitTests.gyp:
* public/WebDOMMessageEvent.h:
* tests/AssociatedURLLoaderTest.cpp:
(WebKit::AssociatedURLLoaderTest::AssociatedURLLoaderTest):
(WebKit::AssociatedURLLoaderTest::SetUp):
(WebKit::AssociatedURLLoaderTest::CheckMethodFails):
(WebKit::AssociatedURLLoaderTest::CheckHeaderFails):
(WebKit::AssociatedURLLoaderTest::CheckAccessControlHeaders):
(WebKit::TEST_F):
* tests/EventListenerTest.cpp:
* tests/FrameTestHelpers.cpp:
(WebKit::FrameTestHelpers::registerMockedURLLoad):
(FrameTestHelpers):
(WebKit::FrameTestHelpers::loadFrame):
* tests/FrameTestHelpers.h:
(FrameTestHelpers):
* tests/ListenerLeakTest.cpp:
(WebKit::ListenerLeakTest::RunTest):
* tests/PopupMenuTest.cpp:
(WebKit::SelectPopupMenuTest::registerMockedURLLoad):
(WebKit::SelectPopupMenuTest::loadFrame):
(WebKit::TEST_F):
* tests/RunAllTests.cpp:
* tests/URLTestHelpers.cpp: Removed.
* tests/URLTestHelpers.h: Removed.
* tests/WebFrameTest.cpp:
(WebKit::WebFrameTest::registerMockedHttpURLLoad):
(WebKit::WebFrameTest::registerMockedChromeURLLoad):
(WebKit::TEST_F):
* tests/WebPageNewSerializerTest.cpp:
(WebKit::WebPageNewSerializeTest::registerMockedURLLoad):
(WebPageNewSerializeTest):
(WebKit::WebPageNewSerializeTest::setUpCSSTestPage):
(WebKit::WebPageNewSerializeTest::loadURLInTopFrame):
(WebKit::WebPageNewSerializeTest::resourceVectorContains):
(WebKit::TEST_F):
* tests/WebPageSerializerTest.cpp:
(WebKit::WebPageSerializerTest::registerMockedURLLoad):
(WebKit::WebPageSerializerTest::loadURLInTopFrame):
(WebKit::WebPageSerializerTest::webVectorContains):
(WebKit::TEST_F):
* tests/WebViewTest.cpp:
(WebKit::TEST_F):
(WebKit::WebViewTest::testAutoResize):
(WebKit::WebViewTest::testTextInputType):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121469 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/WebKitUnitTests.gyp
Source/WebKit/chromium/public/WebDOMMessageEvent.h
Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
Source/WebKit/chromium/tests/EventListenerTest.cpp
Source/WebKit/chromium/tests/FrameTestHelpers.cpp
Source/WebKit/chromium/tests/FrameTestHelpers.h
Source/WebKit/chromium/tests/ListenerLeakTest.cpp
Source/WebKit/chromium/tests/PopupMenuTest.cpp
Source/WebKit/chromium/tests/RunAllTests.cpp
Source/WebKit/chromium/tests/URLTestHelpers.cpp [deleted file]
Source/WebKit/chromium/tests/URLTestHelpers.h [deleted file]
Source/WebKit/chromium/tests/WebFrameTest.cpp
Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp
Source/WebKit/chromium/tests/WebPageSerializerTest.cpp
Source/WebKit/chromium/tests/WebViewTest.cpp

index 00b53ef..04849c2 100644 (file)
@@ -1,3 +1,58 @@
+2012-06-28  Alpha Lam  <hclam@chromium.org>
+
+        Unreviewed, rolling out r121463.
+        http://trac.webkit.org/changeset/121463
+        https://bugs.webkit.org/show_bug.cgi?id=90094
+
+        Broke Windows build.
+
+        * WebKit.gypi:
+        * WebKitUnitTests.gyp:
+        * public/WebDOMMessageEvent.h:
+        * tests/AssociatedURLLoaderTest.cpp:
+        (WebKit::AssociatedURLLoaderTest::AssociatedURLLoaderTest):
+        (WebKit::AssociatedURLLoaderTest::SetUp):
+        (WebKit::AssociatedURLLoaderTest::CheckMethodFails):
+        (WebKit::AssociatedURLLoaderTest::CheckHeaderFails):
+        (WebKit::AssociatedURLLoaderTest::CheckAccessControlHeaders):
+        (WebKit::TEST_F):
+        * tests/EventListenerTest.cpp:
+        * tests/FrameTestHelpers.cpp:
+        (WebKit::FrameTestHelpers::registerMockedURLLoad):
+        (FrameTestHelpers):
+        (WebKit::FrameTestHelpers::loadFrame):
+        * tests/FrameTestHelpers.h:
+        (FrameTestHelpers):
+        * tests/ListenerLeakTest.cpp:
+        (WebKit::ListenerLeakTest::RunTest):
+        * tests/PopupMenuTest.cpp:
+        (WebKit::SelectPopupMenuTest::registerMockedURLLoad):
+        (WebKit::SelectPopupMenuTest::loadFrame):
+        (WebKit::TEST_F):
+        * tests/RunAllTests.cpp:
+        * tests/URLTestHelpers.cpp: Removed.
+        * tests/URLTestHelpers.h: Removed.
+        * tests/WebFrameTest.cpp:
+        (WebKit::WebFrameTest::registerMockedHttpURLLoad):
+        (WebKit::WebFrameTest::registerMockedChromeURLLoad):
+        (WebKit::TEST_F):
+        * tests/WebPageNewSerializerTest.cpp:
+        (WebKit::WebPageNewSerializeTest::registerMockedURLLoad):
+        (WebPageNewSerializeTest):
+        (WebKit::WebPageNewSerializeTest::setUpCSSTestPage):
+        (WebKit::WebPageNewSerializeTest::loadURLInTopFrame):
+        (WebKit::WebPageNewSerializeTest::resourceVectorContains):
+        (WebKit::TEST_F):
+        * tests/WebPageSerializerTest.cpp:
+        (WebKit::WebPageSerializerTest::registerMockedURLLoad):
+        (WebKit::WebPageSerializerTest::loadURLInTopFrame):
+        (WebKit::WebPageSerializerTest::webVectorContains):
+        (WebKit::TEST_F):
+        * tests/WebViewTest.cpp:
+        (WebKit::TEST_F):
+        (WebKit::WebViewTest::testAutoResize):
+        (WebKit::WebViewTest::testTextInputType):
+
 2012-06-28  Shawn Singh  <shawnsingh@chromium.org>
 
         [chromium] Use WEBKIT_IMPLEMENTATION == 1 for webkit_unit_tests
index d765ec6..a8dd3a6 100644 (file)
             'tests/TreeSynchronizerTest.cpp',
             'tests/TreeTestHelpers.cpp',
             'tests/TreeTestHelpers.h',
-            'tests/URLTestHelpers.cpp',
-            'tests/URLTestHelpers.h',
             'tests/WebCompositorInputHandlerImplTest.cpp',
             'tests/WebFrameTest.cpp',
             'tests/WebLayerTest.cpp',
index 1081828..58af839 100644 (file)
@@ -78,9 +78,6 @@
                 # add the include path directly.
                 '../../Platform/chromium',
             ],
-            'defines': [
-                'WEBKIT_IMPLEMENTATION=1',
-            ],
             'conditions': [
                 ['inside_chromium_build==1 and component=="shared_library"', {
                     'defines': [
index 6619af2..355b737 100644 (file)
@@ -46,7 +46,6 @@ class WebString;
 
 class WebDOMMessageEvent : public WebDOMEvent {
 public:
-    WebDOMMessageEvent() { }
     WEBKIT_EXPORT void initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId);
 
     WEBKIT_EXPORT WebSerializedScriptValue data() const;
index 7051bf9..03559f7 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "config.h"
 
-#include "URLTestHelpers.h"
 #include "WebFrame.h"
 #include "WebFrameClient.h"
 #include "WebURLLoaderOptions.h"
 #include "platform/WebURLResponse.h"
 #include <wtf/text/WTFString.h>
 
+#include <googleurl/src/gurl.h>
 #include <gtest/gtest.h>
 #include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
-using WebKit::URLTestHelpers::toKURL;
 
 namespace {
 
@@ -77,9 +76,9 @@ public:
         ,  m_runningMessageLoop(false)
     {
         // Reuse one of the test files from WebFrameTest.
-        std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data());
+        std::string filePath = webkit_support::GetWebKitRootDir().utf8();
         filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html";
-        m_frameFilePath = WebString::fromUTF8(filePath.c_str());
+        m_frameFilePath = WebString::fromUTF8(filePath);
     }
 
     void SetUp()
@@ -88,7 +87,7 @@ public:
         m_webView->initializeMainFrame(&m_webFrameClient);
 
         // Load the frame before trying to load resources.
-        WebCore::KURL url = toKURL("http://www.test.com/iframes_test.html");
+        GURL url = GURL("http://www.test.com/iframes_test.html");
         WebURLResponse response;
         response.initialize();
         response.setMIMEType("text/html");
@@ -185,7 +184,7 @@ public:
     {
         WebURLRequest request;
         request.initialize();
-        request.setURL(toKURL("http://www.test.com/success.html"));
+        request.setURL(GURL("http://www.test.com/success.html"));
         request.setHTTPMethod(WebString::fromUTF8(unsafeMethod));
         WebURLLoaderOptions options;
         options.untrustedHTTP = true;
@@ -201,7 +200,7 @@ public:
     {
         WebURLRequest request;
         request.initialize();
-        request.setURL(toKURL("http://www.test.com/success.html"));
+        request.setURL(GURL("http://www.test.com/success.html"));
         request.setHTTPHeaderField(WebString::fromUTF8(headerField), WebString::fromUTF8(headerValue));
         WebURLLoaderOptions options;
         options.untrustedHTTP = true;
@@ -231,7 +230,7 @@ public:
             id.append("-Exposed");
         id.append(".html");
 
-        WebCore::KURL url = toKURL(id);
+        GURL url = GURL(id);
         WebURLRequest request;
         request.initialize();
         request.setURL(url);
@@ -283,7 +282,7 @@ protected:
 // Test a successful same-origin URL load.
 TEST_F(AssociatedURLLoaderTest, SameOriginSuccess)
 {
-    WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html");
+    GURL url = GURL("http://www.test.com/SameOriginSuccess.html");
     WebURLRequest request;
     request.initialize();
     request.setURL(url);
@@ -306,7 +305,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginSuccess)
 TEST_F(AssociatedURLLoaderTest, SameOriginRestriction)
 {
     // This is cross-origin since the frame was loaded from www.test.com.
-    WebCore::KURL url = toKURL("http://www.other.com/SameOriginRestriction.html");
+    GURL url = GURL("http://www.other.com/SameOriginRestriction.html");
     WebURLRequest request;
     request.initialize();
     request.setURL(url);
@@ -317,7 +316,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginRestriction)
 TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess)
 {
     // This is cross-origin since the frame was loaded from www.test.com.
-    WebCore::KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html");
+    GURL url = GURL("http://www.other.com/CrossOriginSuccess.html");
     WebURLRequest request;
     request.initialize();
     request.setURL(url);
@@ -342,7 +341,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess)
 TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess)
 {
     // This is cross-origin since the frame was loaded from www.test.com.
-    WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html");
+    GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html");
     WebURLRequest request;
     request.initialize();
     request.setURL(url);
@@ -368,7 +367,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess)
 TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure)
 {
     // This is cross-origin since the frame was loaded from www.test.com.
-    WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlFailure.html");
+    GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlFailure.html");
     WebURLRequest request;
     request.initialize();
     request.setURL(url);
@@ -399,9 +398,9 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure)
 // Test a same-origin URL redirect and load.
 TEST_F(AssociatedURLLoaderTest, RedirectSuccess)
 {
-    WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html");
+    GURL url = GURL("http://www.test.com/RedirectSuccess.html");
     char redirect[] = "http://www.test.com/RedirectSuccess2.html";  // Same-origin
-    WebCore::KURL redirectURL = toKURL(redirect);
+    GURL redirectURL = GURL(redirect);
 
     WebURLRequest request;
     request.initialize();
@@ -436,9 +435,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectSuccess)
 // Test that a cross origin redirect response without CORS headers fails.
 TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure)
 {
-    WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html");
+    GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html");
     char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlFailure.html";  // Cross-origin
-    WebCore::KURL redirectURL = toKURL(redirect);
+    GURL redirectURL = GURL(redirect);
 
     WebURLRequest request;
     request.initialize();
@@ -468,9 +467,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure)
 // Test that a cross origin redirect response with CORS headers that allow the requesting origin succeeds.
 TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess)
 {
-    WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html");
+    GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html");
     char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlSuccess.html";  // Cross-origin
-    WebCore::KURL redirectURL = toKURL(redirect);
+    GURL redirectURL = GURL(redirect);
 
     WebURLRequest request;
     request.initialize();
@@ -591,7 +590,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderAllowResponseHeaders)
 {
     WebURLRequest request;
     request.initialize();
-    WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html");
+    GURL url = GURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html");
     request.setURL(url);
 
     WebString headerNameString(WebString::fromUTF8("non-whitelisted"));
index 4255469..799ac40 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 
 #include "FrameTestHelpers.h"
-#include "URLTestHelpers.h"
 #include "WebDOMEvent.h"
 #include "WebDOMEventListener.h"
 #include "WebDOMMutationEvent.h"
@@ -79,7 +78,7 @@ public:
         std::string baseURL("http://www.example.com/");
         std::string fileName("listener/mutation_event_listener.html");
         bool executeScript = true;
-        URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));
+        FrameTestHelpers::registerMockedURLLoad(baseURL, fileName);
         m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript);
     }
 
index a2b1675..e406413 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include "FrameTestHelpers.h"
 
-#include "URLTestHelpers.h"
 #include <wtf/StdLibExtras.h>
 #include "WebFrame.h"
 #include "WebFrameClient.h"
 #include "platform/WebURLResponse.h"
 #include "WebView.h"
 #include "WebViewClient.h"
+#include <googleurl/src/gurl.h>
 #include <webkit/support/webkit_support.h>
 
 namespace WebKit {
 namespace FrameTestHelpers {
 
+void registerMockedURLLoad(const std::string& base, const std::string& fileName)
+{
+    registerMockedURLLoad(GURL(base + fileName), fileName);
+}
+
+void registerMockedURLLoad(GURL url, const std::string& fileName)
+{
+    WebURLResponse response;
+    response.initialize();
+    response.setMIMEType("text/html");
+
+    std::string filePath = webkit_support::GetWebKitRootDir().utf8();
+    filePath += "/Source/WebKit/chromium/tests/data/";
+    filePath += fileName;
+
+    webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath));
+}
+
 void loadFrame(WebFrame* frame, const std::string& url)
 {
     WebURLRequest urlRequest;
     urlRequest.initialize();
-    urlRequest.setURL(URLTestHelpers::toKURL(url));
+    urlRequest.setURL(GURL(url));
     frame->loadRequest(urlRequest);
 }
 
index bfb57b6..fc2fa2d 100644 (file)
@@ -33,6 +33,8 @@
 
 #include <string>
 
+class GURL;
+
 namespace WebKit {
 
 class WebFrame;
@@ -42,6 +44,10 @@ class WebViewClient;
 
 namespace FrameTestHelpers {
 
+void registerMockedURLLoad(const std::string& base, const std::string& fileName);
+// Like the previous overload, but it allows more flexibility in the url since it is given by the caller.
+void registerMockedURLLoad(GURL, const std::string& fileName);
+
 void loadFrame(WebFrame*, const std::string& url);
 
 WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0);
index b0f700a..5e321c7 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 
 #include "FrameTestHelpers.h"
-#include "URLTestHelpers.h"
 #include "WebView.h"
 #include <gtest/gtest.h>
 #include <v8/include/v8-profiler.h>
@@ -91,7 +90,7 @@ public:
         std::string baseURL("http://www.example.com/");
         std::string fileName(filename);
         bool executeScript = true;
-        URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));
+        FrameTestHelpers::registerMockedURLLoad(baseURL, fileName);
         m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript);
     }
 
index 59c2336..7acb311 100644 (file)
@@ -43,7 +43,6 @@
 #include "PopupMenuClient.h"
 #include "PopupMenuChromium.h"
 #include "RuntimeEnabledFeatures.h"
-#include "URLTestHelpers.h"
 #include "WebDocument.h"
 #include "WebElement.h"
 #include "WebFrame.h"
@@ -64,7 +63,6 @@
 
 using namespace WebCore;
 using namespace WebKit;
-using WebKit::URLTestHelpers::toKURL;
 
 namespace {
 
@@ -251,7 +249,15 @@ protected:
 
     void registerMockedURLLoad(const std::string& fileName)
     {
-        URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromUTF8("text/html"));
+        WebURLResponse response;
+        response.initialize();
+        response.setMIMEType("text/html");
+
+        std::string filePath = webkit_support::GetWebKitRootDir().utf8();
+        filePath += "/Source/WebKit/chromium/tests/data/popup/";
+        filePath += fileName;
+
+        webkit_support::RegisterMockedURL(WebURL(GURL(baseURL + fileName)), response, WebString::fromUTF8(filePath));
     }
 
     void serveRequests()
@@ -263,7 +269,7 @@ protected:
     {
         WebURLRequest urlRequest;
         urlRequest.initialize();
-        urlRequest.setURL(WebURL(toKURL(baseURL + fileName)));
+        urlRequest.setURL(WebURL(GURL(baseURL + fileName)));
         frame->loadRequest(urlRequest);
     }
 
@@ -421,7 +427,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire)
 
     // mousedown event is held by select node, and we don't simulate the event for the node.
     // So we can only see mouseup and click event.
-    EXPECT_STREQ("upclick", element.innerText().utf8().data());
+    EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str());
 
     // Disable the item at index 1.
     m_popupMenuClient.setDisabledIndex(1);
@@ -433,7 +439,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire)
     simulateLeftMouseUpEvent(row1Point);
 
     // The item at index 1 is disabled, so the text should not be changed.
-    EXPECT_STREQ("upclick", element.innerText().utf8().data());
+    EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str());
 
     showPopup();
     // menuItemHeight * 2.5 means the Y position on the item at index 2.
@@ -442,7 +448,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire)
     simulateLeftMouseUpEvent(row1Point);
 
     // The item is changed to the item at index 2, from index 0, so change event is fired.
-    EXPECT_STREQ("upclickchangeupclick", element.innerText().utf8().data());
+    EXPECT_STREQ("upclickchangeupclick", std::string(element.innerText().utf8()).c_str());
 }
 
 TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent)
@@ -463,7 +469,7 @@ TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent)
 
     WebElement element = m_webView->mainFrame()->document().getElementById("message");
     // We only can see change event but no other mouse related events.
-    EXPECT_STREQ("change", element.innerText().utf8().data());
+    EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str());
 }
 
 TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange)
@@ -485,7 +491,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange)
     simulateLeftMouseUpEvent(row1Point);
 
     WebElement element = m_webView->mainFrame()->document().getElementById("message");
-    EXPECT_STREQ("change", element.innerText().utf8().data());
+    EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str());
 }
 
 TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick)
@@ -507,7 +513,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick)
     simulateLeftMouseUpEvent(row1Point);
 
     WebElement element = m_webView->mainFrame()->document().getElementById("message");
-    EXPECT_STREQ("click", element.innerText().utf8().data());
+    EXPECT_STREQ("click", std::string(element.innerText().utf8()).c_str());
 }
 
 } // namespace
index 5f71b6d..dc05282 100644 (file)
@@ -28,8 +28,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-
 // FIXME: Avoid this source dependency on Chromium's base module.
 #include <base/test/test_suite.h>
 
diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.cpp b/Source/WebKit/chromium/tests/URLTestHelpers.cpp
deleted file mode 100644 (file)
index b2e6039..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "URLTestHelpers.h"
-
-#include "platform/WebURLResponse.h"
-#include <public/WebString.h>
-#include <public/WebURL.h>
-#include <webkit/support/webkit_support.h>
-
-namespace WebKit {
-namespace URLTestHelpers {
-
-void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType)
-{
-    // fullURL = baseURL + fileName.
-    std::string fullString = std::string(baseURL.utf8().data()) + std::string(fileName.utf8().data());
-    registerMockedURLLoad(toKURL(fullString.c_str()), fileName, WebString::fromUTF8(""), mimeType);
-}
-
-void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType)
-{
-    registerMockedURLLoad(fullURL, fileName, WebString::fromUTF8(""), mimeType);
-}
-
-void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType)
-{
-    WebURLResponse response;
-    response.initialize();
-    response.setMIMEType(mimeType);
-    response.setHTTPStatusCode(200);
-
-    // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName.
-    std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data());
-    filePath.append("/Source/WebKit/chromium/tests/data/");
-    filePath.append(std::string(relativeBaseDirectory.utf8().data()));
-    filePath.append(std::string(fileName.utf8().data()));
-
-    webkit_support::RegisterMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str()));
-}
-
-} // namespace URLTestHelpers
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.h b/Source/WebKit/chromium/tests/URLTestHelpers.h
deleted file mode 100644 (file)
index 0b9fb00..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef URLTestHelpers_h
-#define URLTestHelpers_h
-
-#include "KURL.h"
-#include <public/WebString.h>
-
-namespace WebKit {
-
-class WebURL;
-
-namespace URLTestHelpers {
-
-inline WebCore::KURL toKURL(const std::string& url)
-{
-    WTF::String wtfString(url.c_str());
-    return WebCore::KURL(WebCore::ParsedURLString, wtfString);
-}
-
-// Helper functions for mock URLs. These functions set up the desired URL and mimeType, with a 200 OK return status.
-// For the mock URL, fullURL == baseURL + fileName.
-// For the actual file path:  <WebKit root directory> + relativeBaseDirectory + fileName,
-// or, if the relative base directory is not specified:  <WebKit root directory> + fileName.
-//
-void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html"));
-void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html"));
-void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType);
-
-} // namespace URLTestHelpers
-} // namespace WebKit
-
-#endif
index 9b745e0..6b14cff 100644 (file)
@@ -36,7 +36,6 @@
 #include "FrameTestHelpers.h"
 #include "FrameView.h"
 #include "ResourceError.h"
-#include "URLTestHelpers.h"
 #include "WebDataSource.h"
 #include "WebDocument.h"
 #include "WebFindOptions.h"
@@ -56,7 +55,6 @@
 #include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
-using WebKit::URLTestHelpers::toKURL;
 
 namespace {
 
@@ -75,12 +73,12 @@ public:
 
     void registerMockedHttpURLLoad(const std::string& fileName)
     {
-        URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));
+        FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName);
     }
 
     void registerMockedChromeURLLoad(const std::string& fileName)
     {
-        URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL.c_str()), WebString::fromUTF8(fileName.c_str()));
+        FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName);
     }
 
 protected:
@@ -98,7 +96,7 @@ TEST_F(WebFrameTest, ContentText)
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html");
 
     // Now retrieve the frames text and test it only includes visible elements.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = webView->mainFrame()->contentAsText(1024).utf8();
     EXPECT_NE(std::string::npos, content.find(" visible paragraph"));
     EXPECT_NE(std::string::npos, content.find(" visible iframe"));
     EXPECT_EQ(std::string::npos, content.find(" invisible pararaph"));
@@ -158,7 +156,7 @@ TEST_F(WebFrameTest, ChromePageJavascript)
     webView->layout();
 
     // Now retrieve the frame's text and ensure it was modified by running javascript.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = webView->mainFrame()->contentAsText(1024).utf8();
     EXPECT_NE(std::string::npos, content.find("Clobbered"));
 }
 
@@ -177,7 +175,7 @@ TEST_F(WebFrameTest, ChromePageNoJavascript)
     webView->layout();
 
     // Now retrieve the frame's text and ensure it wasn't modified by running javascript.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = webView->mainFrame()->contentAsText(1024).utf8();
     EXPECT_EQ(std::string::npos, content.find("Clobbered"));
 }
 
@@ -189,7 +187,7 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck)
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true);
     
     // Send a message with the correct origin.
-    WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)));
+    WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL)));
     WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent");
     WebDOMMessageEvent message = event.to<WebDOMMessageEvent>();
     WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo"));
@@ -197,14 +195,14 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck)
     webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message);
 
     // Send another message with incorrect origin.
-    WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL)));
+    WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL)));
     webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message);
 
     // Required to see any updates in contentAsText.
     webView->layout();
 
     // Verify that only the first addition is in the body of the page.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = webView->mainFrame()->contentAsText(1024).utf8();
     EXPECT_NE(std::string::npos, content.find("Message 1."));
     EXPECT_EQ(std::string::npos, content.find("Message 2."));
 }
@@ -443,13 +441,13 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState)
     float previousScale = webViewImpl->pageScaleFactor();
 
     // Reload the page using the cache.
-    webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false);
+    webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + secondURL), false);
     webkit_support::ServeAsynchronousMockedRequests();
     ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
     ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor());
 
     // Reload the page while ignoring the cache.
-    webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), true);
+    webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + thirdURL), true);
     webkit_support::ServeAsynchronousMockedRequests();
     ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
     ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor());
@@ -471,8 +469,8 @@ TEST_F(WebFrameTest, IframeRedirect)
     WebVector<WebURL> redirects;
     iframeDataSource->redirectChain(redirects);
     ASSERT_EQ(2U, redirects.size());
-    EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data()));
-    EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data()));
+    EXPECT_EQ(GURL("about:blank"), GURL(redirects[0]));
+    EXPECT_EQ(GURL("http://www.test.com/visible_iframe.html"), GURL(redirects[1]));
 
     webView->close();
 }
@@ -733,19 +731,19 @@ TEST_F(WebFrameTest, GetContentAsPlainText)
 
     // Generate a simple test case.
     const char simpleSource[] = "<div>Foo bar</div><div></div>baz";
-    WebCore::KURL testURL = toKURL("about:blank");
+    GURL testURL("about:blank");
     frame->loadHTMLString(simpleSource, testURL);
     webkit_support::RunAllPendingMessages();
 
     // Make sure it comes out OK.
     const std::string expected("Foo bar\nbaz");
     WebString text = frame->contentAsText(std::numeric_limits<size_t>::max());
-    EXPECT_EQ(expected, std::string(text.utf8().data()));
+    EXPECT_EQ(expected, std::string(text.utf8()));
 
     // Try reading the same one with clipping of the text.
     const int length = 5;
     text = frame->contentAsText(length);
-    EXPECT_EQ(expected.substr(0, length), std::string(text.utf8().data()));
+    EXPECT_EQ(expected.substr(0, length), std::string(text.utf8()));
 
     // Now do a new test with a subframe.
     const char outerFrameSource[] = "Hello<iframe></iframe> world";
@@ -759,12 +757,12 @@ TEST_F(WebFrameTest, GetContentAsPlainText)
     webkit_support::RunAllPendingMessages();
 
     text = frame->contentAsText(std::numeric_limits<size_t>::max());
-    EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8().data()));
+    EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8()));
 
     // Get the frame text where the subframe separator falls on the boundary of
     // what we'll take. There used to be a crash in this case.
     text = frame->contentAsText(12);
-    EXPECT_EQ("Hello world", std::string(text.utf8().data()));
+    EXPECT_EQ("Hello world", std::string(text.utf8()));
 
     webView->close();
 }
@@ -776,23 +774,23 @@ TEST_F(WebFrameTest, GetFullHtmlOfPage)
 
     // Generate a simple test case.
     const char simpleSource[] = "<p>Hello</p><p>World</p>";
-    WebCore::KURL testURL = toKURL("about:blank");
+    GURL testURL("about:blank");
     frame->loadHTMLString(simpleSource, testURL);
     webkit_support::RunAllPendingMessages();
 
     WebString text = frame->contentAsText(std::numeric_limits<size_t>::max());
-    EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data()));
+    EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8()));
 
-    const std::string html = std::string(frame->contentAsMarkup().utf8().data());
+    const std::string html = frame->contentAsMarkup().utf8();
 
     // Load again with the output html.
-    frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL);
+    frame->loadHTMLString(html, testURL);
     webkit_support::RunAllPendingMessages();
 
-    EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data()));
+    EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8()));
 
     text = frame->contentAsText(std::numeric_limits<size_t>::max());
-    EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data()));
+    EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8()));
 
     // Test selection check
     EXPECT_FALSE(frame->hasSelection());
index 3ea4fcf..5c3ba98 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "config.h"
 
-#include "URLTestHelpers.h"
 #include "WebFrame.h"
 #include "WebFrameClient.h"
 #include "WebPageSerializer.h"
 #include "platform/WebURLResponse.h"
 #include "WebView.h"
 
+#include <googleurl/src/gurl.h>
 #include <gtest/gtest.h>
 #include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
-using WebKit::URLTestHelpers::toKURL;
-using WebKit::URLTestHelpers::registerMockedURLLoad;
 
 namespace {
 
@@ -112,29 +110,41 @@ protected:
         m_webView->close();
     }
 
+    void registerMockedURLLoad(const WebURL& url, const WebString& fileName, const WebString& mimeType)
+    {
+        WebURLResponse response;
+        response.initialize();
+        response.setMIMEType(mimeType);
+        response.setHTTPStatusCode(200);
+        std::string filePath = webkit_support::GetWebKitRootDir().utf8();
+        filePath.append("/Source/WebKit/chromium/tests/data/pageserializer/");
+        filePath.append(fileName.utf8());
+        webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath));
+    }
+
     WebURL setUpCSSTestPage()
     {
-        WebURL topFrameURL = toKURL("http://www.test.com");
-        registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), WebString::fromUTF8("pageserializer/"), cssMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-        registerMockedURLLoad(toKURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
+        WebURL topFrameURL = GURL("http://www.test.com");
+        registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), htmlMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), cssMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), cssMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), cssMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), pngMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), pngMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), pngMimeType());
+        registerMockedURLLoad(GURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), pngMimeType());
         return topFrameURL;
     }
 
-    void loadURLInTopFrame(const WebURL& url)
+    void loadURLInTopFrame(const GURL& url)
     {
         WebURLRequest urlRequest;
         urlRequest.initialize();
-        urlRequest.setURL(url);
+        urlRequest.setURL(WebURL(url));
         m_webView->mainFrame()->loadRequest(urlRequest);
         // Make sure any pending request get served.
         webkit_support::ServeAsynchronousMockedRequests();
@@ -151,7 +161,7 @@ protected:
 
     static bool resourceVectorContains(const WebVector<WebPageSerializer::Resource>& resources, const char* url, const char* mimeType)
     {
-        WebURL webURL = WebURL(toKURL(url));
+        WebURL webURL = WebURL(GURL(url));
         for (size_t i = 0; i < resources.size(); ++i) {
             const WebPageSerializer::Resource& resource = resources[i];
             if (resource.url == webURL && !resource.data.isEmpty() && !resource.mimeType.compare(WebCString(mimeType)))
@@ -174,13 +184,13 @@ private:
 TEST_F(WebPageNewSerializeTest, PageWithFrames)
 {
     // Register the mocked frames.
-    WebURL topFrameURL = toKURL("http://www.test.com");
-    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
+    WebURL topFrameURL = GURL("http://www.test.com");
+    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), htmlMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), htmlMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), htmlMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType());
 
     loadURLInTopFrame(topFrameURL);
 
@@ -190,7 +200,7 @@ TEST_F(WebPageNewSerializeTest, PageWithFrames)
 
     // The first resource should be the main-frame.
     const WebPageSerializer::Resource& resource = resources[0];
-    EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com")));
+    EXPECT_TRUE(resource.url == GURL("http://www.test.com"));
     EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
     EXPECT_FALSE(resource.data.isEmpty());
 
@@ -217,7 +227,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources)
 
     // The first resource should be the main-frame.
     const WebPageSerializer::Resource& resource = resources[0];
-    EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com")));
+    EXPECT_TRUE(resource.url == GURL("http://www.test.com"));
     EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
     EXPECT_FALSE(resource.data.isEmpty());
 
@@ -239,11 +249,11 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources)
 TEST_F(WebPageNewSerializeTest, BlankFrames)
 {
     // Register the mocked frame and load it.
-    WebURL topFrameURL = toKURL("http://www.test.com");
-    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-    registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
+    WebURL topFrameURL = GURL("http://www.test.com");
+    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), htmlMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType());
+    registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType());
 
     loadURLInTopFrame(topFrameURL);
 
@@ -253,7 +263,7 @@ TEST_F(WebPageNewSerializeTest, BlankFrames)
 
     // The first resource should be the main-frame.
     const WebPageSerializer::Resource& resource = resources[0];
-    EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com")));
+    EXPECT_TRUE(resource.url == GURL("http://www.test.com"));
     EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
     EXPECT_FALSE(resource.data.isEmpty());
 
@@ -269,8 +279,8 @@ TEST_F(WebPageNewSerializeTest, BlankFrames)
 
 TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration)
 {
-    WebURL topFrameURL = toKURL("http://www.test.com/simple.xhtml");
-    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), WebString::fromUTF8("pageserializer/"), xhtmlMimeType());
+    WebURL topFrameURL = GURL("http://www.test.com/simple.xhtml");
+    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), xhtmlMimeType());
 
     loadURLInTopFrame(topFrameURL);
 
@@ -280,7 +290,7 @@ TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration)
 
     // We expect only one resource, the XML.
     ASSERT_EQ(1U, resources.size());
-    std::string xml = std::string(resources[0].data.data());
+    std::string xml = resources[0].data;
 
     // We should have one and only one instance of the XML declaration.
     size_t pos = xml.find("<?xml version=");
@@ -300,7 +310,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_TestMHTMLEncoding)
     ASSERT_FALSE(mhtmlData.isEmpty());
 
     // Read the MHTML data line per line and do some pseudo-parsing to make sure the right encoding is used for the different sections.
-    LineReader lineReader(std::string(mhtmlData.data()));
+    LineReader lineReader(mhtmlData);
     int sectionCheckedCount = 0;
     const char* expectedEncoding = 0;
     std::string line;
index feb5f7f..aa0c6dc 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include "WebPageSerializer.h"
 
-#include "URLTestHelpers.h"
 #include "WebFrame.h"
 #include "WebFrameClient.h"
 #include "platform/WebString.h"
 #include "platform/WebURLResponse.h"
 #include "WebView.h"
 
+#include <googleurl/src/gurl.h>
 #include <gtest/gtest.h>
 #include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
-using WebKit::URLTestHelpers::toKURL;
 
 namespace {
 
@@ -74,16 +73,22 @@ protected:
         m_webView->close();
     }
 
-    void registerMockedURLLoad(const std::string& url, const WebString& fileName)
+    void registerMockedURLLoad(const WebURL& url, const WebString& fileName)
     {
-        URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::fromUTF8("pageserialization/"), WebString::fromUTF8("text/html"));
+        WebURLResponse response;
+        response.initialize();
+        response.setMIMEType("text/html");
+        std::string filePath = webkit_support::GetWebKitRootDir().utf8();
+        filePath.append("/Source/WebKit/chromium/tests/data/pageserialization/");
+        filePath.append(fileName.utf8());
+        webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath));
     }
 
-    void loadURLInTopFrame(const WebURL& url)
+    void loadURLInTopFrame(const GURL& url)
     {
         WebURLRequest urlRequest;
         urlRequest.initialize();
-        urlRequest.setURL(url);
+        urlRequest.setURL(WebURL(url));
         m_webView->mainFrame()->loadRequest(urlRequest);
         // Make sure any pending request get served.
         webkit_support::ServeAsynchronousMockedRequests();
@@ -91,7 +96,7 @@ protected:
 
     static bool webVectorContains(const WebVector<WebURL>& vector, const char* url)
     {
-        return vector.contains(WebURL(toKURL(std::string(url))));
+        return vector.contains(WebURL(GURL(url)));
     }
 
     // Useful for debugging.
@@ -111,8 +116,8 @@ private:
 TEST_F(WebPageSerializerTest, HTMLNodes)
 {
     // Register the mocked frame and load it.
-    WebURL topFrameURL = toKURL("http://www.test.com");
-    registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("simple_page.html"));
+    WebURL topFrameURL = GURL("http://www.test.com");
+    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple_page.html"));
     loadURLInTopFrame(topFrameURL);
 
     // Retrieve all resources.
@@ -145,18 +150,18 @@ TEST_F(WebPageSerializerTest, HTMLNodes)
 TEST_F(WebPageSerializerTest, MultipleFrames)
 {
     // Register the mocked frames.
-    WebURL topFrameURL = toKURL("http://www.test.com");
-    registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("top_frame.html"));
-    registerMockedURLLoad("http://www.test.com/simple_iframe.html",
+    WebURL topFrameURL = GURL("http://www.test.com");
+    registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"));
+    registerMockedURLLoad(GURL("http://www.test.com/simple_iframe.html"),
                           WebString::fromUTF8("simple_iframe.html"));
-    registerMockedURLLoad("http://www.test.com/object_iframe.html",
+    registerMockedURLLoad(GURL("http://www.test.com/object_iframe.html"),
                           WebString::fromUTF8("object_iframe.html"));
-    registerMockedURLLoad("http://www.test.com/embed_iframe.html",
+    registerMockedURLLoad(GURL("http://www.test.com/embed_iframe.html"),
                           WebString::fromUTF8("embed_iframe.html"));
     // If we don't register a mocked resource for awesome.png, it causes the
     // document loader of the iframe that has it as its src to assert on close,
     // not sure why.
-    registerMockedURLLoad("http://www.test.com/awesome.png",
+    registerMockedURLLoad(GURL("http://www.test.com/awesome.png"),
                           WebString::fromUTF8("awesome.png"));
 
     loadURLInTopFrame(topFrameURL);
index f28d0e2..8eccf2c 100644 (file)
@@ -35,7 +35,6 @@
 #include "FrameTestHelpers.h"
 #include "FrameView.h"
 #include "HTMLDocument.h"
-#include "URLTestHelpers.h"
 #include "WebDocument.h"
 #include "WebFrame.h"
 #include "WebFrameClient.h"
 #include "platform/WebSize.h"
 #include "WebViewClient.h"
 #include "WebViewImpl.h"
+#include <googleurl/src/gurl.h>
 #include <gtest/gtest.h>
 #include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
-using WebKit::URLTestHelpers::toKURL;
 
 namespace {
 
@@ -118,7 +117,7 @@ protected:
 
 TEST_F(WebViewTest, FocusIsInactive)
 {
-    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html");
+    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html");
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html");
 
     webView->setFocus(true);
@@ -146,7 +145,7 @@ TEST_F(WebViewTest, FocusIsInactive)
 
 TEST_F(WebViewTest, ActiveState)
 {
-    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html");
+    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html");
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html");
 
     ASSERT_TRUE(webView);
@@ -170,7 +169,7 @@ void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& ma
 {
     AutoResizeWebViewClient client;
     std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageHeight;
-    URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html");
+    FrameTestHelpers::registerMockedURLLoad(GURL(url), "specify_size.html");
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true, 0, &client);
     client.testData().setWebView(webView);
 
@@ -269,7 +268,7 @@ TEST_F(WebViewTest, AutoResizeMaxSize)
 
 void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile)
 {
-    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str()));
+    FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile);
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile);
     webView->setInitialFocus(false);
     EXPECT_EQ(expectedType, webView->textInputType());
@@ -309,7 +308,7 @@ TEST_F(WebViewTest, DISABLED_TextInputType)
 
 TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo)
 {
-    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html"));
+    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_populated.html");
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html");
     webView->setInitialFocus(false);
     webView->setEditableSelectionOffsets(5, 13);
@@ -323,7 +322,7 @@ TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo)
     EXPECT_EQ(-1, info.compositionEnd);
     webView->close();
 
-    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html"));
+    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "content_editable_populated.html");
     webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_editable_populated.html");
     webView->setInitialFocus(false);
     webView->setEditableSelectionOffsets(8, 19);