Changeset 142422 in webkit


Ignore:
Timestamp:
Feb 10, 2013 6:38:06 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Enable more of webkit_unit_tests in component builds
https://bugs.webkit.org/show_bug.cgi?id=109369

Patch by James Robinson <jamesr@chromium.org> on 2013-02-10
Reviewed by Darin Fisher.

Updates all webkit_unit_tests (except for LevelDBTest) to go through the Platform API instead of directly
calling into webkit_support so they work in component builds.

  • WebKit.gyp:
  • tests/AssociatedURLLoaderTest.cpp:
  • tests/EventListenerTest.cpp:
  • tests/FrameTestHelpers.cpp:

(WebKit::FrameTestHelpers::createWebViewAndLoad):
(QuitTask):
(WebKit::FrameTestHelpers::QuitTask::run):
(FrameTestHelpers):
(WebKit::FrameTestHelpers::runPendingTasks):

  • tests/FrameTestHelpers.h:

(FrameTestHelpers):

  • tests/ListenerLeakTest.cpp:
  • tests/PopupMenuTest.cpp:
  • tests/PrerenderingTest.cpp:
  • tests/ScrollingCoordinatorChromiumTest.cpp:

(WebKit::ScrollingCoordinatorChromiumTest::~ScrollingCoordinatorChromiumTest):
(WebKit::ScrollingCoordinatorChromiumTest::navigateTo):

  • tests/URLTestHelpers.cpp:

(WebKit::URLTestHelpers::registerMockedURLLoad):

  • tests/WebFrameTest.cpp:
  • tests/WebImageTest.cpp:

(WebKit::readFile):

  • tests/WebPageNewSerializerTest.cpp:
  • tests/WebPageSerializerTest.cpp:
  • tests/WebPluginContainerTest.cpp:

(WebKit::WebPluginContainerTest::TearDown):
(WebKit::TEST_F):

  • tests/WebViewTest.cpp:
Location:
trunk/Source/WebKit/chromium
Files:
18 edited

