Changeset 121469 in webkit


Ignore:
Timestamp:
Jun 28, 2012 2:10:12 PM (12 years ago)
Author:
hclam@chromium.org
Message:

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):

Location:
trunk/Source/WebKit/chromium
Files:
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r121463 r121469  
     12012-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
    1562012-06-28  Shawn Singh  <shawnsingh@chromium.org>
    257
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r121463 r121469  
    147147            'tests/TreeTestHelpers.cpp',
    148148            'tests/TreeTestHelpers.h',
    149             'tests/URLTestHelpers.cpp',
    150             'tests/URLTestHelpers.h',
    151149            'tests/WebCompositorInputHandlerImplTest.cpp',
    152150            'tests/WebFrameTest.cpp',
  • trunk/Source/WebKit/chromium/WebKitUnitTests.gyp

    r121463 r121469  
    7979                '../../Platform/chromium',
    8080            ],
    81             'defines': [
    82                 'WEBKIT_IMPLEMENTATION=1',
    83             ],
    8481            'conditions': [
    8582                ['inside_chromium_build==1 and component=="shared_library"', {
  • trunk/Source/WebKit/chromium/public/WebDOMMessageEvent.h

    r121463 r121469  
    4747class WebDOMMessageEvent : public WebDOMEvent {
    4848public:
    49     WebDOMMessageEvent() { }
    5049    WEBKIT_EXPORT void initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId);
    5150
  • trunk/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp

    r121463 r121469  
    3131#include "config.h"
    3232
    33 #include "URLTestHelpers.h"
    3433#include "WebFrame.h"
    3534#include "WebFrameClient.h"
     
    4443#include <wtf/text/WTFString.h>
    4544
     45#include <googleurl/src/gurl.h>
    4646#include <gtest/gtest.h>
    4747#include <webkit/support/webkit_support.h>
    4848
    4949using namespace WebKit;
    50 using WebKit::URLTestHelpers::toKURL;
    5150
    5251namespace {
     
    7877    {
    7978        // 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();
    8180        filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html";
    82         m_frameFilePath = WebString::fromUTF8(filePath.c_str());
     81        m_frameFilePath = WebString::fromUTF8(filePath);
    8382    }
    8483
     
    8988
    9089        // 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");
    9291        WebURLResponse response;
    9392        response.initialize();
     
    186185        WebURLRequest request;
    187186        request.initialize();
    188         request.setURL(toKURL("http://www.test.com/success.html"));
     187        request.setURL(GURL("http://www.test.com/success.html"));
    189188        request.setHTTPMethod(WebString::fromUTF8(unsafeMethod));
    190189        WebURLLoaderOptions options;
     
    202201        WebURLRequest request;
    203202        request.initialize();
    204         request.setURL(toKURL("http://www.test.com/success.html"));
     203        request.setURL(GURL("http://www.test.com/success.html"));
    205204        request.setHTTPHeaderField(WebString::fromUTF8(headerField), WebString::fromUTF8(headerValue));
    206205        WebURLLoaderOptions options;
     
    232231        id.append(".html");
    233232
    234         WebCore::KURL url = toKURL(id);
     233        GURL url = GURL(id);
    235234        WebURLRequest request;
    236235        request.initialize();
     
    284283TEST_F(AssociatedURLLoaderTest, SameOriginSuccess)
    285284{
    286     WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html");
     285    GURL url = GURL("http://www.test.com/SameOriginSuccess.html");
    287286    WebURLRequest request;
    288287    request.initialize();
     
    307306{
    308307    // 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");
    310309    WebURLRequest request;
    311310    request.initialize();
     
    318317{
    319318    // 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");
    321320    WebURLRequest request;
    322321    request.initialize();
     
    343342{
    344343    // 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");
    346345    WebURLRequest request;
    347346    request.initialize();
     
    369368{
    370369    // 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");
    372371    WebURLRequest request;
    373372    request.initialize();
     
    400399TEST_F(AssociatedURLLoaderTest, RedirectSuccess)
    401400{
    402     WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html");
     401    GURL url = GURL("http://www.test.com/RedirectSuccess.html");
    403402    char redirect[] = "http://www.test.com/RedirectSuccess2.html";  // Same-origin
    404     WebCore::KURL redirectURL = toKURL(redirect);
     403    GURL redirectURL = GURL(redirect);
    405404
    406405    WebURLRequest request;
     
    437436TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure)
    438437{
    439     WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html");
     438    GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html");
    440439    char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlFailure.html";  // Cross-origin
    441     WebCore::KURL redirectURL = toKURL(redirect);
     440    GURL redirectURL = GURL(redirect);
    442441
    443442    WebURLRequest request;
     
    469468TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess)
    470469{
    471     WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html");
     470    GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html");
    472471    char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlSuccess.html";  // Cross-origin
    473     WebCore::KURL redirectURL = toKURL(redirect);
     472    GURL redirectURL = GURL(redirect);
    474473
    475474    WebURLRequest request;
     
    592591    WebURLRequest request;
    593592    request.initialize();
    594     WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html");
     593    GURL url = GURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html");
    595594    request.setURL(url);
    596595
  • trunk/Source/WebKit/chromium/tests/EventListenerTest.cpp

    r121463 r121469  
    3232
    3333#include "FrameTestHelpers.h"
    34 #include "URLTestHelpers.h"
    3534#include "WebDOMEvent.h"
    3635#include "WebDOMEventListener.h"
     
    8079        std::string fileName("listener/mutation_event_listener.html");
    8180        bool executeScript = true;
    82         URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));
     81        FrameTestHelpers::registerMockedURLLoad(baseURL, fileName);
    8382        m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript);
    8483    }
  • trunk/Source/WebKit/chromium/tests/FrameTestHelpers.cpp

    r121463 r121469  
    3232#include "FrameTestHelpers.h"
    3333
    34 #include "URLTestHelpers.h"
    3534#include <wtf/StdLibExtras.h>
    3635#include "WebFrame.h"
     
    4241#include "WebView.h"
    4342#include "WebViewClient.h"
     43#include <googleurl/src/gurl.h>
    4444#include <webkit/support/webkit_support.h>
    4545
     
    4747namespace FrameTestHelpers {
    4848
     49void registerMockedURLLoad(const std::string& base, const std::string& fileName)
     50{
     51    registerMockedURLLoad(GURL(base + fileName), fileName);
     52}
     53
     54void 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
    4967void loadFrame(WebFrame* frame, const std::string& url)
    5068{
    5169    WebURLRequest urlRequest;
    5270    urlRequest.initialize();
    53     urlRequest.setURL(URLTestHelpers::toKURL(url));
     71    urlRequest.setURL(GURL(url));
    5472    frame->loadRequest(urlRequest);
    5573}
  • trunk/Source/WebKit/chromium/tests/FrameTestHelpers.h

    r121463 r121469  
    3434#include <string>
    3535
     36class GURL;
     37
    3638namespace WebKit {
    3739
     
    4345namespace FrameTestHelpers {
    4446
     47void 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.
     49void registerMockedURLLoad(GURL, const std::string& fileName);
     50
    4551void loadFrame(WebFrame*, const std::string& url);
    4652
  • trunk/Source/WebKit/chromium/tests/ListenerLeakTest.cpp

    r121463 r121469  
    3232
    3333#include "FrameTestHelpers.h"
    34 #include "URLTestHelpers.h"
    3534#include "WebView.h"
    3635#include <gtest/gtest.h>
     
    9291        std::string fileName(filename);
    9392        bool executeScript = true;
    94         URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));
     93        FrameTestHelpers::registerMockedURLLoad(baseURL, fileName);
    9594        m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript);
    9695    }
  • trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp

    r121463 r121469  
    4444#include "PopupMenuChromium.h"
    4545#include "RuntimeEnabledFeatures.h"
    46 #include "URLTestHelpers.h"
    4746#include "WebDocument.h"
    4847#include "WebElement.h"
     
    6564using namespace WebCore;
    6665using namespace WebKit;
    67 using WebKit::URLTestHelpers::toKURL;
    6866
    6967namespace {
     
    252250    void registerMockedURLLoad(const std::string& fileName)
    253251    {
    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));
    255261    }
    256262
     
    264270        WebURLRequest urlRequest;
    265271        urlRequest.initialize();
    266         urlRequest.setURL(WebURL(toKURL(baseURL + fileName)));
     272        urlRequest.setURL(WebURL(GURL(baseURL + fileName)));
    267273        frame->loadRequest(urlRequest);
    268274    }
     
    422428    // mousedown event is held by select node, and we don't simulate the event for the node.
    423429    // 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());
    425431
    426432    // Disable the item at index 1.
     
    434440
    435441    // 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());
    437443
    438444    showPopup();
     
    443449
    444450    // 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());
    446452}
    447453
     
    464470    WebElement element = m_webView->mainFrame()->document().getElementById("message");
    465471    // 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());
    467473}
    468474
     
    486492
    487493    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());
    489495}
    490496
     
    508514
    509515    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());
    511517}
    512518
  • trunk/Source/WebKit/chromium/tests/RunAllTests.cpp

    r121463 r121469  
    2828 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929 */
    30 
    31 #include "config.h"
    3230
    3331// FIXME: Avoid this source dependency on Chromium's base module.
  • trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp

    r121463 r121469  
    3737#include "FrameView.h"
    3838#include "ResourceError.h"
    39 #include "URLTestHelpers.h"
    4039#include "WebDataSource.h"
    4140#include "WebDocument.h"
     
    5756
    5857using namespace WebKit;
    59 using WebKit::URLTestHelpers::toKURL;
    6058
    6159namespace {
     
    7674    void registerMockedHttpURLLoad(const std::string& fileName)
    7775    {
    78         URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));
     76        FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName);
    7977    }
    8078
    8179    void registerMockedChromeURLLoad(const std::string& fileName)
    8280    {
    83         URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL.c_str()), WebString::fromUTF8(fileName.c_str()));
     81        FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName);
    8482    }
    8583
     
    9997
    10098    // 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();
    102100    EXPECT_NE(std::string::npos, content.find(" visible paragraph"));
    103101    EXPECT_NE(std::string::npos, content.find(" visible iframe"));
     
    159157
    160158    // 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();
    162160    EXPECT_NE(std::string::npos, content.find("Clobbered"));
    163161}
     
    178176
    179177    // 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();
    181179    EXPECT_EQ(std::string::npos, content.find("Clobbered"));
    182180}
     
    190188   
    191189    // Send a message with the correct origin.
    192     WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)));
     190    WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL)));
    193191    WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent");
    194192    WebDOMMessageEvent message = event.to<WebDOMMessageEvent>();
     
    198196
    199197    // Send another message with incorrect origin.
    200     WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL)));
     198    WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL)));
    201199    webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message);
    202200
     
    205203
    206204    // 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();
    208206    EXPECT_NE(std::string::npos, content.find("Message 1."));
    209207    EXPECT_EQ(std::string::npos, content.find("Message 2."));
     
    444442
    445443    // Reload the page using the cache.
    446     webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false);
     444    webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + secondURL), false);
    447445    webkit_support::ServeAsynchronousMockedRequests();
    448446    ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
     
    450448
    451449    // 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);
    453451    webkit_support::ServeAsynchronousMockedRequests();
    454452    ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
     
    472470    iframeDataSource->redirectChain(redirects);
    473471    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]));
    476474
    477475    webView->close();
     
    734732    // Generate a simple test case.
    735733    const char simpleSource[] = "<div>Foo bar</div><div></div>baz";
    736     WebCore::KURL testURL = toKURL("about:blank");
     734    GURL testURL("about:blank");
    737735    frame->loadHTMLString(simpleSource, testURL);
    738736    webkit_support::RunAllPendingMessages();
     
    741739    const std::string expected("Foo bar\nbaz");
    742740    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()));
    744742
    745743    // Try reading the same one with clipping of the text.
    746744    const int length = 5;
    747745    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()));
    749747
    750748    // Now do a new test with a subframe.
     
    760758
    761759    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()));
    763761
    764762    // Get the frame text where the subframe separator falls on the boundary of
    765763    // what we'll take. There used to be a crash in this case.
    766764    text = frame->contentAsText(12);
    767     EXPECT_EQ("Hello world", std::string(text.utf8().data()));
     765    EXPECT_EQ("Hello world", std::string(text.utf8()));
    768766
    769767    webView->close();
     
    777775    // Generate a simple test case.
    778776    const char simpleSource[] = "<p>Hello</p><p>World</p>";
    779     WebCore::KURL testURL = toKURL("about:blank");
     777    GURL testURL("about:blank");
    780778    frame->loadHTMLString(simpleSource, testURL);
    781779    webkit_support::RunAllPendingMessages();
    782780
    783781    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();
    787785
    788786    // Load again with the output html.
    789     frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL);
     787    frame->loadHTMLString(html, testURL);
    790788    webkit_support::RunAllPendingMessages();
    791789
    792     EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data()));
     790    EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8()));
    793791
    794792    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()));
    796794
    797795    // Test selection check
  • trunk/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp

    r121463 r121469  
    3131#include "config.h"
    3232
    33 #include "URLTestHelpers.h"
    3433#include "WebFrame.h"
    3534#include "WebFrameClient.h"
     
    4342#include "WebView.h"
    4443
     44#include <googleurl/src/gurl.h>
    4545#include <gtest/gtest.h>
    4646#include <webkit/support/webkit_support.h>
    4747
    4848using namespace WebKit;
    49 using WebKit::URLTestHelpers::toKURL;
    50 using WebKit::URLTestHelpers::registerMockedURLLoad;
    5149
    5250namespace {
     
    113111    }
    114112
     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
    115125    WebURL setUpCSSTestPage()
    116126    {
    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());
    130140        return topFrameURL;
    131141    }
    132142
    133     void loadURLInTopFrame(const WebURL& url)
     143    void loadURLInTopFrame(const GURL& url)
    134144    {
    135145        WebURLRequest urlRequest;
    136146        urlRequest.initialize();
    137         urlRequest.setURL(url);
     147        urlRequest.setURL(WebURL(url));
    138148        m_webView->mainFrame()->loadRequest(urlRequest);
    139149        // Make sure any pending request get served.
     
    152162    static bool resourceVectorContains(const WebVector<WebPageSerializer::Resource>& resources, const char* url, const char* mimeType)
    153163    {
    154         WebURL webURL = WebURL(toKURL(url));
     164        WebURL webURL = WebURL(GURL(url));
    155165        for (size_t i = 0; i < resources.size(); ++i) {
    156166            const WebPageSerializer::Resource& resource = resources[i];
     
    175185{
    176186    // 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());
    184194
    185195    loadURLInTopFrame(topFrameURL);
     
    191201    // The first resource should be the main-frame.
    192202    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"));
    194204    EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
    195205    EXPECT_FALSE(resource.data.isEmpty());
     
    218228    // The first resource should be the main-frame.
    219229    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"));
    221231    EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
    222232    EXPECT_FALSE(resource.data.isEmpty());
     
    240250{
    241251    // 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());
    247257
    248258    loadURLInTopFrame(topFrameURL);
     
    254264    // The first resource should be the main-frame.
    255265    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"));
    257267    EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
    258268    EXPECT_FALSE(resource.data.isEmpty());
     
    270280TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration)
    271281{
    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());
    274284
    275285    loadURLInTopFrame(topFrameURL);
     
    281291    // We expect only one resource, the XML.
    282292    ASSERT_EQ(1U, resources.size());
    283     std::string xml = std::string(resources[0].data.data());
     293    std::string xml = resources[0].data;
    284294
    285295    // We should have one and only one instance of the XML declaration.
     
    301311
    302312    // 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);
    304314    int sectionCheckedCount = 0;
    305315    const char* expectedEncoding = 0;
  • trunk/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp

    r121463 r121469  
    3232#include "WebPageSerializer.h"
    3333
    34 #include "URLTestHelpers.h"
    3534#include "WebFrame.h"
    3635#include "WebFrameClient.h"
     
    4140#include "WebView.h"
    4241
     42#include <googleurl/src/gurl.h>
    4343#include <gtest/gtest.h>
    4444#include <webkit/support/webkit_support.h>
    4545
    4646using namespace WebKit;
    47 using WebKit::URLTestHelpers::toKURL;
    4847
    4948namespace {
     
    7574    }
    7675
    77     void registerMockedURLLoad(const std::string& url, const WebString& fileName)
     76    void registerMockedURLLoad(const WebURL& url, const WebString& fileName)
    7877    {
    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));
    8085    }
    8186
    82     void loadURLInTopFrame(const WebURL& url)
     87    void loadURLInTopFrame(const GURL& url)
    8388    {
    8489        WebURLRequest urlRequest;
    8590        urlRequest.initialize();
    86         urlRequest.setURL(url);
     91        urlRequest.setURL(WebURL(url));
    8792        m_webView->mainFrame()->loadRequest(urlRequest);
    8893        // Make sure any pending request get served.
     
    9297    static bool webVectorContains(const WebVector<WebURL>& vector, const char* url)
    9398    {
    94         return vector.contains(WebURL(toKURL(std::string(url))));
     99        return vector.contains(WebURL(GURL(url)));
    95100    }
    96101
     
    112117{
    113118    // 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"));
    116121    loadURLInTopFrame(topFrameURL);
    117122
     
    146151{
    147152    // 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"),
    151156                          WebString::fromUTF8("simple_iframe.html"));
    152     registerMockedURLLoad("http://www.test.com/object_iframe.html",
     157    registerMockedURLLoad(GURL("http://www.test.com/object_iframe.html"),
    153158                          WebString::fromUTF8("object_iframe.html"));
    154     registerMockedURLLoad("http://www.test.com/embed_iframe.html",
     159    registerMockedURLLoad(GURL("http://www.test.com/embed_iframe.html"),
    155160                          WebString::fromUTF8("embed_iframe.html"));
    156161    // If we don't register a mocked resource for awesome.png, it causes the
    157162    // document loader of the iframe that has it as its src to assert on close,
    158163    // not sure why.
    159     registerMockedURLLoad("http://www.test.com/awesome.png",
     164    registerMockedURLLoad(GURL("http://www.test.com/awesome.png"),
    160165                          WebString::fromUTF8("awesome.png"));
    161166
  • trunk/Source/WebKit/chromium/tests/WebViewTest.cpp

    r121463 r121469  
    3636#include "FrameView.h"
    3737#include "HTMLDocument.h"
    38 #include "URLTestHelpers.h"
    3938#include "WebDocument.h"
    4039#include "WebFrame.h"
     
    4443#include "WebViewClient.h"
    4544#include "WebViewImpl.h"
     45#include <googleurl/src/gurl.h>
    4646#include <gtest/gtest.h>
    4747#include <webkit/support/webkit_support.h>
    4848
    4949using namespace WebKit;
    50 using WebKit::URLTestHelpers::toKURL;
    5150
    5251namespace {
     
    119118TEST_F(WebViewTest, FocusIsInactive)
    120119{
    121     URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html");
     120    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html");
    122121    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html");
    123122
     
    147146TEST_F(WebViewTest, ActiveState)
    148147{
    149     URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html");
     148    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html");
    150149    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html");
    151150
     
    171170    AutoResizeWebViewClient client;
    172171    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");
    174173    WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true, 0, &client);
    175174    client.testData().setWebView(webView);
     
    270269void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile)
    271270{
    272     URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str()));
     271    FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile);
    273272    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile);
    274273    webView->setInitialFocus(false);
     
    310309TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo)
    311310{
    312     URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html"));
     311    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_populated.html");
    313312    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html");
    314313    webView->setInitialFocus(false);
     
    324323    webView->close();
    325324
    326     URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html"));
     325    FrameTestHelpers::registerMockedURLLoad(m_baseURL, "content_editable_populated.html");
    327326    webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_editable_populated.html");
    328327    webView->setInitialFocus(false);
Note: See TracChangeset for help on using the changeset viewer.