Legend:

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

    r142418 r142422  
     12013-02-10  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Enable more of webkit_unit_tests in component builds
     4        https://bugs.webkit.org/show_bug.cgi?id=109369
     5
     6        Reviewed by Darin Fisher.
     7
     8        Updates all webkit_unit_tests (except for LevelDBTest) to go through the Platform API instead of directly
     9        calling into webkit_support so they work in component builds.
     10
     11        * WebKit.gyp:
     12        * tests/AssociatedURLLoaderTest.cpp:
     13        * tests/EventListenerTest.cpp:
     14        * tests/FrameTestHelpers.cpp:
     15        (WebKit::FrameTestHelpers::createWebViewAndLoad):
     16        (QuitTask):
     17        (WebKit::FrameTestHelpers::QuitTask::run):
     18        (FrameTestHelpers):
     19        (WebKit::FrameTestHelpers::runPendingTasks):
     20        * tests/FrameTestHelpers.h:
     21        (FrameTestHelpers):
     22        * tests/ListenerLeakTest.cpp:
     23        * tests/PopupMenuTest.cpp:
     24        * tests/PrerenderingTest.cpp:
     25        * tests/ScrollingCoordinatorChromiumTest.cpp:
     26        (WebKit::ScrollingCoordinatorChromiumTest::~ScrollingCoordinatorChromiumTest):
     27        (WebKit::ScrollingCoordinatorChromiumTest::navigateTo):
     28        * tests/URLTestHelpers.cpp:
     29        (WebKit::URLTestHelpers::registerMockedURLLoad):
     30        * tests/WebFrameTest.cpp:
     31        * tests/WebImageTest.cpp:
     32        (WebKit::readFile):
     33        * tests/WebPageNewSerializerTest.cpp:
     34        * tests/WebPageSerializerTest.cpp:
     35        * tests/WebPluginContainerTest.cpp:
     36        (WebKit::WebPluginContainerTest::TearDown):
     37        (WebKit::TEST_F):
     38        * tests/WebViewTest.cpp:
     39
    1402013-02-10  Sheriff Bot  <webkit.review.bot@gmail.com>
    241
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r141943 r142422  
    654654                                # These tests depend on webkit_support and
    655655                                # functions defined only in !WEBKIT_IMPLEMENTATION.
    656                                 'tests/AssociatedURLLoaderTest.cpp',
    657                                 'tests/EventListenerTest.cpp',
    658                                 'tests/FakeWebPlugin.cpp',
    659                                 'tests/FrameTestHelpers.cpp',
    660                                 'tests/IDBBindingUtilitiesTest.cpp',
    661                                 'tests/IDBRequestTest.cpp',
    662656                                'tests/LevelDBTest.cpp',
    663                                 'tests/ListenerLeakTest.cpp',
    664                                 'tests/LinkHighlightTest.cpp',
    665                                 'tests/PopupMenuTest.cpp',
    666                                 'tests/PrerenderingTest.cpp',
    667                                 'tests/RenderTableCellTest.cpp',
    668                                 'tests/RenderTableRowTest.cpp',
    669                                 'tests/ScrollingCoordinatorChromiumTest.cpp',
    670                                 'tests/URLTestHelpers.cpp',
    671                                 'tests/WebFrameTest.cpp',
    672                                 'tests/WebImageTest.cpp',
    673                                 'tests/WebPageNewSerializerTest.cpp',
    674                                 'tests/WebPageSerializerTest.cpp',
    675                                 'tests/WebPluginContainerTest.cpp',
    676                                 'tests/WebViewTest.cpp',
    677657                            ],
    678658                            'conditions': [
  • trunk/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp

    r138798 r142422  
    3636#include "WebURLLoaderOptions.h"
    3737#include "WebView.h"
     38#include <public/Platform.h>
    3839#include <public/WebString.h>
     40#include <public/WebThread.h>
    3941#include <public/WebURL.h>
    4042#include <public/WebURLLoader.h>
     
    4244#include <public/WebURLRequest.h>
    4345#include <public/WebURLResponse.h>
     46#include <public/WebUnitTestSupport.h>
    4447#include <wtf/text/WTFString.h>
    4548
    4649#include <gtest/gtest.h>
    47 #include <webkit/support/webkit_support.h>
    4850
    4951using namespace WebKit;
     
    7880    {
    7981        // Reuse one of the test files from WebFrameTest.
    80         std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data());
     82        std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data());
    8183        filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html";
    8284        m_frameFilePath = WebString::fromUTF8(filePath.c_str());
     
    9395        response.initialize();
    9496        response.setMIMEType("text/html");
    95         webkit_support::RegisterMockedURL(url, response, m_frameFilePath);
     97        Platform::current()->unitTestSupport()->registerMockedURL(url, response, m_frameFilePath);
    9698
    9799        WebURLRequest request;
     
    101103        serveRequests();
    102104
    103         webkit_support::UnregisterMockedURL(url);
     105        Platform::current()->unitTestSupport()->unregisterMockedURL(url);
    104106    }
    105107
    106108    void TearDown()
    107109    {
    108         webkit_support::UnregisterAllMockedURLs();
     110        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    109111        m_webView->close();
    110112    }
     
    112114    void serveRequests()
    113115    {
    114         webkit_support::ServeAsynchronousMockedRequests();
     116        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    115117    }
    116118
     
    178180        if (m_runningMessageLoop) {
    179181            m_runningMessageLoop = false;
    180             webkit_support::QuitMessageLoop();
     182            Platform::current()->currentThread()->exitRunLoop();
    181183        }
    182184    }
     
    219221        // Allow the loader to return the error.
    220222        m_runningMessageLoop = true;
    221         webkit_support::RunMessageLoop();
     223        Platform::current()->currentThread()->enterRunLoop();
    222224        EXPECT_TRUE(m_didFail);
    223225        EXPECT_FALSE(m_didReceiveResponse);
     
    245247            m_expectedResponse.addHTTPHeaderField("access-control-expose-headers", headerNameString);
    246248        m_expectedResponse.addHTTPHeaderField(headerNameString, "foo");
    247         webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
     249        Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
    248250
    249251        WebURLLoaderOptions options;
     
    292294    m_expectedResponse.initialize();
    293295    m_expectedResponse.setMIMEType("text/html");
    294     webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
     296    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
    295297
    296298    m_expectedLoader = createAssociatedURLLoader();
     
    326328    m_expectedResponse.initialize();
    327329    m_expectedResponse.setMIMEType("text/html");
    328     webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
     330    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
    329331
    330332    WebURLLoaderOptions options;
     
    352354    m_expectedResponse.setMIMEType("text/html");
    353355    m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*");
    354     webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
     356    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
    355357
    356358    WebURLLoaderOptions options;
     
    378380    m_expectedResponse.setMIMEType("text/html");
    379381    m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*");
    380     webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
     382    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
    381383
    382384    WebURLLoaderOptions options;
     
    413415    m_expectedRedirectResponse.setHTTPStatusCode(301);
    414416    m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
    415     webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
     417    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
    416418
    417419    m_expectedNewRequest = WebURLRequest();
     
    422424    m_expectedResponse.initialize();
    423425    m_expectedResponse.setMIMEType("text/html");
    424     webkit_support::RegisterMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
     426    Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
    425427
    426428    m_expectedLoader = createAssociatedURLLoader();
     
    451453    m_expectedRedirectResponse.setHTTPStatusCode(301);
    452454    m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
    453     webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
     455    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
    454456
    455457    WebURLLoaderOptions options;
     
    484486    m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
    485487    m_expectedRedirectResponse.addHTTPHeaderField("access-control-allow-origin", "*");
    486     webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
     488    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
    487489
    488490    m_expectedNewRequest = WebURLRequest();
     
    494496    m_expectedResponse.setMIMEType("text/html");
    495497    m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*");
    496     webkit_support::RegisterMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
     498    Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
    497499
    498500    WebURLLoaderOptions options;
     
    601603    m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*");
    602604    m_expectedResponse.addHTTPHeaderField(headerNameString, "foo");
    603     webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
     605    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
    604606
    605607    WebURLLoaderOptions options;
  • trunk/Source/WebKit/chromium/tests/EventListenerTest.cpp

    r122344 r142422  
    4242#include "WebView.h"
    4343#include <gtest/gtest.h>
    44 #include <webkit/support/webkit_support.h>
     44#include <public/Platform.h>
     45#include <public/WebUnitTestSupport.h>
    4546
    4647using namespace WebKit;
     
    8788    {
    8889        m_webView->close();
    89         webkit_support::UnregisterAllMockedURLs();
     90        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    9091    }
    9192
  • trunk/Source/WebKit/chromium/tests/FrameTestHelpers.cpp

    r138798 r142422  
    3939#include "WebView.h"
    4040#include "WebViewClient.h"
     41#include <public/Platform.h>
    4142#include <public/WebString.h>
     43#include <public/WebThread.h>
    4244#include <public/WebURLRequest.h>
    4345#include <public/WebURLResponse.h>
    44 #include <webkit/support/webkit_support.h>
     46#include <public/WebUnitTestSupport.h>
    4547
    4648namespace WebKit {
     
    9294
    9395    loadFrame(webView->mainFrame(), url);
    94     webkit_support::ServeAsynchronousMockedRequests();
     96    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    9597
    9698    return webView;
    9799}
    98100
     101class QuitTask : public WebThread::Task {
     102public:
     103    virtual void run()
     104    {
     105        Platform::current()->currentThread()->exitRunLoop();
     106    }
     107};
     108
     109void runPendingTasks()
     110{
     111    Platform::current()->currentThread()->postTask(new QuitTask);
     112    Platform::current()->currentThread()->enterRunLoop();
     113}
     114
    99115} // namespace FrameTestHelpers
    100116} // namespace WebKit
  • trunk/Source/WebKit/chromium/tests/FrameTestHelpers.h

    r137045 r142422  
    3333
    3434#include <string>
     35#include <wtf/PassOwnPtr.h>
    3536
    3637namespace WebKit {
     
    4849WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0);
    4950
     51void runPendingTasks();
     52
    5053} // namespace FrameTestHelpers
    5154} // namespace WebKit
  • trunk/Source/WebKit/chromium/tests/ListenerLeakTest.cpp

    r122344 r142422  
    3535#include "WebView.h"
    3636#include <gtest/gtest.h>
     37#include <public/Platform.h>
     38#include <public/WebUnitTestSupport.h>
    3739#include <v8/include/v8-profiler.h>
    3840#include <v8/include/v8.h>
    39 #include <webkit/support/webkit_support.h>
    4041
    4142using namespace WebKit;
     
    100101        if (m_webView)
    101102            m_webView->close();
    102         webkit_support::UnregisterAllMockedURLs();
     103        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    103104    }
    104105
  • trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp

    r138798 r142422  
    3131#include "config.h"
    3232
    33 #include <gtest/gtest.h>
    34 #include <webkit/support/webkit_support.h>
    35 
    3633#include "Color.h"
    3734#include "Element.h"
     
    4138#include "PopupContainer.h"
    4239#include "PopupMenu.h"
     40#include "PopupMenuChromium.h"
    4341#include "PopupMenuClient.h"
    44 #include "PopupMenuChromium.h"
    4542#include "RuntimeEnabledFeatures.h"
    4643#include "URLTestHelpers.h"
     
    5855#include "WebViewImpl.h"
    5956#include "v8.h"
     57#include <gtest/gtest.h>
     58#include <public/Platform.h>
    6059#include <public/WebString.h>
    6160#include <public/WebURL.h>
    6261#include <public/WebURLRequest.h>
    6362#include <public/WebURLResponse.h>
     63#include <public/WebUnitTestSupport.h>
    6464
    6565using namespace WebCore;
     
    194194        m_popupMenu = 0;
    195195        m_webView->close();
    196         webkit_support::UnregisterAllMockedURLs();
     196        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    197197    }
    198198
     
    257257    void serveRequests()
    258258    {
    259         webkit_support::ServeAsynchronousMockedRequests();
     259        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    260260    }
    261261
  • trunk/Source/WebKit/chromium/tests/PrerenderingTest.cpp

    r138173 r142422  
    4646#include <gtest/gtest.h>
    4747#include <list>
     48#include <public/Platform.h>
    4849#include <public/WebPrerender.h>
    4950#include <public/WebPrerenderingSupport.h>
    5051#include <public/WebString.h>
    51 #include <webkit/support/webkit_support.h>
     52#include <public/WebUnitTestSupport.h>
    5253#include <wtf/OwnPtr.h>
    5354
     
    182183    ~PrerenderingTest()
    183184    {
    184         webkit_support::UnregisterAllMockedURLs();
     185        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    185186        if (m_webView)
    186187            close();
     
    196197
    197198        FrameTestHelpers::loadFrame(m_webView->mainFrame(), std::string(baseURL) + fileName);
    198         webkit_support::ServeAsynchronousMockedRequests();
     199        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    199200    }
    200201
     
    202203    {
    203204        FrameTestHelpers::loadFrame(m_webView->mainFrame(), "about:blank");
    204         //        webkit_support::RunAllPendingMessages();
    205205    }
    206206
  • trunk/Source/WebKit/chromium/tests/ScrollingCoordinatorChromiumTest.cpp

    r141769 r142422  
    2929#include "CompositorFakeWebGraphicsContext3D.h"
    3030#include "FrameTestHelpers.h"
     31#include "GraphicsLayerChromium.h"
    3132#include "RenderLayerBacking.h"
    3233#include "RenderLayerCompositor.h"
     
    4041#include "WebViewImpl.h"
    4142#include <gtest/gtest.h>
     43#include <public/Platform.h>
    4244#include <public/WebCompositorSupport.h>
    4345#include <public/WebLayer.h>
    44 #include <webkit/support/webkit_support.h>
    45 
    46 #include "GraphicsLayerChromium.h"
     46#include <public/WebUnitTestSupport.h>
    4747
    4848using namespace WebCore;
     
    9898    virtual ~ScrollingCoordinatorChromiumTest()
    9999    {
    100         webkit_support::UnregisterAllMockedURLs();
     100        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    101101        m_webViewImpl->close();
    102102
     
    107107    {
    108108        FrameTestHelpers::loadFrame(m_webViewImpl->mainFrame(), url);
    109         webkit_support::ServeAsynchronousMockedRequests();
     109        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    110110    }
    111111
  • trunk/Source/WebKit/chromium/tests/URLTestHelpers.cpp

    r138798 r142422  
    3232#include "URLTestHelpers.h"
    3333
     34#include <public/Platform.h>
    3435#include <public/WebString.h>
    3536#include <public/WebURL.h>
    3637#include <public/WebURLResponse.h>
    37 #include <webkit/support/webkit_support.h>
     38#include <public/WebUnitTestSupport.h>
    3839
    3940namespace WebKit {
     
    6061
    6162    // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName.
    62     std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data());
     63    std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data());
    6364    filePath.append("/Source/WebKit/chromium/tests/data/");
    6465    filePath.append(std::string(relativeBaseDirectory.utf8().data()));
    6566    filePath.append(std::string(fileName.utf8().data()));
    6667
    67     webkit_support::RegisterMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str()));
     68    Platform::current()->unitTestSupport()->registerMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str()));
    6869}
    6970
  • trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp

    r142250 r142422  
    6262#include "v8.h"
    6363#include <gtest/gtest.h>
     64#include <public/Platform.h>
    6465#include <public/WebFloatRect.h>
     66#include <public/WebThread.h>
    6567#include <public/WebURLResponse.h>
    66 #include <webkit/support/webkit_support.h>
     68#include <public/WebUnitTestSupport.h>
    6769#include <wtf/Forward.h>
    6870
     
    7173using WebCore::Range;
    7274using WebKit::URLTestHelpers::toKURL;
     75using WebKit::FrameTestHelpers::runPendingTasks;
    7376
    7477namespace {
     
    8386public:
    8487    WebFrameTest()
    85         : m_baseURL("http://www.test.com/"),
    86           m_chromeURL("chrome://")
    87     {
     88        : m_baseURL("http://www.test.com/")
     89        , m_chromeURL("chrome://")
     90        , m_webView(0)
     91    {
     92    }
     93
     94    virtual ~WebFrameTest()
     95    {
     96        if (m_webView)
     97            m_webView->close();
    8898    }
    8999
    90100    virtual void TearDown()
    91101    {
    92         webkit_support::UnregisterAllMockedURLs();
     102        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    93103    }
    94104
     
    106116    std::string m_baseURL;
    107117    std::string m_chromeURL;
     118
     119    WebView* m_webView;
    108120};
    109121
     
    115127    registerMockedHttpURLLoad("zero_sized_iframe.html");
    116128
    117     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html");
     129    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html");
    118130
    119131    // Now retrieve the frames text and test it only includes visible elements.
    120     std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
     132    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
    121133    EXPECT_NE(std::string::npos, content.find(" visible paragraph"));
    122134    EXPECT_NE(std::string::npos, content.find(" visible iframe"));
     
    124136    EXPECT_EQ(std::string::npos, content.find(" invisible iframe"));
    125137    EXPECT_EQ(std::string::npos, content.find("iframe with zero size"));
    126 
    127     webView->close();
    128138}
    129139
     
    135145    registerMockedHttpURLLoad("zero_sized_iframe.html");
    136146
    137     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true);
     147    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true);
    138148
    139149    v8::HandleScope scope;
    140     EXPECT_EQ(webView->mainFrame(),
     150    EXPECT_EQ(m_webView->mainFrame(),
    141151              WebFrame::frameForContext(
    142                   webView->mainFrame()->mainWorldScriptContext()));
    143     EXPECT_EQ(webView->mainFrame()->firstChild(),
     152                  m_webView->mainFrame()->mainWorldScriptContext()));
     153    EXPECT_EQ(m_webView->mainFrame()->firstChild(),
    144154              WebFrame::frameForContext(
    145                   webView->mainFrame()->firstChild()->mainWorldScriptContext()));
    146 
    147     webView->close();
     155                  m_webView->mainFrame()->firstChild()->mainWorldScriptContext()));
    148156}
    149157
     
    152160    registerMockedHttpURLLoad("form.html");
    153161
    154     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html");
     162    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html");
    155163
    156164    WebVector<WebFormElement> forms;
    157     webView->mainFrame()->document().forms(forms);
    158     webView->close();
     165    m_webView->mainFrame()->document().forms(forms);
     166    m_webView->close();
     167    m_webView = 0;
    159168
    160169    EXPECT_EQ(forms.size(), 1U);
     
    169178 
    170179    // Pass true to enable JavaScript.
    171     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
     180    m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
    172181
    173182    // Try to run JS against the chrome-style URL.
    174     FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
     183    FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
    175184
    176185    // Required to see any updates in contentAsText.
    177     webView->layout();
     186    m_webView->layout();
    178187
    179188    // Now retrieve the frame's text and ensure it was modified by running javascript.
    180     std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
     189    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
    181190    EXPECT_NE(std::string::npos, content.find("Clobbered"));
    182191}
     
    187196
    188197    /// Pass true to enable JavaScript.
    189     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
     198    m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
    190199
    191200    // Try to run JS against the chrome-style URL after prohibiting it.
    192201    WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome");
    193     FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
     202    FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
    194203
    195204    // Required to see any updates in contentAsText.
    196     webView->layout();
     205    m_webView->layout();
    197206
    198207    // Now retrieve the frame's text and ensure it wasn't modified by running javascript.
    199     std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
     208    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
    200209    EXPECT_EQ(std::string::npos, content.find("Clobbered"));
    201210}
     
    206215
    207216    // Pass true to enable JavaScript.
    208     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true);
     217    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true);
    209218   
    210219    // Send a message with the correct origin.
    211220    WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)));
    212     WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent");
     221    WebDOMEvent event = m_webView->mainFrame()->document().createEvent("MessageEvent");
    213222    WebDOMMessageEvent message = event.to<WebDOMMessageEvent>();
    214223    WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo"));
    215224    message.initMessageEvent("message", false, false, data, "http://origin.com", 0, "");
    216     webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message);
     225    m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message);
    217226
    218227    // Send another message with incorrect origin.
    219228    WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL)));
    220     webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message);
     229    m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message);
    221230
    222231    // Required to see any updates in contentAsText.
    223     webView->layout();
     232    m_webView->layout();
    224233
    225234    // Verify that only the first addition is in the body of the page.
    226     std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
     235    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
    227236    EXPECT_NE(std::string::npos, content.find("Message 1."));
    228237    EXPECT_EQ(std::string::npos, content.find("Message 2."));
     
    248257    // Make sure we initialize to minimum scale, even if the window size
    249258    // only becomes available after the load begins.
    250     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
    251     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    252     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    253     webViewImpl->enableFixedLayoutMode(true);
    254     webViewImpl->settings()->setViewportEnabled(true);
    255     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    256     webViewImpl->layout();
    257 
     259    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
     260    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     261    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     262    m_webView->enableFixedLayoutMode(true);
     263    m_webView->settings()->setViewportEnabled(true);
     264    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     265    m_webView->layout();
     266
     267    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    258268    webViewImpl->mainFrameImpl()->frameView()->setFixedLayoutSize(WebCore::IntSize(100, 100));
    259269    EXPECT_TRUE(webViewImpl->mainFrameImpl()->frameView()->needsLayout());
     
    276286    client.m_screenInfo.deviceScaleFactor = 2;
    277287
    278     WebView* webView = static_cast<WebView*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client));
    279 
    280     webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
    281     webView->settings()->setApplyPageScaleFactorInCompositor(true);
    282     webView->settings()->setViewportEnabled(true);
    283     webView->enableFixedLayoutMode(true);
    284     webView->resize(WebSize(viewportWidth, viewportHeight));
    285     webView->layout();
    286 
    287     EXPECT_EQ(2, webView->deviceScaleFactor());
     288    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client);
     289
     290    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     291    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     292    m_webView->settings()->setViewportEnabled(true);
     293    m_webView->enableFixedLayoutMode(true);
     294    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     295    m_webView->layout();
     296
     297    EXPECT_EQ(2, m_webView->deviceScaleFactor());
    288298
    289299    // Device scale factor should be independent of page scale.
    290     webView->setPageScaleFactorLimits(1, 2);
    291     webView->setPageScaleFactorPreservingScrollOffset(0.5);
    292     webView->layout();
    293     EXPECT_EQ(1, webView->pageScaleFactor());
     300    m_webView->setPageScaleFactorLimits(1, 2);
     301    m_webView->setPageScaleFactorPreservingScrollOffset(0.5);
     302    m_webView->layout();
     303    EXPECT_EQ(1, m_webView->pageScaleFactor());
    294304
    295305    // Force the layout to happen before leaving the test.
    296     webView->mainFrame()->contentAsText(1024).utf8();
     306    m_webView->mainFrame()->contentAsText(1024).utf8();
    297307}
    298308
     
    308318    // Make sure we initialize to minimum scale, even if the window size
    309319    // only becomes available after the load begins.
    310     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
    311     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    312     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    313     webViewImpl->enableFixedLayoutMode(true);
    314     webViewImpl->settings()->setViewportEnabled(true);
    315     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
     320    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
     321    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     322    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     323    m_webView->enableFixedLayoutMode(true);
     324    m_webView->settings()->setViewportEnabled(true);
     325    m_webView->resize(WebSize(viewportWidth, viewportHeight));
    316326
    317327    int defaultFixedLayoutWidth = 980;
    318328    float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWidth;
    319     EXPECT_EQ(minimumPageScaleFactor, webViewImpl->pageScaleFactor());
     329    EXPECT_EQ(minimumPageScaleFactor, m_webView->pageScaleFactor());
    320330
    321331    // Assume the user has pinch zoomed to page scale factor 2.
    322332    float userPinchPageScaleFactor = 2;
    323     webViewImpl->setPageScaleFactorPreservingScrollOffset(userPinchPageScaleFactor);
    324     webViewImpl->mainFrameImpl()->frameView()->layout();
     333    m_webView->setPageScaleFactorPreservingScrollOffset(userPinchPageScaleFactor);
     334    m_webView->layout();
    325335
    326336    // Make sure we don't reset to initial scale if the page continues to load.
    327337    bool isNewNavigation;
    328     webViewImpl->didCommitLoad(&isNewNavigation, false);
    329     webViewImpl->didChangeContentsSize();
    330     EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor());
     338    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     339    webViewImpl ->didCommitLoad(&isNewNavigation, false);
     340    webViewImpl ->didChangeContentsSize();
     341    EXPECT_EQ(userPinchPageScaleFactor, m_webView->pageScaleFactor());
    331342
    332343    // Make sure we don't reset to initial scale if the viewport size changes.
    333     webViewImpl->resize(WebSize(viewportWidth, viewportHeight + 100));
    334     EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor());
     344    m_webView->resize(WebSize(viewportWidth, viewportHeight + 100));
     345    EXPECT_EQ(userPinchPageScaleFactor, m_webView->pageScaleFactor());
    335346}
    336347
     
    344355    int viewportHeight = 1057;
    345356
    346     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscillate.html", true, 0, &client));
    347     webViewImpl->enableFixedLayoutMode(true);
    348     webViewImpl->settings()->setViewportEnabled(true);
    349     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    350     webViewImpl->layout();
     357    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscillate.html", true, 0, &client);
     358    m_webView->enableFixedLayoutMode(true);
     359    m_webView->settings()->setViewportEnabled(true);
     360    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     361    m_webView->layout();
    351362}
    352363
     
    360371    int viewportHeight = 480;
    361372
    362     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
    363     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    364     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    365     webViewImpl->enableFixedLayoutMode(true);
    366     webViewImpl->settings()->setViewportEnabled(true);
    367     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    368     webViewImpl->layout();
    369 
     373    m_webView = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
     374    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     375    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     376    m_webView->enableFixedLayoutMode(true);
     377    m_webView->settings()->setViewportEnabled(true);
     378    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     379    m_webView->layout();
     380
     381    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    370382    int prevLayoutCount = webViewImpl->mainFrameImpl()->frameView()->layoutCount();
    371383    webViewImpl->setPageScaleFactor(3, WebPoint());
     
    383395    int viewportHeight = 480;
    384396
    385     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
    386     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    387     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    388     webViewImpl->enableFixedLayoutMode(true);
    389     webViewImpl->settings()->setViewportEnabled(true);
    390     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    391     webViewImpl->layout();
    392 
    393     webViewImpl->setPageScaleFactor(3, WebPoint());
     397    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
     398    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     399    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     400    m_webView->enableFixedLayoutMode(true);
     401    m_webView->settings()->setViewportEnabled(true);
     402    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     403    m_webView->layout();
     404
     405    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     406    m_webView->setPageScaleFactor(3, WebPoint());
    394407    webViewImpl->page()->mainFrame()->loader()->history()->saveDocumentAndScrollState();
    395     webViewImpl->setPageScaleFactor(1, WebPoint());
     408    m_webView->setPageScaleFactor(1, WebPoint());
    396409    webViewImpl->page()->mainFrame()->loader()->history()->restoreScrollPositionAndViewState();
    397     EXPECT_EQ(3, webViewImpl->pageScaleFactor());
     410    EXPECT_EQ(3, m_webView->pageScaleFactor());
    398411}
    399412
     
    407420    int viewportHeight = 480;
    408421
    409     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
    410     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    411     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    412     webViewImpl->enableFixedLayoutMode(true);
    413     webViewImpl->settings()->setViewportEnabled(true);
    414     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    415     webViewImpl->layout();
    416 
    417     WebCore::FrameView* view = webViewImpl->mainFrameImpl()->frameView();
     422    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
     423    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     424    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     425    m_webView->enableFixedLayoutMode(true);
     426    m_webView->settings()->setViewportEnabled(true);
     427    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     428    m_webView->layout();
     429
     430    WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameImpl()->frameView();
    418431    int viewportWidthMinusScrollbar = 640 - (view->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15);
    419432    int viewportHeightMinusScrollbar = 480 - (view->horizontalScrollbar()->isOverlayScrollbar() ? 0 : 15);
    420433
    421     webViewImpl->setPageScaleFactor(2, WebPoint());
     434    m_webView->setPageScaleFactor(2, WebPoint());
    422435
    423436    WebCore::IntSize unscaledSize = view->unscaledVisibleContentSize(true);
     
    443456    int viewportHeight = 480;
    444457
    445     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
    446     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    447     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    448     webViewImpl->enableFixedLayoutMode(true);
    449     webViewImpl->settings()->setViewportEnabled(true);
    450     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    451     webViewImpl->layout();
    452 
    453     webViewImpl->setPageScaleFactor(2, WebPoint());
    454 
     458    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
     459    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     460    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     461    m_webView->enableFixedLayoutMode(true);
     462    m_webView->settings()->setViewportEnabled(true);
     463    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     464    m_webView->layout();
     465
     466    m_webView->setPageScaleFactor(2, WebPoint());
     467
     468    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    455469    EXPECT_EQ(1, webViewImpl->page()->mainFrame()->frameScaleFactor());
    456470    EXPECT_EQ(980, webViewImpl->page()->mainFrame()->contentRenderer()->unscaledDocumentRect().width());
     
    468482    int viewportHeight = 50;
    469483
    470     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
    471     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    472     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    473     webViewImpl->enableFixedLayoutMode(true);
    474     webViewImpl->settings()->setViewportEnabled(true);
    475     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    476     webViewImpl->layout();
     484    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
     485    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     486    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     487    m_webView->enableFixedLayoutMode(true);
     488    m_webView->settings()->setViewportEnabled(true);
     489    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     490    m_webView->layout();
    477491
    478492    // Set <1 page scale so that the clip rect should be larger than
    479493    // the viewport size as passed into resize().
    480     webViewImpl->setPageScaleFactor(0.5, WebPoint());
     494    m_webView->setPageScaleFactor(0.5, WebPoint());
    481495
    482496    SkBitmap bitmap;
     
    492506    EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect());
    493507
    494     WebCore::FrameView* view = webViewImpl->mainFrameImpl()->frameView();
     508    WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameImpl()->frameView();
    495509    WebCore::IntRect paintRect(0, 0, 200, 200);
    496510    view->paint(&context, paintRect);
     
    511525    int viewportHeight = 480;
    512526
    513     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client));
    514     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    515     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    516     webViewImpl->enableFixedLayoutMode(true);
    517     webViewImpl->settings()->setViewportEnabled(true);
    518     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    519 
    520     EXPECT_EQ(1.0f, webViewImpl->maximumPageScaleFactor());
    521 
    522     webViewImpl->setIgnoreViewportTagMaximumScale(true);
    523     webViewImpl->layout();
    524 
    525     EXPECT_EQ(4.0f, webViewImpl->maximumPageScaleFactor());
     527    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client);
     528    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     529    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     530    m_webView->enableFixedLayoutMode(true);
     531    m_webView->settings()->setViewportEnabled(true);
     532    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     533
     534    EXPECT_EQ(1.0f, m_webView->maximumPageScaleFactor());
     535
     536    m_webView->setIgnoreViewportTagMaximumScale(true);
     537    m_webView->layout();
     538
     539    EXPECT_EQ(4.0f, m_webView->maximumPageScaleFactor());
    526540}
    527541
     
    540554    int viewportWidth = 640 / deviceScaleFactor;
    541555    int viewportHeight = 1280 / deviceScaleFactor;
    542     WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html"); //
    543     webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
    544     webView->settings()->setApplyPageScaleFactorInCompositor(true);
    545     webView->setDeviceScaleFactor(deviceScaleFactor);
    546     webView->setPageScaleFactorLimits(0.01f, 4);
    547     webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
    548     webView->resize(WebSize(viewportWidth, viewportHeight));
    549     webView->enableFixedLayoutMode(true);
    550     webView->layout();
     556    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html"); //
     557    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     558    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     559    m_webView->setDeviceScaleFactor(deviceScaleFactor);
     560    m_webView->setPageScaleFactorLimits(0.01f, 4);
     561    m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
     562    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     563    m_webView->enableFixedLayoutMode(true);
     564    m_webView->layout();
    551565
    552566    WebRect wideDiv(200, 100, 400, 150);
     
    558572    bool isAnchor;
    559573
    560     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
     574    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    561575    // Test double-tap zooming into wide div.
    562576    webViewImpl->computeScaleAndScrollForHitRect(doubleTapPointWide, WebViewImpl::DoubleTap, scale, scroll, isAnchor);
     
    606620    int viewportHeight = 1280 / deviceScaleFactor;
    607621    float doubleTapZoomAlreadyLegibleRatio = 1.2f;
    608     WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html");
    609     webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
    610     webView->settings()->setApplyPageScaleFactorInCompositor(true);
    611     webView->enableFixedLayoutMode(true);
    612     webView->resize(WebSize(viewportWidth, viewportHeight));
    613     webView->setPageScaleFactorLimits(0.5f, 4);
    614     webView->setDeviceScaleFactor(deviceScaleFactor);
    615     webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
    616     webView->layout();
    617 
    618     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
     622    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html");
     623    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     624    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     625    m_webView->enableFixedLayoutMode(true);
     626    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     627    m_webView->setPageScaleFactorLimits(0.5f, 4);
     628    m_webView->setDeviceScaleFactor(deviceScaleFactor);
     629    m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
     630    m_webView->layout();
     631
     632    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    619633    webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
    620634
     
    648662    int viewportHeight = 480;
    649663    float doubleTapZoomAlreadyLegibleRatio = 1.2f;
    650     WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
    651     webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
    652     webView->settings()->setApplyPageScaleFactorInCompositor(true);
    653     webView->enableFixedLayoutMode(true);
    654     webView->resize(WebSize(viewportWidth, viewportHeight));
    655     webView->setDeviceScaleFactor(1.5f);
    656     webView->layout();
    657 
    658     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
     664    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
     665    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     666    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     667    m_webView->enableFixedLayoutMode(true);
     668    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     669    m_webView->setDeviceScaleFactor(1.5f);
     670    m_webView->layout();
     671
     672    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    659673    webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
    660674
     
    665679    // Test double tap scale bounds.
    666680    // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1
    667     webView->setPageScaleFactorLimits(0.5f, 4);
    668     webView->layout();
     681    m_webView->setPageScaleFactorLimits(0.5f, 4);
     682    m_webView->layout();
    669683    float doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
    670684    setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     
    679693    webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
    680694    // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale
    681     webView->setPageScaleFactorLimits(1.1f, 4);
    682     webView->layout();
     695    m_webView->setPageScaleFactorLimits(1.1f, 4);
     696    m_webView->layout();
    683697    doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
    684698    setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     
    693707    webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
    694708    // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale
    695     webView->setPageScaleFactorLimits(0.95f, 4);
    696     webView->layout();
     709    m_webView->setPageScaleFactorLimits(0.95f, 4);
     710    m_webView->layout();
    697711    doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
    698712    setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     
    714728    float doubleTapZoomAlreadyLegibleRatio = 1.2f;
    715729    float textAutosizingFontScaleFactor = 1.13f;
    716     WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
    717     webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
    718     webView->settings()->setApplyPageScaleFactorInCompositor(true);
    719     webView->enableFixedLayoutMode(true);
    720     webView->resize(WebSize(viewportWidth, viewportHeight));
    721     webView->layout();
    722 
    723     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
     730    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
     731    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     732    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     733    m_webView->enableFixedLayoutMode(true);
     734    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     735    m_webView->layout();
     736
     737    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    724738    webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
    725739    webViewImpl->page()->settings()->setTextAutosizingFontScaleFactor(textAutosizingFontScaleFactor);
     
    734748    setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
    735749    float doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
    736     webView->setPageScaleFactorLimits(0.5f, 4);
    737     webView->layout();
     750    m_webView->setPageScaleFactorLimits(0.5f, 4);
     751    m_webView->layout();
    738752    simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
    739753    EXPECT_FLOAT_EQ(legibleScale, scale);
     
    746760    webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
    747761    // 1 < textAutosizingFontScaleFactor < minimumPageScale < doubleTapZoomAlreadyLegibleScale
    748     webView->setPageScaleFactorLimits(1.0f, 4);
    749     webView->layout();
     762    m_webView->setPageScaleFactorLimits(1.0f, 4);
     763    m_webView->layout();
    750764    doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
    751765    setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     
    760774    webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
    761775    // minimumPageScale < 1 < textAutosizingFontScaleFactor < doubleTapZoomAlreadyLegibleScale
    762     webView->setPageScaleFactorLimits(0.95f, 4);
    763     webView->layout();
     776    m_webView->setPageScaleFactorLimits(0.95f, 4);
     777    m_webView->layout();
    764778    doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
    765779    setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     
    774788    webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
    775789    // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < textAutosizingFontScaleFactor
    776     webView->setPageScaleFactorLimits(0.9f, 4);
    777     webView->layout();
     790    m_webView->setPageScaleFactorLimits(0.9f, 4);
     791    m_webView->layout();
    778792    doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
    779793    setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     
    796810    int caretPadding = 10;
    797811    float minReadableCaretHeight = 18.0f;
    798     WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html");
    799     webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
    800     webView->settings()->setApplyPageScaleFactorInCompositor(true);
    801     webView->enableFixedLayoutMode(true);
    802     webView->resize(WebSize(viewportWidth, viewportHeight));
    803     webView->setPageScaleFactorLimits(1, 4);
    804     webView->layout();
    805     webView->setDeviceScaleFactor(1.5f);
    806     webView->settings()->setAutoZoomFocusedNodeToLegibleScale(true);
    807 
    808     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
     812    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html");
     813    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     814    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     815    m_webView->enableFixedLayoutMode(true);
     816    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     817    m_webView->setPageScaleFactorLimits(1, 4);
     818    m_webView->layout();
     819    m_webView->setDeviceScaleFactor(1.5f);
     820    m_webView->settings()->setAutoZoomFocusedNodeToLegibleScale(true);
     821
     822    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    809823    webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
    810824
     
    814828    // Test scrolling the focused node
    815829    // The edit box is shorter and narrower than the viewport when legible.
    816     webView->advanceFocus(false);
     830    m_webView->advanceFocus(false);
    817831    // Set the caret to the end of the input box.
    818     webView->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000);
    819     setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
     832    m_webView->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000);
     833    setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1);
    820834    WebRect rect, caret;
    821835    webViewImpl->selectionBounds(caret, rect);
     
    836850    viewportWidth = 200;
    837851    viewportHeight = 150;
    838     webView->resize(WebSize(viewportWidth, viewportHeight));
    839     setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
     852    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     853    setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1);
    840854    webViewImpl->selectionBounds(caret, rect);
    841855    webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation);
     
    846860    EXPECT_NEAR(minReadableCaretHeight / caret.height, scale, 0.1);
    847861
    848     setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
     862    setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1);
    849863    // Move focus to edit box with text.
    850     webView->advanceFocus(false);
     864    m_webView->advanceFocus(false);
    851865    webViewImpl->selectionBounds(caret, rect);
    852866    webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation);
     
    862876
    863877    // Move focus back to the first edit box.
    864     webView->advanceFocus(true);
     878    m_webView->advanceFocus(true);
    865879    webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation);
    866880    // The position should have stayed the same since this box was already on screen with the right scale.
     
    901915
    902916    TestReloadDoesntRedirectWebFrameClient webFrameClient;
    903     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient);
    904 
    905     webView->mainFrame()->reload(true);
     917    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient);
     918
     919    m_webView->mainFrame()->reload(true);
    906920    // start reload before request is delivered.
    907     webView->mainFrame()->reload(true);
    908     webkit_support::ServeAsynchronousMockedRequests();
     921    m_webView->mainFrame()->reload(true);
     922    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     923
     924    m_webView->close();
     925    m_webView = 0;
    909926}
    910927
     
    922939    registerMockedHttpURLLoad(thirdURL);
    923940
    924     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + firstURL, true));
     941    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + firstURL, true);
     942    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
    925943    webViewImpl->resize(WebSize(pageWidth, pageHeight));
    926944    webViewImpl->mainFrame()->setScrollOffset(WebSize(pageWidth / 4, pageHeight / 4));
     
    932950    // Reload the page using the cache.
    933951    webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false);
    934     webkit_support::ServeAsynchronousMockedRequests();
     952    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    935953    ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
    936954    ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor());
     
    938956    // Reload the page while ignoring the cache.
    939957    webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), true);
    940     webkit_support::ServeAsynchronousMockedRequests();
     958    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    941959    ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
    942960    ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor());
     
    948966    registerMockedHttpURLLoad("visible_iframe.html");
    949967
    950     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true);
    951     webkit_support::RunAllPendingMessages(); // Queue the iframe.
    952     webkit_support::ServeAsynchronousMockedRequests(); // Load the iframe.
    953 
    954     WebFrame* iframe = webView->findFrameByName(WebString::fromUTF8("ifr"));
     968    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true);
     969    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); // Load the iframe.
     970
     971    WebFrame* iframe = m_webView->findFrameByName(WebString::fromUTF8("ifr"));
    955972    ASSERT_TRUE(iframe);
    956973    WebDataSource* iframeDataSource = iframe->dataSource();
     
    961978    EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data()));
    962979    EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data()));
    963 
    964     webView->close();
    965980}
    966981
     
    970985    registerMockedHttpURLLoad("autofocus_input_field_iframe.html");
    971986
    972     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true));
     987    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true);
    973988
    974989    // Clear the focused node.
    975     webViewImpl->clearFocusedNode();
     990    m_webView->clearFocusedNode();
    976991
    977992    // Now retrieve the FocusedNode and test it should be null.
    978     EXPECT_EQ(0, webViewImpl->focusedWebCoreNode());
    979 
    980     webViewImpl->close();
     993    EXPECT_EQ(0, static_cast<WebViewImpl*>(m_webView)->focusedWebCoreNode());
    981994}
    982995
     
    10091022    };
    10101023
    1011     ~ContextLifetimeTestWebFrameClient()
     1024    virtual ~ContextLifetimeTestWebFrameClient()
    10121025    {
    10131026        reset();
     
    10501063    // Load a frame with an iframe, make sure we get the right create notifications.
    10511064    ContextLifetimeTestWebFrameClient webFrameClient;
    1052     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
    1053 
    1054     WebFrame* mainFrame = webView->mainFrame();
     1065    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
     1066
     1067    WebFrame* mainFrame = m_webView->mainFrame();
    10551068    WebFrame* childFrame = mainFrame->firstChild();
    10561069
     
    10701083
    10711084    // Close the view. We should get two release notifications that are exactly the same as the create ones, in reverse order.
    1072     webView->close();
     1085    m_webView->close();
     1086    m_webView = 0;
    10731087
    10741088    ASSERT_EQ(2u, webFrameClient.releaseNotifications.size());
     
    10881102
    10891103    ContextLifetimeTestWebFrameClient webFrameClient;
    1090     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
     1104    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
    10911105
    10921106    // Refresh, we should get two release notifications and two more create notifications.
    1093     webView->mainFrame()->reload(false);
    1094     webkit_support::ServeAsynchronousMockedRequests();
     1107    m_webView->mainFrame()->reload(false);
     1108    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    10951109    ASSERT_EQ(4u, webFrameClient.createNotifications.size());
    10961110    ASSERT_EQ(2u, webFrameClient.releaseNotifications.size());
     
    11031117
    11041118    // The last two create notifications should be for the current frames and context.
    1105     WebFrame* mainFrame = webView->mainFrame();
     1119    WebFrame* mainFrame = m_webView->mainFrame();
    11061120    WebFrame* childFrame = mainFrame->firstChild();
    11071121    ContextLifetimeTestWebFrameClient::Notification* firstRefreshNotification = webFrameClient.createNotifications[2];
     
    11161130    EXPECT_EQ(0, secondRefreshNotification->worldId);
    11171131
    1118     webView->close();
     1132    m_webView->close();
     1133    m_webView = 0;
    11191134}
    11201135
     
    11271142
    11281143    ContextLifetimeTestWebFrameClient webFrameClient;
    1129     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
     1144    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
    11301145
    11311146    // Add an isolated world.
     
    11361151    int numSources = 1;
    11371152    int extensionGroup = 0;
    1138     webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scriptSource, numSources, extensionGroup);
     1153    m_webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scriptSource, numSources, extensionGroup);
    11391154
    11401155    // We should now have a new create notification.
     
    11421157    ContextLifetimeTestWebFrameClient::Notification* notification = webFrameClient.createNotifications[0];
    11431158    ASSERT_EQ(isolatedWorldId, notification->worldId);
    1144     ASSERT_EQ(webView->mainFrame(), notification->frame);
     1159    ASSERT_EQ(m_webView->mainFrame(), notification->frame);
    11451160
    11461161    // We don't have an API to enumarate isolated worlds for a frame, but we can at least assert that the context we got is *not* the main world's context.
    1147     ASSERT_NE(webView->mainFrame()->mainWorldScriptContext(), notification->context);
    1148 
    1149     webView->close();
     1162    ASSERT_NE(m_webView->mainFrame()->mainWorldScriptContext(), notification->context);
     1163
     1164    m_webView->close();
     1165    m_webView = 0;
    11501166
    11511167    // We should have gotten three release notifications (one for each of the frames, plus one for the isolated context).
     
    11641180{
    11651181    registerMockedHttpURLLoad("find.html");
    1166     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html");
    1167     WebFrame* frame = webView->mainFrame();
     1182    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html");
     1183    WebFrame* frame = m_webView->mainFrame();
    11681184    const int findIdentifier = 12345;
    11691185    WebFindOptions options;
     
    12151231    range = frame->selectionRange();
    12161232    ASSERT_TRUE(range.isNull());
    1217 
    1218     webView->close();
    12191233}
    12201234
    12211235TEST_F(WebFrameTest, GetContentAsPlainText)
    12221236{
    1223     WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
     1237    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
    12241238    // We set the size because it impacts line wrapping, which changes the
    12251239    // resulting text value.
    1226     webView->resize(WebSize(640, 480));
    1227     WebFrame* frame = webView->mainFrame();
     1240    m_webView->resize(WebSize(640, 480));
     1241    WebFrame* frame = m_webView->mainFrame();
    12281242
    12291243    // Generate a simple test case.
     
    12311245    WebCore::KURL testURL = toKURL("about:blank");
    12321246    frame->loadHTMLString(simpleSource, testURL);
    1233     webkit_support::RunAllPendingMessages();
     1247    runPendingTasks();
    12341248
    12351249    // Make sure it comes out OK.
     
    12461260    const char outerFrameSource[] = "Hello<iframe></iframe> world";
    12471261    frame->loadHTMLString(outerFrameSource, testURL);
    1248     webkit_support::RunAllPendingMessages();
     1262    runPendingTasks();
    12491263
    12501264    // Load something into the subframe.
     
    12521266    ASSERT_TRUE(subframe);
    12531267    subframe->loadHTMLString("sub<p>text", testURL);
    1254     webkit_support::RunAllPendingMessages();
     1268    runPendingTasks();
    12551269
    12561270    text = frame->contentAsText(std::numeric_limits<size_t>::max());
     
    12611275    text = frame->contentAsText(12);
    12621276    EXPECT_EQ("Hello world", std::string(text.utf8().data()));
    1263 
    1264     webView->close();
    12651277}
    12661278
    12671279TEST_F(WebFrameTest, GetFullHtmlOfPage)
    12681280{
    1269     WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
    1270     WebFrame* frame = webView->mainFrame();
     1281    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
     1282    WebFrame* frame = m_webView->mainFrame();
    12711283
    12721284    // Generate a simple test case.
     
    12741286    WebCore::KURL testURL = toKURL("about:blank");
    12751287    frame->loadHTMLString(simpleSource, testURL);
    1276     webkit_support::RunAllPendingMessages();
     1288    runPendingTasks();
    12771289
    12781290    WebString text = frame->contentAsText(std::numeric_limits<size_t>::max());
     
    12831295    // Load again with the output html.
    12841296    frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL);
    1285     webkit_support::RunAllPendingMessages();
     1297    runPendingTasks();
    12861298
    12871299    EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data()));
     
    13131325
    13141326    TestExecuteScriptDuringDidCreateScriptContext webFrameClient;
    1315     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "hello_world.html", true, &webFrameClient);
    1316 
    1317     webView->mainFrame()->reload();
    1318     webkit_support::ServeAsynchronousMockedRequests();
     1327    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "hello_world.html", true, &webFrameClient);
     1328
     1329    m_webView->mainFrame()->reload();
     1330    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     1331
     1332    m_webView->close();
     1333    m_webView = 0;
    13191334}
    13201335
     
    13441359
    13451360    TestDidCreateFrameWebFrameClient webFrameClient;
    1346     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", false, &webFrameClient);
     1361    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", false, &webFrameClient);
    13471362
    13481363    EXPECT_EQ(webFrameClient.m_frameCount, 3);
    1349     EXPECT_EQ(webFrameClient.m_parent, webView->mainFrame());
     1364    EXPECT_EQ(webFrameClient.m_parent, m_webView->mainFrame());
     1365
     1366    m_webView->close();
     1367    m_webView = 0;
    13501368}
    13511369
     
    13841402
    13851403    FindUpdateWebFrameClient client;
    1386     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
    1387     webView->resize(WebSize(640, 480));
    1388     webView->layout();
    1389     webkit_support::RunAllPendingMessages();
     1404    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
     1405    m_webView->resize(WebSize(640, 480));
     1406    m_webView->layout();
     1407    runPendingTasks();
    13901408
    13911409    // Note that the 'result 19' in the <select> element is not expected to produce a match.
     
    13961414    WebFindOptions options;
    13971415    WebString searchText = WebString::fromUTF8(kFindString);
    1398     WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
     1416    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
    13991417    EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0));
    14001418
     
    14041422        frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
    14051423
    1406     webkit_support::RunAllPendingMessages();
     1424    runPendingTasks();
    14071425    EXPECT_TRUE(client.findResultsAreReady());
    14081426
     
    14911509
    14921510    // Resizing should update the rects version.
    1493     webView->resize(WebSize(800, 600));
    1494     webkit_support::RunAllPendingMessages();
     1511    m_webView->resize(WebSize(800, 600));
     1512    runPendingTasks();
    14951513    EXPECT_TRUE(mainFrame->findMatchMarkersVersion() != rectsVersion);
    14961514
    1497     webView->close();
     1515    m_webView->close();
     1516    m_webView = 0;
    14981517}
    14991518
     
    15031522
    15041523    FindUpdateWebFrameClient client;
    1505     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client);
    1506     webView->resize(WebSize(640, 480));
    1507     webView->layout();
    1508     webkit_support::RunAllPendingMessages();
     1524    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client);
     1525    m_webView->resize(WebSize(640, 480));
     1526    m_webView->layout();
     1527    runPendingTasks();
    15091528
    15101529    static const char* kFindString = "hello";
     
    15141533    WebFindOptions options;
    15151534    WebString searchText = WebString::fromUTF8(kFindString);
    1516     WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
     1535    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
    15171536    EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0));
    15181537
     
    15221541        frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
    15231542
    1524     webkit_support::RunAllPendingMessages();
     1543    runPendingTasks();
    15251544    EXPECT_TRUE(client.findResultsAreReady());
    15261545    EXPECT_EQ(kNumResults, client.count());
    15271546
    1528     webView->close();
     1547    m_webView->close();
     1548    m_webView = 0;
    15291549}
    15301550
     
    15351555
    15361556    FindUpdateWebFrameClient client;
    1537     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
    1538     webView->resize(WebSize(640, 480));
    1539     webView->layout();
    1540     webkit_support::RunAllPendingMessages();
     1557    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
     1558    m_webView->resize(WebSize(640, 480));
     1559    m_webView->layout();
     1560    runPendingTasks();
    15411561
    15421562    static const char* kFindString = "result";
     
    15451565    WebFindOptions options;
    15461566    WebString searchText = WebString::fromUTF8(kFindString);
    1547     WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
     1567    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
    15481568    WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false));
    15491569    RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame();
     
    15551575    EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false, 0));
    15561576
    1557     webkit_support::RunAllPendingMessages();
     1577    runPendingTasks();
    15581578    EXPECT_FALSE(client.findResultsAreReady());
    15591579
     
    15631583        frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
    15641584
    1565     webkit_support::RunAllPendingMessages();
     1585    runPendingTasks();
    15661586    EXPECT_TRUE(client.findResultsAreReady());
    15671587
    15681588    holdSecondFrame.release();
    1569     webView->close();
     1589
     1590    m_webView->close();
     1591    m_webView = 0;
    15701592}
    15711593
     
    15761598
    15771599    FindUpdateWebFrameClient client;
    1578     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
    1579     webView->resize(WebSize(640, 480));
    1580     webView->layout();
    1581     webkit_support::RunAllPendingMessages();
     1600    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
     1601    m_webView->resize(WebSize(640, 480));
     1602    m_webView->layout();
     1603    runPendingTasks();
    15821604
    15831605    static const char* kFindString = "result";
     
    15861608    WebFindOptions options;
    15871609    WebString searchText = WebString::fromUTF8(kFindString);
    1588     WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
     1610    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
    15891611    WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false));
    15901612    RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame();
     
    15931615        EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0));
    15941616
    1595     webkit_support::RunAllPendingMessages();
     1617    runPendingTasks();
    15961618    EXPECT_FALSE(client.findResultsAreReady());
    15971619
     
    16041626        frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
    16051627
    1606     webkit_support::RunAllPendingMessages();
     1628    runPendingTasks();
    16071629    EXPECT_TRUE(client.findResultsAreReady());
    16081630
    16091631    holdSecondFrame.release();
    1610     webView->close();
     1632
     1633    m_webView->close();
     1634    m_webView = 0;
    16111635}
    16121636
     
    16171641
    16181642    FindUpdateWebFrameClient client;
    1619     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
    1620     webView->resize(WebSize(640, 480));
    1621     webView->layout();
    1622     webkit_support::RunAllPendingMessages();
     1643    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
     1644    m_webView->resize(WebSize(640, 480));
     1645    m_webView->layout();
     1646    runPendingTasks();
    16231647
    16241648    static const char* kFindString = "result";
     
    16271651    WebFindOptions options;
    16281652    WebString searchText = WebString::fromUTF8(kFindString);
    1629     WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
     1653    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
    16301654    WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false));
    16311655    RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame();
     
    16341658        EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0));
    16351659
    1636     webkit_support::RunAllPendingMessages();
     1660    runPendingTasks();
    16371661    EXPECT_FALSE(client.findResultsAreReady());
    16381662
     
    16451669    EXPECT_TRUE(mainFrame->document().getElementById("frame").remove());
    16461670
    1647     webkit_support::RunAllPendingMessages();
     1671    runPendingTasks();
    16481672    EXPECT_TRUE(client.findResultsAreReady());
    16491673
    16501674    holdSecondFrame.release();
    1651     webView->close();
     1675
     1676    m_webView->close();
     1677    m_webView = 0;
    16521678}
    16531679
     
    16871713TEST_F(WebFrameTest, SelectRange)
    16881714{
    1689     WebView* webView;
    16901715    WebFrame* frame;
    16911716    WebRect startWebRect;
     
    16971722    registerMockedHttpURLLoad("select_range_editable.html");
    16981723
    1699     webView = createWebViewForTextSelection(m_baseURL + "select_range_basic.html");
    1700     frame = webView->mainFrame();
     1724    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_basic.html");
     1725    frame = m_webView->mainFrame();
    17011726    EXPECT_EQ("Some test text for testing.", selectionAsString(frame));
    1702     webView->selectionBounds(startWebRect, endWebRect);
     1727    m_webView->selectionBounds(startWebRect, endWebRect);
    17031728    frame->executeCommand(WebString::fromUTF8("Unselect"));
    17041729    EXPECT_EQ("", selectionAsString(frame));
    17051730    frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
    17061731    EXPECT_EQ("Some test text for testing.", selectionAsString(frame));
    1707     webView->close();
    1708 
    1709     webView = createWebViewForTextSelection(m_baseURL + "select_range_scroll.html");
    1710     frame = webView->mainFrame();
     1732    m_webView->close();
     1733    m_webView = 0;
     1734
     1735    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_scroll.html");
     1736    frame = m_webView->mainFrame();
    17111737    EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame));
    1712     webView->selectionBounds(startWebRect, endWebRect);
     1738    m_webView->selectionBounds(startWebRect, endWebRect);
    17131739    frame->executeCommand(WebString::fromUTF8("Unselect"));
    17141740    EXPECT_EQ("", selectionAsString(frame));
    17151741    frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
    17161742    EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame));
    1717     webView->close();
    1718 
    1719     webView = createWebViewForTextSelection(m_baseURL + "select_range_iframe.html");
    1720     frame = webView->mainFrame();
     1743    m_webView->close();
     1744    m_webView = 0;
     1745
     1746    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_iframe.html");
     1747    frame = m_webView->mainFrame();
    17211748    WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe"));
    17221749    EXPECT_EQ("Some test text for testing.", selectionAsString(subframe));
    1723     webView->selectionBounds(startWebRect, endWebRect);
     1750    m_webView->selectionBounds(startWebRect, endWebRect);
    17241751    subframe->executeCommand(WebString::fromUTF8("Unselect"));
    17251752    EXPECT_EQ("", selectionAsString(subframe));
    17261753    subframe->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
    17271754    EXPECT_EQ("Some test text for testing.", selectionAsString(subframe));
    1728     webView->close();
     1755    m_webView->close();
     1756    m_webView = 0;
    17291757
    17301758    // Select the middle of an editable element, then try to extend the selection to the top of the document.
    17311759    // The selection range should be clipped to the bounds of the editable element.
    1732     webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
    1733     frame = webView->mainFrame();
     1760    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
     1761    frame = m_webView->mainFrame();
    17341762    EXPECT_EQ("This text is initially selected.", selectionAsString(frame));
    1735     webView->selectionBounds(startWebRect, endWebRect);
     1763    m_webView->selectionBounds(startWebRect, endWebRect);
    17361764    frame->selectRange(bottomRightMinusOne(endWebRect), WebPoint(0, 0));
    17371765    EXPECT_EQ("16-char header. This text is initially selected.", selectionAsString(frame));
    1738     webView->close();
     1766    m_webView->close();
     1767    m_webView = 0;
    17391768
    17401769    // As above, but extending the selection to the bottom of the document.
    1741     webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
    1742     frame = webView->mainFrame();
     1770    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
     1771    frame = m_webView->mainFrame();
    17431772    EXPECT_EQ("This text is initially selected.", selectionAsString(frame));
    1744     webView->selectionBounds(startWebRect, endWebRect);
     1773    m_webView->selectionBounds(startWebRect, endWebRect);
    17451774    frame->selectRange(topLeft(startWebRect), WebPoint(640, 480));
    17461775    EXPECT_EQ("This text is initially selected. 16-char footer.", selectionAsString(frame));
    1747     webView->close();
     1776    m_webView->close();
     1777    m_webView = 0;
    17481778}
    17491779
     
    17511781{
    17521782    registerMockedHttpURLLoad("text_selection.html");
    1753     WebView* webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
    1754     WebFrame* frame = webView->mainFrame();
     1783    m_webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
     1784    WebFrame* frame = m_webView->mainFrame();
    17551785
    17561786    // Select second span. We can move the start to include the first span.
     
    17911821    frame->selectRange(bottomRightMinusOne(elementBounds(frame, "editable_2")), topLeft(elementBounds(frame, "header_2")));
    17921822    EXPECT_EQ("[ Editable 1. Editable 2.", selectionAsString(frame));
    1793 
    1794     webView->close();
    17951823}
    17961824
     
    17981826{
    17991827    registerMockedHttpURLLoad("text_selection.html");
    1800     WebView* webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
    1801     WebFrame* frame = webView->mainFrame();
     1828    m_webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
     1829    WebFrame* frame = m_webView->mainFrame();
    18021830
    18031831    // Select first span. We can move the end to include the second span.
     
    18381866    frame->selectRange(topLeft(elementBounds(frame, "editable_1")), bottomRightMinusOne(elementBounds(frame, "footer_1")));
    18391867    EXPECT_EQ("Editable 1. Editable 2. ]", selectionAsString(frame));
    1840 
    1841     webView->close();
    18421868}
    18431869
     
    18451871TEST_F(WebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved)
    18461872{
    1847     WebView* webView;
    18481873    WebFrameImpl* frame;
    18491874    registerMockedHttpURLLoad("move_caret.html");
    18501875
    1851     webView = createWebViewForTextSelection(m_baseURL + "move_caret.html");
    1852     frame = (WebFrameImpl*)webView->mainFrame();
     1876    m_webView = createWebViewForTextSelection(m_baseURL + "move_caret.html");
     1877    frame = (WebFrameImpl*)m_webView->mainFrame();
    18531878
    18541879    WebRect initialStartRect;
     
    18581883
    18591884    frame->executeScript(WebScriptSource("select();"));
    1860     webView->selectionBounds(initialStartRect, initialEndRect);
     1885    m_webView->selectionBounds(initialStartRect, initialEndRect);
    18611886    WebPoint moveTo(topLeft(initialStartRect));
    18621887
    18631888    moveTo.y += 40;
    18641889    frame->moveCaretSelectionTowardsWindowPoint(moveTo);
    1865     webView->selectionBounds(startRect, endRect);
     1890    m_webView->selectionBounds(startRect, endRect);
    18661891    EXPECT_EQ(startRect, initialStartRect);
    18671892    EXPECT_EQ(endRect, initialEndRect);
     
    18691894    moveTo.y -= 80;
    18701895    frame->moveCaretSelectionTowardsWindowPoint(moveTo);
    1871     webView->selectionBounds(startRect, endRect);
     1896    m_webView->selectionBounds(startRect, endRect);
    18721897    EXPECT_EQ(startRect, initialStartRect);
    18731898    EXPECT_EQ(endRect, initialEndRect);
    1874 
    1875     webView->close();
    18761899}
    18771900#endif
     
    19111934    // Make sure we initialize to minimum scale, even if the window size
    19121935    // only becomes available after the load begins.
    1913     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
    1914     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    1915     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    1916     webViewImpl->resize(WebSize(1000, 1000));
    1917     webViewImpl->layout();
     1936    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client);
     1937    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     1938    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     1939    m_webView->resize(WebSize(1000, 1000));
     1940    m_webView->layout();
    19181941
    19191942    client.resetTriggered();
    1920     webViewImpl->handleInputEvent(fatTap(0, 0));
     1943    m_webView->handleInputEvent(fatTap(0, 0));
    19211944    EXPECT_FALSE(client.triggered());
    19221945
    19231946    client.resetTriggered();
    1924     webViewImpl->handleInputEvent(fatTap(200, 115));
     1947    m_webView->handleInputEvent(fatTap(200, 115));
    19251948    EXPECT_FALSE(client.triggered());
    19261949
    19271950    for (int i = 0; i <= 46; i++) {
    19281951        client.resetTriggered();
    1929         webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5));
     1952        m_webView->handleInputEvent(fatTap(120, 230 + i * 5));
    19301953
    19311954        int j = i % 10;
     
    19381961    for (int i = 0; i <= 46; i++) {
    19391962        client.resetTriggered();
    1940         webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590));
     1963        m_webView->handleInputEvent(fatTap(10 + i * 5, 590));
    19411964
    19421965        int j = i % 10;
     
    19471970    }
    19481971
     1972    m_webView->close();
     1973    m_webView = 0;
     1974
    19491975}
    19501976
     
    19571983    // Make sure we initialize to minimum scale, even if the window size
    19581984    // only becomes available after the load begins.
    1959     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &client));
    1960     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    1961     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    1962     webViewImpl->resize(WebSize(1000, 1000));
    1963     webViewImpl->layout();
     1985    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &client);
     1986    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     1987    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     1988    m_webView->resize(WebSize(1000, 1000));
     1989    m_webView->layout();
    19641990
    19651991    client.resetTriggered();
    1966     webViewImpl->handleInputEvent(fatTap(50, 50));
     1992    m_webView->handleInputEvent(fatTap(50, 50));
    19671993    EXPECT_FALSE(client.triggered());
     1994
     1995    m_webView->close();
     1996    m_webView = 0;
    19681997}
    19691998
     
    19772006    // Make sure we initialize to minimum scale, even if the window size
    19782007    // only becomes available after the load begins.
    1979     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
    1980     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    1981     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    1982     webViewImpl->resize(WebSize(1000, 1000));
    1983     webViewImpl->layout();
     2008    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client);
     2009    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     2010    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     2011    m_webView->resize(WebSize(1000, 1000));
     2012    m_webView->layout();
    19842013
    19852014    client.resetTriggered();
    1986     webViewImpl->handleInputEvent(fatTap(0, 0));
     2015    m_webView->handleInputEvent(fatTap(0, 0));
    19872016    EXPECT_FALSE(client.triggered());
    19882017
    19892018    client.resetTriggered();
    1990     webViewImpl->handleInputEvent(fatTap(200, 115));
     2019    m_webView->handleInputEvent(fatTap(200, 115));
    19912020    EXPECT_FALSE(client.triggered());
    19922021
    19932022    for (int i = 0; i <= 46; i++) {
    19942023        client.resetTriggered();
    1995         webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5));
     2024        m_webView->handleInputEvent(fatTap(120, 230 + i * 5));
    19962025        EXPECT_FALSE(client.triggered());
    19972026    }
     
    19992028    for (int i = 0; i <= 46; i++) {
    20002029        client.resetTriggered();
    2001         webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590));
     2030        m_webView->handleInputEvent(fatTap(10 + i * 5, 590));
    20022031        EXPECT_FALSE(client.triggered());
    20032032    }
     2033
     2034    m_webView->close();
     2035    m_webView = 0;
    20042036}
    20052037
     
    20162048    // Make sure we initialize to minimum scale, even if the window size
    20172049    // only becomes available after the load begins.
    2018     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
    2019     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    2020     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    2021     webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
    2022     webViewImpl->layout();
     2050    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client);
     2051    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     2052    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     2053    m_webView->resize(WebSize(viewportWidth, viewportHeight));
     2054    m_webView->layout();
    20232055
    20242056    // Click somewhere where the popup shouldn't appear.
    20252057    client.resetTriggered();
    2026     webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, 0));
     2058    m_webView->handleInputEvent(fatTap(viewportWidth / 2, 0));
    20272059    EXPECT_FALSE(client.triggered());
    20282060
    20292061    // Click directly in between two container divs with click handlers, with children that don't handle clicks.
    20302062    client.resetTriggered();
    2031     webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight));
     2063    m_webView->handleInputEvent(fatTap(viewportWidth / 2, divHeight));
    20322064    EXPECT_TRUE(client.triggered());
    20332065
    20342066    // The third div container should be blacklisted if you click on the link it contains.
    20352067    client.resetTriggered();
    2036     webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight * 3.25));
     2068    m_webView->handleInputEvent(fatTap(viewportWidth / 2, divHeight * 3.25));
    20372069    EXPECT_FALSE(client.triggered());
     2070
     2071    m_webView->close();
     2072    m_webView = 0;
    20382073}
    20392074
     
    20462081    // Make sure we initialize to minimum scale, even if the window size
    20472082    // only becomes available after the load begins.
    2048     WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_page_scale.html", true, 0, &client));
    2049     webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
    2050     webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
    2051     webViewImpl->resize(WebSize(1000, 1000));
    2052     webViewImpl->layout();
     2083    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_page_scale.html", true, 0, &client);
     2084    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
     2085    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
     2086    m_webView->resize(WebSize(1000, 1000));
     2087    m_webView->layout();
    20532088
    20542089    client.resetTriggered();
    2055     webViewImpl->handleInputEvent(fatTap(80, 80));
     2090    m_webView->handleInputEvent(fatTap(80, 80));
    20562091    EXPECT_TRUE(client.triggered());
    20572092
    20582093    client.resetTriggered();
    2059     webViewImpl->handleInputEvent(fatTap(230, 190));
     2094    m_webView->handleInputEvent(fatTap(230, 190));
    20602095    EXPECT_TRUE(client.triggered());
    20612096
    2062     webViewImpl->setPageScaleFactor(3.0f, WebPoint(0, 0));
    2063     webViewImpl->layout();
     2097    m_webView->setPageScaleFactor(3.0f, WebPoint(0, 0));
     2098    m_webView->layout();
    20642099
    20652100    client.resetTriggered();
    2066     webViewImpl->handleInputEvent(fatTap(240, 240));
     2101    m_webView->handleInputEvent(fatTap(240, 240));
    20672102    EXPECT_TRUE(client.triggered());
    20682103
    20692104    client.resetTriggered();
    2070     webViewImpl->handleInputEvent(fatTap(690, 570));
     2105    m_webView->handleInputEvent(fatTap(690, 570));
    20712106    EXPECT_FALSE(client.triggered());
     2107
     2108    m_webView->close();
     2109    m_webView = 0;
    20722110}
    20732111
     
    20822120    {
    20832121        frame->loadHTMLString("This should appear", toKURL("data:text/html,chromewebdata"), error.unreachableURL, true);
    2084         webkit_support::RunAllPendingMessages();
     2122        runPendingTasks();
    20852123    }
    20862124
     
    21012139    TestSubstituteDataWebFrameClient webFrameClient;
    21022140
    2103     WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true, &webFrameClient);
    2104     webkit_support::RunAllPendingMessages();
    2105     WebFrame* frame = webView->mainFrame();
     2141    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true, &webFrameClient);
     2142    runPendingTasks();
     2143    WebFrame* frame = m_webView->mainFrame();
    21062144
    21072145    // Load a url as a history navigation that will return an error. TestSubstituteDataWebFrameClient
     
    21222160    errorHistoryItem.setURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length()));
    21232161    errorHistoryItem.setOriginalURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length()));
    2124     webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error);
     2162    Platform::current()->unitTestSupport()->registerMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error);
    21252163    frame->loadHistoryItem(errorHistoryItem);
    2126     webkit_support::ServeAsynchronousMockedRequests();
     2164    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    21272165
    21282166    WebString text = frame->contentAsText(std::numeric_limits<size_t>::max());
    21292167    EXPECT_EQ("This should appear", std::string(text.utf8().data()));
    21302168    EXPECT_TRUE(webFrameClient.commitCalled());
     2169
     2170    m_webView->close();
     2171    m_webView = 0;
    21312172}
    21322173
     
    21622203
    21632204    TestWillInsertBodyWebFrameClient webFrameClient;
    2164     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body.html", false, &webFrameClient);
     2205    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body.html", false, &webFrameClient);
    21652206
    21662207    EXPECT_TRUE(webFrameClient.m_didLoad);
    21672208    EXPECT_EQ(1, webFrameClient.m_numBodies);
    2168     webView->close();
     2209
     2210    m_webView->close();
     2211    m_webView = 0;
    21692212}
    21702213
     
    21742217
    21752218    TestWillInsertBodyWebFrameClient webFrameClient;
    2176     WebView* webView = FrameTestHelpers::createWebView(false, &webFrameClient);
     2219    m_webView = FrameTestHelpers::createWebView(false, &webFrameClient);
    21772220
    21782221    EXPECT_FALSE(webFrameClient.m_didLoad);
    21792222    EXPECT_EQ(1, webFrameClient.m_numBodies); // The empty document that a new frame starts with triggers this.
    2180     webView->close();
     2223    m_webView->close();
     2224    m_webView = 0;
    21812225}
    21822226
    21832227TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection)
    21842228{
    2185     WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
    2186     WebFrame* frame = webView->mainFrame();
     2229    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
     2230    WebFrame* frame = m_webView->mainFrame();
    21872231
    21882232    // This test passes if this doesn't crash.
  • trunk/Source/WebKit/chromium/tests/WebImageTest.cpp

    r140379 r142422  
    3636#include "SharedBuffer.h"
    3737#include <gtest/gtest.h>
     38#include <public/Platform.h>
    3839#include <public/WebData.h>
    3940#include <public/WebSize.h>
    40 #include <webkit/support/webkit_support.h>
     41#include <public/WebUnitTestSupport.h>
    4142
    4243using namespace WebCore;
     
    4748static PassRefPtr<SharedBuffer> readFile(const char* fileName)
    4849{
    49     String filePath = webkit_support::GetWebKitRootDir();
     50    String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
    5051    filePath.append("/Source/WebKit/chromium/tests/data/");
    5152    filePath.append(fileName);
  • trunk/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp

    r138798 r142422  
    3131#include "config.h"
    3232
     33#include "FrameTestHelpers.h"
    3334#include "URLTestHelpers.h"
    3435#include "WebFrame.h"
     
    3839#include "WebSettings.h"
    3940#include "WebView.h"
     41#include <gtest/gtest.h>
     42#include <public/Platform.h>
    4043#include <public/WebString.h>
     44#include <public/WebThread.h>
    4145#include <public/WebURL.h>
    4246#include <public/WebURLRequest.h>
    4347#include <public/WebURLResponse.h>
    44 
    45 #include <gtest/gtest.h>
    46 #include <webkit/support/webkit_support.h>
     48#include <public/WebUnitTestSupport.h>
    4749
    4850using namespace WebKit;
     51using WebKit::FrameTestHelpers::runPendingTasks;
    4952using WebKit::URLTestHelpers::toKURL;
    5053using WebKit::URLTestHelpers::registerMockedURLLoad;
     
    110113    virtual void TearDown()
    111114    {
    112         webkit_support::UnregisterAllMockedURLs();
     115        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    113116        m_webView->close();
    114117    }
     
    139142        m_webView->mainFrame()->loadRequest(urlRequest);
    140143        // Make sure any pending request get served.
    141         webkit_support::ServeAsynchronousMockedRequests();
     144        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    142145        // Some requests get delayed, run the timer.
    143         webkit_support::RunAllPendingMessages();
     146        runPendingTasks();
    144147        // Server the delayed resources.
    145         webkit_support::ServeAsynchronousMockedRequests();
     148        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    146149    }
    147150
  • trunk/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp

    r138798 r142422  
    3636#include "WebFrameClient.h"
    3737#include "WebView.h"
     38#include <public/Platform.h>
    3839#include <public/WebString.h>
    3940#include <public/WebURL.h>
    4041#include <public/WebURLRequest.h>
    4142#include <public/WebURLResponse.h>
     43#include <public/WebUnitTestSupport.h>
    4244
    4345#include <gtest/gtest.h>
    44 #include <webkit/support/webkit_support.h>
    4546
    4647using namespace WebKit;
     
    7172    virtual void TearDown()
    7273    {
    73         webkit_support::UnregisterAllMockedURLs();
     74        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    7475        m_webView->close();
    7576    }
     
    8788        m_webView->mainFrame()->loadRequest(urlRequest);
    8889        // Make sure any pending request get served.
    89         webkit_support::ServeAsynchronousMockedRequests();
     90        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
    9091    }
    9192
  • trunk/Source/WebKit/chromium/tests/WebPluginContainerTest.cpp

    r135315 r142422  
    4747#include "WebViewImpl.h"
    4848#include <gtest/gtest.h>
    49 #include <webkit/support/webkit_support.h>
     49#include <public/Platform.h>
     50#include <public/WebThread.h>
     51#include <public/WebUnitTestSupport.h>
    5052
    5153using namespace WebKit;
     
    6264    virtual void TearDown()
    6365    {
    64         webkit_support::UnregisterAllMockedURLs();
     66        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    6567    }
    6668
     
    9294    webView->resize(WebSize(300, 300));
    9395    webView->layout();
    94     webkit_support::RunAllPendingMessages();
     96    FrameTestHelpers::runPendingTasks();
    9597
    9698    WebPluginContainer* pluginContainerOne = getWebPluginContainer(webView, WebString::fromUTF8("translated-plugin"));
  • trunk/Source/WebKit/chromium/tests/WebViewTest.cpp

    r142011 r142422  
    4848#include "WebViewImpl.h"
    4949#include <gtest/gtest.h>
     50#include <public/Platform.h>
    5051#include <public/WebSize.h>
    51 #include <webkit/support/webkit_support.h>
     52#include <public/WebThread.h>
     53#include <public/WebUnitTestSupport.h>
    5254
    5355using namespace WebKit;
     56using WebKit::FrameTestHelpers::runPendingTasks;
    5457using WebKit::URLTestHelpers::toKURL;
    5558
     
    164167    virtual void TearDown()
    165168    {
    166         webkit_support::UnregisterAllMockedURLs();
     169        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
    167170    }
    168171
     
    570573
    571574    webView->handleInputEvent(event);
    572     webkit_support::RunAllPendingMessages();
     575    runPendingTasks();
    573576    return true;
    574577}
     
    582585    webView->resize(WebSize(500, 300));
    583586    webView->layout();
    584     webkit_support::RunAllPendingMessages();
     587    runPendingTasks();
    585588
    586589    WebString clickListener = WebString::fromUTF8("clickListener");
     
    619622    event.type = WebInputEvent::GestureTap;
    620623    webView->handleInputEvent(event);
    621     webkit_support::RunAllPendingMessages();
     624    runPendingTasks();
    622625    EXPECT_TRUE(client.pendingIntentsCancelled());
    623626    webView->close();
     
    634637    event.y = 8;
    635638    webView->handleInputEvent(event);
    636     webkit_support::RunAllPendingMessages();
     639    runPendingTasks();
    637640    EXPECT_EQ(3, client.tapX());
    638641    EXPECT_EQ(8, client.tapY());
     
    642645    event.y = 7;
    643646    webView->handleInputEvent(event);
    644     webkit_support::RunAllPendingMessages();
     647    runPendingTasks();
    645648    EXPECT_EQ(25, client.longpressX());
    646649    EXPECT_EQ(7, client.longpressY());
     
    656659    webView->resize(WebSize(500, 300));
    657660    webView->layout();
    658     webkit_support::RunAllPendingMessages();
     661    runPendingTasks();
    659662
    660663    WebString target = WebString::fromUTF8("target");
     
    676679    webView->resize(WebSize(640, 480));
    677680    webView->layout();
    678     webkit_support::RunAllPendingMessages();
     681    runPendingTasks();
    679682
    680683    std::string testWord = "This text should be selected.";
     
    700703    webView->resize(WebSize(640, 480));
    701704    webView->layout();
    702     webkit_support::RunAllPendingMessages();
     705    runPendingTasks();
    703706
    704707    std::string testWord = "This text should be selected.";
  • trunk/Source/WebKit/chromium/tests/data/non-fast-scrollable.html

    r141769 r142422  
    1313      position: absolute;
    1414    }
     15    .big {
     16      margin: 200px;
     17    }
    1518  </style>
    1619</head>
     
    1821<body>
    1922  <div class="scrollable box">
    20     Scrolling content.
     23    <span class="big">Scrolling content</span>
    2124    <div class="out-of-flow box">Out-of-flow content.</div>
    2225  </div>
Note: See TracChangeset for help on using the changeset viewer.