[chromium] Enable more of webkit_unit_tests in component builds
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Feb 2013 02:38:06 +0000 (02:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Feb 2013 02:38:06 +0000 (02:38 +0000)
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:

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

18 files changed:
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
Source/WebKit/chromium/tests/EventListenerTest.cpp
Source/WebKit/chromium/tests/FrameTestHelpers.cpp
Source/WebKit/chromium/tests/FrameTestHelpers.h
Source/WebKit/chromium/tests/ListenerLeakTest.cpp
Source/WebKit/chromium/tests/PopupMenuTest.cpp
Source/WebKit/chromium/tests/PrerenderingTest.cpp
Source/WebKit/chromium/tests/ScrollingCoordinatorChromiumTest.cpp
Source/WebKit/chromium/tests/URLTestHelpers.cpp
Source/WebKit/chromium/tests/WebFrameTest.cpp
Source/WebKit/chromium/tests/WebImageTest.cpp
Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp
Source/WebKit/chromium/tests/WebPageSerializerTest.cpp
Source/WebKit/chromium/tests/WebPluginContainerTest.cpp
Source/WebKit/chromium/tests/WebViewTest.cpp
Source/WebKit/chromium/tests/data/non-fast-scrollable.html

index a9ab8778243c83ae3a48b25aa198a79335713507..35a0a7df40b3423a447fe807d382fe15584af949 100644 (file)
@@ -1,3 +1,42 @@
+2013-02-10  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Enable more of webkit_unit_tests in component builds
+        https://bugs.webkit.org/show_bug.cgi?id=109369
+
+        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:
+
 2013-02-10  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled Chromium DEPS to r181645.  Requested by
index 48869bce16ecb55843e334540240e0095aca3b03..b45459bd42099e22a505653bdddb3ee2b191c753 100644 (file)
                                 # We should not include files depending on webkit_support.
                                 # These tests depend on webkit_support and
                                 # functions defined only in !WEBKIT_IMPLEMENTATION.
-                                'tests/AssociatedURLLoaderTest.cpp',
-                                'tests/EventListenerTest.cpp',
-                                'tests/FakeWebPlugin.cpp',
-                                'tests/FrameTestHelpers.cpp',
-                                'tests/IDBBindingUtilitiesTest.cpp',
-                                'tests/IDBRequestTest.cpp',
                                 'tests/LevelDBTest.cpp',
-                                'tests/ListenerLeakTest.cpp',
-                                'tests/LinkHighlightTest.cpp',
-                                'tests/PopupMenuTest.cpp',
-                                'tests/PrerenderingTest.cpp',
-                                'tests/RenderTableCellTest.cpp',
-                                'tests/RenderTableRowTest.cpp',
-                                'tests/ScrollingCoordinatorChromiumTest.cpp',
-                                'tests/URLTestHelpers.cpp',
-                                'tests/WebFrameTest.cpp',
-                                'tests/WebImageTest.cpp',
-                                'tests/WebPageNewSerializerTest.cpp',
-                                'tests/WebPageSerializerTest.cpp',
-                                'tests/WebPluginContainerTest.cpp',
-                                'tests/WebViewTest.cpp',
                             ],
                             'conditions': [
                                 ['OS=="win" or OS=="mac"', {
index 8aba3b6146b20cef43b90220bb2058ecde69a9cf..67658d49cc9bb725bcc1a80a88c6a548b516387d 100644 (file)
 #include "WebFrameClient.h"
 #include "WebURLLoaderOptions.h"
 #include "WebView.h"
+#include <public/Platform.h>
 #include <public/WebString.h>
+#include <public/WebThread.h>
 #include <public/WebURL.h>
 #include <public/WebURLLoader.h>
 #include <public/WebURLLoaderClient.h>
 #include <public/WebURLRequest.h>
 #include <public/WebURLResponse.h>
+#include <public/WebUnitTestSupport.h>
 #include <wtf/text/WTFString.h>
 
 #include <gtest/gtest.h>
-#include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
 using WebKit::URLTestHelpers::toKURL;
@@ -77,7 +79,7 @@ public:
         ,  m_runningMessageLoop(false)
     {
         // Reuse one of the test files from WebFrameTest.
-        std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data());
+        std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data());
         filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html";
         m_frameFilePath = WebString::fromUTF8(filePath.c_str());
     }
@@ -92,7 +94,7 @@ public:
         WebURLResponse response;
         response.initialize();
         response.setMIMEType("text/html");
-        webkit_support::RegisterMockedURL(url, response, m_frameFilePath);
+        Platform::current()->unitTestSupport()->registerMockedURL(url, response, m_frameFilePath);
 
         WebURLRequest request;
         request.initialize();
@@ -100,18 +102,18 @@ public:
         m_webView->mainFrame()->loadRequest(request);
         serveRequests();
 
-        webkit_support::UnregisterMockedURL(url);
+        Platform::current()->unitTestSupport()->unregisterMockedURL(url);
     }
 
     void TearDown()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
         m_webView->close();
     }
 
     void serveRequests()
     {
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     }
 
     WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions options = WebURLLoaderOptions())
@@ -177,7 +179,7 @@ public:
         EXPECT_EQ(m_expectedLoader, loader);
         if (m_runningMessageLoop) {
             m_runningMessageLoop = false;
-            webkit_support::QuitMessageLoop();
+            Platform::current()->currentThread()->exitRunLoop();
         }
     }
 
@@ -218,7 +220,7 @@ public:
         EXPECT_FALSE(m_didFail);
         // Allow the loader to return the error.
         m_runningMessageLoop = true;
-        webkit_support::RunMessageLoop();
+        Platform::current()->currentThread()->enterRunLoop();
         EXPECT_TRUE(m_didFail);
         EXPECT_FALSE(m_didReceiveResponse);
     }
@@ -244,7 +246,7 @@ public:
         if (exposed)
             m_expectedResponse.addHTTPHeaderField("access-control-expose-headers", headerNameString);
         m_expectedResponse.addHTTPHeaderField(headerNameString, "foo");
-        webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
+        Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
 
         WebURLLoaderOptions options;
         options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
@@ -291,7 +293,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginSuccess)
     m_expectedResponse = WebURLResponse();
     m_expectedResponse.initialize();
     m_expectedResponse.setMIMEType("text/html");
-    webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
 
     m_expectedLoader = createAssociatedURLLoader();
     EXPECT_TRUE(m_expectedLoader);
@@ -325,7 +327,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess)
     m_expectedResponse = WebURLResponse();
     m_expectedResponse.initialize();
     m_expectedResponse.setMIMEType("text/html");
-    webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
 
     WebURLLoaderOptions options;
     options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyAllow;
@@ -351,7 +353,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess)
     m_expectedResponse.initialize();
     m_expectedResponse.setMIMEType("text/html");
     m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*");
-    webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
 
     WebURLLoaderOptions options;
     options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
@@ -377,7 +379,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure)
     m_expectedResponse.initialize();
     m_expectedResponse.setMIMEType("text/html");
     m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*");
-    webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
 
     WebURLLoaderOptions options;
     // Send credentials. This will cause the CORS checks to fail, because credentials can't be
@@ -412,7 +414,7 @@ TEST_F(AssociatedURLLoaderTest, RedirectSuccess)
     m_expectedRedirectResponse.setMIMEType("text/html");
     m_expectedRedirectResponse.setHTTPStatusCode(301);
     m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
-    webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
 
     m_expectedNewRequest = WebURLRequest();
     m_expectedNewRequest.initialize();
@@ -421,7 +423,7 @@ TEST_F(AssociatedURLLoaderTest, RedirectSuccess)
     m_expectedResponse = WebURLResponse();
     m_expectedResponse.initialize();
     m_expectedResponse.setMIMEType("text/html");
-    webkit_support::RegisterMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
 
     m_expectedLoader = createAssociatedURLLoader();
     EXPECT_TRUE(m_expectedLoader);
@@ -450,7 +452,7 @@ TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure)
     m_expectedRedirectResponse.setMIMEType("text/html");
     m_expectedRedirectResponse.setHTTPStatusCode(301);
     m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
-    webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
 
     WebURLLoaderOptions options;
     options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
@@ -483,7 +485,7 @@ TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess)
     m_expectedRedirectResponse.setHTTPStatusCode(301);
     m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
     m_expectedRedirectResponse.addHTTPHeaderField("access-control-allow-origin", "*");
-    webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
 
     m_expectedNewRequest = WebURLRequest();
     m_expectedNewRequest.initialize();
@@ -493,7 +495,7 @@ TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess)
     m_expectedResponse.initialize();
     m_expectedResponse.setMIMEType("text/html");
     m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*");
-    webkit_support::RegisterMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);
 
     WebURLLoaderOptions options;
     options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
@@ -600,7 +602,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderAllowResponseHeaders)
     m_expectedResponse.setMIMEType("text/html");
     m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*");
     m_expectedResponse.addHTTPHeaderField(headerNameString, "foo");
-    webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
+    Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath);
 
     WebURLLoaderOptions options;
     options.exposeAllResponseHeaders = true; // This turns off response whitelisting.
index 42554695251ebc07f1ec2bcfb62cc656b6c297d5..629540f5fcea2823b443b1c3e7b5f39bb6d883a9 100644 (file)
@@ -41,7 +41,8 @@
 #include "WebScriptSource.h"
 #include "WebView.h"
 #include <gtest/gtest.h>
-#include <webkit/support/webkit_support.h>
+#include <public/Platform.h>
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebKit;
 
@@ -86,7 +87,7 @@ public:
     virtual void TearDown() OVERRIDE
     {
         m_webView->close();
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
     }
 
     WebFrame* mainFrame() const
index 86cc564779ee731899c35f7566a4a109624f3ca0..6238068b84e0662383995e7f228830e5ebd8f2b5 100644 (file)
 #include "WebSettings.h"
 #include "WebView.h"
 #include "WebViewClient.h"
+#include <public/Platform.h>
 #include <public/WebString.h>
+#include <public/WebThread.h>
 #include <public/WebURLRequest.h>
 #include <public/WebURLResponse.h>
-#include <webkit/support/webkit_support.h>
+#include <public/WebUnitTestSupport.h>
 
 namespace WebKit {
 namespace FrameTestHelpers {
@@ -91,10 +93,24 @@ WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript, Web
     WebView* webView = createWebView(enableJavascript, webFrameClient, webViewClient);
 
     loadFrame(webView->mainFrame(), url);
-    webkit_support::ServeAsynchronousMockedRequests();
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
 
     return webView;
 }
 
+class QuitTask : public WebThread::Task {
+public:
+    virtual void run()
+    {
+        Platform::current()->currentThread()->exitRunLoop();
+    }
+};
+
+void runPendingTasks()
+{
+    Platform::current()->currentThread()->postTask(new QuitTask);
+    Platform::current()->currentThread()->enterRunLoop();
+}
+
 } // namespace FrameTestHelpers
 } // namespace WebKit
index 061ed96fd0b4ff19474cd4d1168ae41564113bef..afbc087c0f9f7034bc0c05cf8c93af8861b6a428 100644 (file)
@@ -32,6 +32,7 @@
 #define FrameTestHelpers_h
 
 #include <string>
+#include <wtf/PassOwnPtr.h>
 
 namespace WebKit {
 
@@ -47,6 +48,8 @@ void loadFrame(WebFrame*, const std::string& url);
 WebView* createWebView(bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0);
 WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0);
 
+void runPendingTasks();
+
 } // namespace FrameTestHelpers
 } // namespace WebKit
 
index b0f700a0cb5d2cc7a449da5704e14128115687ef..15afc2f9ed58d700f354876c3d494319d0cba4dd 100644 (file)
 #include "URLTestHelpers.h"
 #include "WebView.h"
 #include <gtest/gtest.h>
+#include <public/Platform.h>
+#include <public/WebUnitTestSupport.h>
 #include <v8/include/v8-profiler.h>
 #include <v8/include/v8.h>
-#include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
 
@@ -99,7 +100,7 @@ public:
     {
         if (m_webView)
             m_webView->close();
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
     }
 
 protected:
index 63542f863c86fe85280418792d66a505b92cce60..662232baaae22ace93387098136c3a052a96fca9 100644 (file)
@@ -30,9 +30,6 @@
 
 #include "config.h"
 
-#include <gtest/gtest.h>
-#include <webkit/support/webkit_support.h>
-
 #include "Color.h"
 #include "Element.h"
 #include "FrameView.h"
@@ -40,8 +37,8 @@
 #include "KeyboardCodes.h"
 #include "PopupContainer.h"
 #include "PopupMenu.h"
-#include "PopupMenuClient.h"
 #include "PopupMenuChromium.h"
+#include "PopupMenuClient.h"
 #include "RuntimeEnabledFeatures.h"
 #include "URLTestHelpers.h"
 #include "WebDocument.h"
 #include "WebViewClient.h"
 #include "WebViewImpl.h"
 #include "v8.h"
+#include <gtest/gtest.h>
+#include <public/Platform.h>
 #include <public/WebString.h>
 #include <public/WebURL.h>
 #include <public/WebURLRequest.h>
 #include <public/WebURLResponse.h>
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebCore;
 using namespace WebKit;
@@ -193,7 +193,7 @@ protected:
     {
         m_popupMenu = 0;
         m_webView->close();
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
     }
 
     // Returns true if there currently is a select popup in the WebView.
@@ -256,7 +256,7 @@ protected:
 
     void serveRequests()
     {
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     }
 
     void loadFrame(WebFrame* frame, const std::string& fileName)
index f9e60257a65703a8df0719b5292b46325ef4954a..35f1ee6d8021eddbb36369d5a8659ba56abc5920 100644 (file)
 
 #include <gtest/gtest.h>
 #include <list>
+#include <public/Platform.h>
 #include <public/WebPrerender.h>
 #include <public/WebPrerenderingSupport.h>
 #include <public/WebString.h>
-#include <webkit/support/webkit_support.h>
+#include <public/WebUnitTestSupport.h>
 #include <wtf/OwnPtr.h>
 
 using namespace WebKit;
@@ -181,7 +182,7 @@ public:
 
     ~PrerenderingTest()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
         if (m_webView)
             close();
     }
@@ -195,13 +196,12 @@ public:
         m_webView->setPrerendererClient(&m_prerendererClient);
 
         FrameTestHelpers::loadFrame(m_webView->mainFrame(), std::string(baseURL) + fileName);
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     }
 
     void navigateAway()
     {
         FrameTestHelpers::loadFrame(m_webView->mainFrame(), "about:blank");
-        //        webkit_support::RunAllPendingMessages();
     }
 
     void close()
index 0d785901433d1952fc7730e72b4cdff81a117b20..bc6914feb2ce76daf425769f4c9acc117e638458 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CompositorFakeWebGraphicsContext3D.h"
 #include "FrameTestHelpers.h"
+#include "GraphicsLayerChromium.h"
 #include "RenderLayerBacking.h"
 #include "RenderLayerCompositor.h"
 #include "RenderView.h"
 #include "WebViewClient.h"
 #include "WebViewImpl.h"
 #include <gtest/gtest.h>
+#include <public/Platform.h>
 #include <public/WebCompositorSupport.h>
 #include <public/WebLayer.h>
-#include <webkit/support/webkit_support.h>
-
-#include "GraphicsLayerChromium.h"
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebCore;
 using namespace WebKit;
@@ -97,7 +97,7 @@ public:
 
     virtual ~ScrollingCoordinatorChromiumTest()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
         m_webViewImpl->close();
 
         Platform::current()->compositorSupport()->shutdown();
@@ -106,7 +106,7 @@ public:
     void navigateTo(const std::string& url)
     {
         FrameTestHelpers::loadFrame(m_webViewImpl->mainFrame(), url);
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     }
 
     void registerMockedHttpURLLoad(const std::string& fileName)
index 2a0066fd8fb771a0d8372f39500d056f335c1df2..d23b994b42c4ac782096d44ede7a4cd0746db829 100644 (file)
 #include "config.h"
 #include "URLTestHelpers.h"
 
+#include <public/Platform.h>
 #include <public/WebString.h>
 #include <public/WebURL.h>
 #include <public/WebURLResponse.h>
-#include <webkit/support/webkit_support.h>
+#include <public/WebUnitTestSupport.h>
 
 namespace WebKit {
 namespace URLTestHelpers {
@@ -59,12 +60,12 @@ void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, con
     response.setHTTPStatusCode(200);
 
     // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName.
-    std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data());
+    std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data());
     filePath.append("/Source/WebKit/chromium/tests/data/");
     filePath.append(std::string(relativeBaseDirectory.utf8().data()));
     filePath.append(std::string(fileName.utf8().data()));
 
-    webkit_support::RegisterMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str()));
+    Platform::current()->unitTestSupport()->registerMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str()));
 }
 
 } // namespace URLTestHelpers
index a26ad2722375011d22bb3c7e8694e9bf787049f7..d519703830f1903e2185e63e1fa7cb90ab0c14ae 100644 (file)
 #include "WebViewImpl.h"
 #include "v8.h"
 #include <gtest/gtest.h>
+#include <public/Platform.h>
 #include <public/WebFloatRect.h>
+#include <public/WebThread.h>
 #include <public/WebURLResponse.h>
-#include <webkit/support/webkit_support.h>
+#include <public/WebUnitTestSupport.h>
 #include <wtf/Forward.h>
 
 using namespace WebKit;
 using WebCore::FloatRect;
 using WebCore::Range;
 using WebKit::URLTestHelpers::toKURL;
+using WebKit::FrameTestHelpers::runPendingTasks;
 
 namespace {
 
@@ -82,14 +85,21 @@ namespace {
 class WebFrameTest : public testing::Test {
 public:
     WebFrameTest()
-        : m_baseURL("http://www.test.com/"),
-          m_chromeURL("chrome://")
+        : m_baseURL("http://www.test.com/")
+        , m_chromeURL("chrome://")
+        , m_webView(0)
     {
     }
 
+    virtual ~WebFrameTest()
+    {
+        if (m_webView)
+            m_webView->close();
+    }
+
     virtual void TearDown()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
     }
 
     void registerMockedHttpURLLoad(const std::string& fileName)
@@ -105,6 +115,8 @@ public:
 protected:
     std::string m_baseURL;
     std::string m_chromeURL;
+
+    WebView* m_webView;
 };
 
 TEST_F(WebFrameTest, ContentText)
@@ -114,17 +126,15 @@ TEST_F(WebFrameTest, ContentText)
     registerMockedHttpURLLoad("invisible_iframe.html");
     registerMockedHttpURLLoad("zero_sized_iframe.html");
 
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html");
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html");
 
     // Now retrieve the frames text and test it only includes visible elements.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
     EXPECT_NE(std::string::npos, content.find(" visible paragraph"));
     EXPECT_NE(std::string::npos, content.find(" visible iframe"));
     EXPECT_EQ(std::string::npos, content.find(" invisible pararaph"));
     EXPECT_EQ(std::string::npos, content.find(" invisible iframe"));
     EXPECT_EQ(std::string::npos, content.find("iframe with zero size"));
-
-    webView->close();
 }
 
 TEST_F(WebFrameTest, FrameForEnteredContext)
@@ -134,28 +144,27 @@ TEST_F(WebFrameTest, FrameForEnteredContext)
     registerMockedHttpURLLoad("invisible_iframe.html");
     registerMockedHttpURLLoad("zero_sized_iframe.html");
 
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true);
 
     v8::HandleScope scope;
-    EXPECT_EQ(webView->mainFrame(),
+    EXPECT_EQ(m_webView->mainFrame(),
               WebFrame::frameForContext(
-                  webView->mainFrame()->mainWorldScriptContext()));
-    EXPECT_EQ(webView->mainFrame()->firstChild(),
+                  m_webView->mainFrame()->mainWorldScriptContext()));
+    EXPECT_EQ(m_webView->mainFrame()->firstChild(),
               WebFrame::frameForContext(
-                  webView->mainFrame()->firstChild()->mainWorldScriptContext()));
-
-    webView->close();
+                  m_webView->mainFrame()->firstChild()->mainWorldScriptContext()));
 }
 
 TEST_F(WebFrameTest, FormWithNullFrame)
 {
     registerMockedHttpURLLoad("form.html");
 
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html");
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html");
 
     WebVector<WebFormElement> forms;
-    webView->mainFrame()->document().forms(forms);
-    webView->close();
+    m_webView->mainFrame()->document().forms(forms);
+    m_webView->close();
+    m_webView = 0;
 
     EXPECT_EQ(forms.size(), 1U);
 
@@ -168,16 +177,16 @@ TEST_F(WebFrameTest, ChromePageJavascript)
     registerMockedChromeURLLoad("history.html");
  
     // Pass true to enable JavaScript.
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
 
     // Try to run JS against the chrome-style URL.
-    FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
+    FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
 
     // Required to see any updates in contentAsText.
-    webView->layout();
+    m_webView->layout();
 
     // Now retrieve the frame's text and ensure it was modified by running javascript.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
     EXPECT_NE(std::string::npos, content.find("Clobbered"));
 }
 
@@ -186,17 +195,17 @@ TEST_F(WebFrameTest, ChromePageNoJavascript)
     registerMockedChromeURLLoad("history.html");
 
     /// Pass true to enable JavaScript.
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
 
     // Try to run JS against the chrome-style URL after prohibiting it.
     WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome");
-    FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
+    FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");
 
     // Required to see any updates in contentAsText.
-    webView->layout();
+    m_webView->layout();
 
     // Now retrieve the frame's text and ensure it wasn't modified by running javascript.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
     EXPECT_EQ(std::string::npos, content.find("Clobbered"));
 }
 
@@ -205,25 +214,25 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck)
     registerMockedHttpURLLoad("postmessage_test.html");
 
     // Pass true to enable JavaScript.
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true);
     
     // Send a message with the correct origin.
     WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)));
-    WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent");
+    WebDOMEvent event = m_webView->mainFrame()->document().createEvent("MessageEvent");
     WebDOMMessageEvent message = event.to<WebDOMMessageEvent>();
     WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo"));
     message.initMessageEvent("message", false, false, data, "http://origin.com", 0, "");
-    webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message);
+    m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message);
 
     // Send another message with incorrect origin.
     WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL)));
-    webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message);
+    m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message);
 
     // Required to see any updates in contentAsText.
-    webView->layout();
+    m_webView->layout();
 
     // Verify that only the first addition is in the body of the page.
-    std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data());
+    std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data());
     EXPECT_NE(std::string::npos, content.find("Message 1."));
     EXPECT_EQ(std::string::npos, content.find("Message 2."));
 }
@@ -247,14 +256,15 @@ TEST_F(WebFrameTest, FrameViewNeedsLayoutOnFixedLayoutResize)
 
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
-
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
+
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     webViewImpl->mainFrameImpl()->frameView()->setFixedLayoutSize(WebCore::IntSize(100, 100));
     EXPECT_TRUE(webViewImpl->mainFrameImpl()->frameView()->needsLayout());
 
@@ -275,25 +285,25 @@ TEST_F(WebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag)
     FixedLayoutTestWebViewClient client;
     client.m_screenInfo.deviceScaleFactor = 2;
 
-    WebView* webView = static_cast<WebView*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client));
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client);
 
-    webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webView->settings()->setApplyPageScaleFactorInCompositor(true);
-    webView->settings()->setViewportEnabled(true);
-    webView->enableFixedLayoutMode(true);
-    webView->resize(WebSize(viewportWidth, viewportHeight));
-    webView->layout();
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 
-    EXPECT_EQ(2, webView->deviceScaleFactor());
+    EXPECT_EQ(2, m_webView->deviceScaleFactor());
 
     // Device scale factor should be independent of page scale.
-    webView->setPageScaleFactorLimits(1, 2);
-    webView->setPageScaleFactorPreservingScrollOffset(0.5);
-    webView->layout();
-    EXPECT_EQ(1, webView->pageScaleFactor());
+    m_webView->setPageScaleFactorLimits(1, 2);
+    m_webView->setPageScaleFactorPreservingScrollOffset(0.5);
+    m_webView->layout();
+    EXPECT_EQ(1, m_webView->pageScaleFactor());
 
     // Force the layout to happen before leaving the test.
-    webView->mainFrame()->contentAsText(1024).utf8();
+    m_webView->mainFrame()->contentAsText(1024).utf8();
 }
 
 TEST_F(WebFrameTest, FixedLayoutInitializeAtMinimumPageScale)
@@ -307,31 +317,32 @@ TEST_F(WebFrameTest, FixedLayoutInitializeAtMinimumPageScale)
 
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
 
     int defaultFixedLayoutWidth = 980;
     float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWidth;
-    EXPECT_EQ(minimumPageScaleFactor, webViewImpl->pageScaleFactor());
+    EXPECT_EQ(minimumPageScaleFactor, m_webView->pageScaleFactor());
 
     // Assume the user has pinch zoomed to page scale factor 2.
     float userPinchPageScaleFactor = 2;
-    webViewImpl->setPageScaleFactorPreservingScrollOffset(userPinchPageScaleFactor);
-    webViewImpl->mainFrameImpl()->frameView()->layout();
+    m_webView->setPageScaleFactorPreservingScrollOffset(userPinchPageScaleFactor);
+    m_webView->layout();
 
     // Make sure we don't reset to initial scale if the page continues to load.
     bool isNewNavigation;
-    webViewImpl->didCommitLoad(&isNewNavigation, false);
-    webViewImpl->didChangeContentsSize();
-    EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor());
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
+    webViewImpl ->didCommitLoad(&isNewNavigation, false);
+    webViewImpl ->didChangeContentsSize();
+    EXPECT_EQ(userPinchPageScaleFactor, m_webView->pageScaleFactor());
 
     // Make sure we don't reset to initial scale if the viewport size changes.
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight + 100));
-    EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor());
+    m_webView->resize(WebSize(viewportWidth, viewportHeight + 100));
+    EXPECT_EQ(userPinchPageScaleFactor, m_webView->pageScaleFactor());
 }
 
 TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate)
@@ -343,11 +354,11 @@ TEST_F(WebFrameTest, ScaleFactorShouldNotOscillate)
     int viewportWidth = 800;
     int viewportHeight = 1057;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscillate.html", true, 0, &client));
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscillate.html", true, 0, &client);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 }
 
 TEST_F(WebFrameTest, setPageScaleFactorDoesNotLayout)
@@ -359,14 +370,15 @@ TEST_F(WebFrameTest, setPageScaleFactorDoesNotLayout)
     int viewportWidth = 640;
     int viewportHeight = 480;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
+    m_webView = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     int prevLayoutCount = webViewImpl->mainFrameImpl()->frameView()->layoutCount();
     webViewImpl->setPageScaleFactor(3, WebPoint());
     EXPECT_FALSE(webViewImpl->mainFrameImpl()->frameView()->needsLayout());
@@ -382,19 +394,20 @@ TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem)
     int viewportWidth = 640;
     int viewportHeight = 480;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 
-    webViewImpl->setPageScaleFactor(3, WebPoint());
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
+    m_webView->setPageScaleFactor(3, WebPoint());
     webViewImpl->page()->mainFrame()->loader()->history()->saveDocumentAndScrollState();
-    webViewImpl->setPageScaleFactor(1, WebPoint());
+    m_webView->setPageScaleFactor(1, WebPoint());
     webViewImpl->page()->mainFrame()->loader()->history()->restoreScrollPositionAndViewState();
-    EXPECT_EQ(3, webViewImpl->pageScaleFactor());
+    EXPECT_EQ(3, m_webView->pageScaleFactor());
 }
 
 TEST_F(WebFrameTest, pageScaleFactorShrinksViewport)
@@ -406,19 +419,19 @@ TEST_F(WebFrameTest, pageScaleFactorShrinksViewport)
     int viewportWidth = 640;
     int viewportHeight = 480;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 
-    WebCore::FrameView* view = webViewImpl->mainFrameImpl()->frameView();
+    WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameImpl()->frameView();
     int viewportWidthMinusScrollbar = 640 - (view->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15);
     int viewportHeightMinusScrollbar = 480 - (view->horizontalScrollbar()->isOverlayScrollbar() ? 0 : 15);
 
-    webViewImpl->setPageScaleFactor(2, WebPoint());
+    m_webView->setPageScaleFactor(2, WebPoint());
 
     WebCore::IntSize unscaledSize = view->unscaledVisibleContentSize(true);
     EXPECT_EQ(viewportWidth, unscaledSize.width());
@@ -442,16 +455,17 @@ TEST_F(WebFrameTest, pageScaleFactorDoesNotApplyCssTransform)
     int viewportWidth = 640;
     int viewportHeight = 480;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 
-    webViewImpl->setPageScaleFactor(2, WebPoint());
+    m_webView->setPageScaleFactor(2, WebPoint());
 
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     EXPECT_EQ(1, webViewImpl->page()->mainFrame()->frameScaleFactor());
     EXPECT_EQ(980, webViewImpl->page()->mainFrame()->contentRenderer()->unscaledDocumentRect().width());
     EXPECT_EQ(980, webViewImpl->mainFrameImpl()->frameView()->contentsSize().width());
@@ -467,17 +481,17 @@ TEST_F(WebFrameTest, pageScaleFactorScalesPaintClip)
     int viewportWidth = 50;
     int viewportHeight = 50;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 
     // Set <1 page scale so that the clip rect should be larger than
     // the viewport size as passed into resize().
-    webViewImpl->setPageScaleFactor(0.5, WebPoint());
+    m_webView->setPageScaleFactor(0.5, WebPoint());
 
     SkBitmap bitmap;
     bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200);
@@ -491,7 +505,7 @@ TEST_F(WebFrameTest, pageScaleFactorScalesPaintClip)
 
     EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect());
 
-    WebCore::FrameView* view = webViewImpl->mainFrameImpl()->frameView();
+    WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameImpl()->frameView();
     WebCore::IntRect paintRect(0, 0, 200, 200);
     view->paint(&context, paintRect);
 
@@ -510,19 +524,19 @@ TEST_F(WebFrameTest, CanOverrideMaximumScaleFactor)
     int viewportWidth = 640;
     int viewportHeight = 480;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->enableFixedLayoutMode(true);
-    webViewImpl->settings()->setViewportEnabled(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->settings()->setViewportEnabled(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
 
-    EXPECT_EQ(1.0f, webViewImpl->maximumPageScaleFactor());
+    EXPECT_EQ(1.0f, m_webView->maximumPageScaleFactor());
 
-    webViewImpl->setIgnoreViewportTagMaximumScale(true);
-    webViewImpl->layout();
+    m_webView->setIgnoreViewportTagMaximumScale(true);
+    m_webView->layout();
 
-    EXPECT_EQ(4.0f, webViewImpl->maximumPageScaleFactor());
+    EXPECT_EQ(4.0f, m_webView->maximumPageScaleFactor());
 }
 
 #if ENABLE(GESTURE_EVENTS)
@@ -539,15 +553,15 @@ TEST_F(WebFrameTest, DivAutoZoomParamsTestCompositorScaling)
     const float deviceScaleFactor = 2.0f;
     int viewportWidth = 640 / deviceScaleFactor;
     int viewportHeight = 1280 / deviceScaleFactor;
-    WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html"); //
-    webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webView->settings()->setApplyPageScaleFactorInCompositor(true);
-    webView->setDeviceScaleFactor(deviceScaleFactor);
-    webView->setPageScaleFactorLimits(0.01f, 4);
-    webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
-    webView->resize(WebSize(viewportWidth, viewportHeight));
-    webView->enableFixedLayoutMode(true);
-    webView->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html"); //
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->setDeviceScaleFactor(deviceScaleFactor);
+    m_webView->setPageScaleFactorLimits(0.01f, 4);
+    m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->layout();
 
     WebRect wideDiv(200, 100, 400, 150);
     WebRect tallDiv(200, 300, 400, 800);
@@ -557,7 +571,7 @@ TEST_F(WebFrameTest, DivAutoZoomParamsTestCompositorScaling)
     WebPoint scroll;
     bool isAnchor;
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     // Test double-tap zooming into wide div.
     webViewImpl->computeScaleAndScrollForHitRect(doubleTapPointWide, WebViewImpl::DoubleTap, scale, scroll, isAnchor);
     // The div should horizontally fill the screen (modulo margins), and
@@ -605,17 +619,17 @@ TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTestCompositorScaling)
     int viewportWidth = 640 / deviceScaleFactor;
     int viewportHeight = 1280 / deviceScaleFactor;
     float doubleTapZoomAlreadyLegibleRatio = 1.2f;
-    WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html");
-    webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webView->settings()->setApplyPageScaleFactorInCompositor(true);
-    webView->enableFixedLayoutMode(true);
-    webView->resize(WebSize(viewportWidth, viewportHeight));
-    webView->setPageScaleFactorLimits(0.5f, 4);
-    webView->setDeviceScaleFactor(deviceScaleFactor);
-    webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
-    webView->layout();
-
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html");
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->setPageScaleFactorLimits(0.5f, 4);
+    m_webView->setDeviceScaleFactor(deviceScaleFactor);
+    m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0));
+    m_webView->layout();
+
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
 
     WebRect topDiv(200, 100, 200, 150);
@@ -647,15 +661,15 @@ TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTestCompositorScaling)
     int viewportWidth = 320;
     int viewportHeight = 480;
     float doubleTapZoomAlreadyLegibleRatio = 1.2f;
-    WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
-    webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webView->settings()->setApplyPageScaleFactorInCompositor(true);
-    webView->enableFixedLayoutMode(true);
-    webView->resize(WebSize(viewportWidth, viewportHeight));
-    webView->setDeviceScaleFactor(1.5f);
-    webView->layout();
-
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->setDeviceScaleFactor(1.5f);
+    m_webView->layout();
+
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
 
     WebRect div(200, 100, 200, 150);
@@ -664,8 +678,8 @@ TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTestCompositorScaling)
 
     // Test double tap scale bounds.
     // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1
-    webView->setPageScaleFactorLimits(0.5f, 4);
-    webView->layout();
+    m_webView->setPageScaleFactorLimits(0.5f, 4);
+    m_webView->layout();
     float doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
     setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
@@ -678,8 +692,8 @@ TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTestCompositorScaling)
     // Zoom in to reset double_tap_zoom_in_effect flag.
     webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
     // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale
-    webView->setPageScaleFactorLimits(1.1f, 4);
-    webView->layout();
+    m_webView->setPageScaleFactorLimits(1.1f, 4);
+    m_webView->layout();
     doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
     setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
@@ -692,8 +706,8 @@ TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTestCompositorScaling)
     // Zoom in to reset double_tap_zoom_in_effect flag.
     webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
     // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale
-    webView->setPageScaleFactorLimits(0.95f, 4);
-    webView->layout();
+    m_webView->setPageScaleFactorLimits(0.95f, 4);
+    m_webView->layout();
     doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
     setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
@@ -713,14 +727,14 @@ TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTestCompositorScaling)
     int viewportHeight = 480;
     float doubleTapZoomAlreadyLegibleRatio = 1.2f;
     float textAutosizingFontScaleFactor = 1.13f;
-    WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
-    webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webView->settings()->setApplyPageScaleFactorInCompositor(true);
-    webView->enableFixedLayoutMode(true);
-    webView->resize(WebSize(viewportWidth, viewportHeight));
-    webView->layout();
-
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
+
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
     webViewImpl->page()->settings()->setTextAutosizingFontScaleFactor(textAutosizingFontScaleFactor);
 
@@ -733,8 +747,8 @@ TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTestCompositorScaling)
     float legibleScale = textAutosizingFontScaleFactor;
     setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     float doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
-    webView->setPageScaleFactorLimits(0.5f, 4);
-    webView->layout();
+    m_webView->setPageScaleFactorLimits(0.5f, 4);
+    m_webView->layout();
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
     EXPECT_FLOAT_EQ(legibleScale, scale);
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
@@ -745,8 +759,8 @@ TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTestCompositorScaling)
     // Zoom in to reset double_tap_zoom_in_effect flag.
     webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
     // 1 < textAutosizingFontScaleFactor < minimumPageScale < doubleTapZoomAlreadyLegibleScale
-    webView->setPageScaleFactorLimits(1.0f, 4);
-    webView->layout();
+    m_webView->setPageScaleFactorLimits(1.0f, 4);
+    m_webView->layout();
     doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
     setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
@@ -759,8 +773,8 @@ TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTestCompositorScaling)
     // Zoom in to reset double_tap_zoom_in_effect flag.
     webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
     // minimumPageScale < 1 < textAutosizingFontScaleFactor < doubleTapZoomAlreadyLegibleScale
-    webView->setPageScaleFactorLimits(0.95f, 4);
-    webView->layout();
+    m_webView->setPageScaleFactorLimits(0.95f, 4);
+    m_webView->layout();
     doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
     setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
@@ -773,8 +787,8 @@ TEST_F(WebFrameTest, DivAutoZoomScaleFontScaleFactorTestCompositorScaling)
     // Zoom in to reset double_tap_zoom_in_effect flag.
     webViewImpl->applyScrollAndScale(WebSize(), 1.1f);
     // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < textAutosizingFontScaleFactor
-    webView->setPageScaleFactorLimits(0.9f, 4);
-    webView->layout();
+    m_webView->setPageScaleFactorLimits(0.9f, 4);
+    m_webView->layout();
     doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
     setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2);
     simulateDoubleTap(webViewImpl, doubleTapPoint, scale);
@@ -795,17 +809,17 @@ TEST_F(WebFrameTest, DivScrollIntoEditableTest)
     float leftBoxRatio = 0.3f;
     int caretPadding = 10;
     float minReadableCaretHeight = 18.0f;
-    WebKit::WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html");
-    webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webView->settings()->setApplyPageScaleFactorInCompositor(true);
-    webView->enableFixedLayoutMode(true);
-    webView->resize(WebSize(viewportWidth, viewportHeight));
-    webView->setPageScaleFactorLimits(1, 4);
-    webView->layout();
-    webView->setDeviceScaleFactor(1.5f);
-    webView->settings()->setAutoZoomFocusedNodeToLegibleScale(true);
-
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(webView);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html");
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->enableFixedLayoutMode(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->setPageScaleFactorLimits(1, 4);
+    m_webView->layout();
+    m_webView->setDeviceScaleFactor(1.5f);
+    m_webView->settings()->setAutoZoomFocusedNodeToLegibleScale(true);
+
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true);
 
     WebRect editBoxWithText(200, 200, 250, 20);
@@ -813,10 +827,10 @@ TEST_F(WebFrameTest, DivScrollIntoEditableTest)
 
     // Test scrolling the focused node
     // The edit box is shorter and narrower than the viewport when legible.
-    webView->advanceFocus(false);
+    m_webView->advanceFocus(false);
     // Set the caret to the end of the input box.
-    webView->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000);
-    setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
+    m_webView->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000);
+    setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1);
     WebRect rect, caret;
     webViewImpl->selectionBounds(caret, rect);
 
@@ -835,8 +849,8 @@ TEST_F(WebFrameTest, DivScrollIntoEditableTest)
     // The edit box is wider than the viewport when legible.
     viewportWidth = 200;
     viewportHeight = 150;
-    webView->resize(WebSize(viewportWidth, viewportHeight));
-    setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1);
     webViewImpl->selectionBounds(caret, rect);
     webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation);
     EXPECT_TRUE(needAnimation);
@@ -845,9 +859,9 @@ TEST_F(WebFrameTest, DivScrollIntoEditableTest)
     EXPECT_NEAR(hScroll, scroll.x(), 1);
     EXPECT_NEAR(minReadableCaretHeight / caret.height, scale, 0.1);
 
-    setScaleAndScrollAndLayout(webView, WebPoint(0, 0), 1);
+    setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1);
     // Move focus to edit box with text.
-    webView->advanceFocus(false);
+    m_webView->advanceFocus(false);
     webViewImpl->selectionBounds(caret, rect);
     webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation);
     EXPECT_TRUE(needAnimation);
@@ -861,7 +875,7 @@ TEST_F(WebFrameTest, DivScrollIntoEditableTest)
     setScaleAndScrollAndLayout(webViewImpl, scroll, scale);
 
     // Move focus back to the first edit box.
-    webView->advanceFocus(true);
+    m_webView->advanceFocus(true);
     webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation);
     // The position should have stayed the same since this box was already on screen with the right scale.
     EXPECT_FALSE(needAnimation);
@@ -900,12 +914,15 @@ TEST_F(WebFrameTest, ReloadDoesntSetRedirect)
     registerMockedHttpURLLoad("form.html");
 
     TestReloadDoesntRedirectWebFrameClient webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient);
 
-    webView->mainFrame()->reload(true);
+    m_webView->mainFrame()->reload(true);
     // start reload before request is delivered.
-    webView->mainFrame()->reload(true);
-    webkit_support::ServeAsynchronousMockedRequests();
+    m_webView->mainFrame()->reload(true);
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState)
@@ -921,7 +938,8 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState)
     registerMockedHttpURLLoad(secondURL);
     registerMockedHttpURLLoad(thirdURL);
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + firstURL, true));
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + firstURL, true);
+    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView);
     webViewImpl->resize(WebSize(pageWidth, pageHeight));
     webViewImpl->mainFrame()->setScrollOffset(WebSize(pageWidth / 4, pageHeight / 4));
     webViewImpl->setPageScaleFactorPreservingScrollOffset(pageScaleFactor);
@@ -931,13 +949,13 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState)
 
     // Reload the page using the cache.
     webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false);
-    webkit_support::ServeAsynchronousMockedRequests();
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
     ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor());
 
     // Reload the page while ignoring the cache.
     webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), true);
-    webkit_support::ServeAsynchronousMockedRequests();
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset());
     ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor());
 }
@@ -947,11 +965,10 @@ TEST_F(WebFrameTest, IframeRedirect)
     registerMockedHttpURLLoad("iframe_redirect.html");
     registerMockedHttpURLLoad("visible_iframe.html");
 
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true);
-    webkit_support::RunAllPendingMessages(); // Queue the iframe.
-    webkit_support::ServeAsynchronousMockedRequests(); // Load the iframe.
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true);
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); // Load the iframe.
 
-    WebFrame* iframe = webView->findFrameByName(WebString::fromUTF8("ifr"));
+    WebFrame* iframe = m_webView->findFrameByName(WebString::fromUTF8("ifr"));
     ASSERT_TRUE(iframe);
     WebDataSource* iframeDataSource = iframe->dataSource();
     ASSERT_TRUE(iframeDataSource);
@@ -960,8 +977,6 @@ TEST_F(WebFrameTest, IframeRedirect)
     ASSERT_EQ(2U, redirects.size());
     EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data()));
     EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data()));
-
-    webView->close();
 }
 
 TEST_F(WebFrameTest, ClearFocusedNodeTest)
@@ -969,15 +984,13 @@ TEST_F(WebFrameTest, ClearFocusedNodeTest)
     registerMockedHttpURLLoad("iframe_clear_focused_node_test.html");
     registerMockedHttpURLLoad("autofocus_input_field_iframe.html");
 
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true));
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true);
 
     // Clear the focused node.
-    webViewImpl->clearFocusedNode();
+    m_webView->clearFocusedNode();
 
     // Now retrieve the FocusedNode and test it should be null.
-    EXPECT_EQ(0, webViewImpl->focusedWebCoreNode());
-
-    webViewImpl->close();
+    EXPECT_EQ(0, static_cast<WebViewImpl*>(m_webView)->focusedWebCoreNode());
 }
 
 // Implementation of WebFrameClient that tracks the v8 contexts that are created
@@ -1008,7 +1021,7 @@ public:
         int worldId;
     };
 
-    ~ContextLifetimeTestWebFrameClient()
+    virtual ~ContextLifetimeTestWebFrameClient()
     {
         reset();
     }
@@ -1049,9 +1062,9 @@ TEST_F(WebFrameTest, ContextNotificationsLoadUnload)
 
     // Load a frame with an iframe, make sure we get the right create notifications.
     ContextLifetimeTestWebFrameClient webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
 
-    WebFrame* mainFrame = webView->mainFrame();
+    WebFrame* mainFrame = m_webView->mainFrame();
     WebFrame* childFrame = mainFrame->firstChild();
 
     ASSERT_EQ(2u, webFrameClient.createNotifications.size());
@@ -1069,7 +1082,8 @@ TEST_F(WebFrameTest, ContextNotificationsLoadUnload)
     EXPECT_EQ(0, secondCreateNotification->worldId);
 
     // Close the view. We should get two release notifications that are exactly the same as the create ones, in reverse order.
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 
     ASSERT_EQ(2u, webFrameClient.releaseNotifications.size());
     ContextLifetimeTestWebFrameClient::Notification* firstReleaseNotification = webFrameClient.releaseNotifications[0];
@@ -1087,11 +1101,11 @@ TEST_F(WebFrameTest, ContextNotificationsReload)
     registerMockedHttpURLLoad("context_notifications_test_frame.html");
 
     ContextLifetimeTestWebFrameClient webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
 
     // Refresh, we should get two release notifications and two more create notifications.
-    webView->mainFrame()->reload(false);
-    webkit_support::ServeAsynchronousMockedRequests();
+    m_webView->mainFrame()->reload(false);
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     ASSERT_EQ(4u, webFrameClient.createNotifications.size());
     ASSERT_EQ(2u, webFrameClient.releaseNotifications.size());
 
@@ -1102,7 +1116,7 @@ TEST_F(WebFrameTest, ContextNotificationsReload)
     }
 
     // The last two create notifications should be for the current frames and context.
-    WebFrame* mainFrame = webView->mainFrame();
+    WebFrame* mainFrame = m_webView->mainFrame();
     WebFrame* childFrame = mainFrame->firstChild();
     ContextLifetimeTestWebFrameClient::Notification* firstRefreshNotification = webFrameClient.createNotifications[2];
     ContextLifetimeTestWebFrameClient::Notification* secondRefreshNotification = webFrameClient.createNotifications[3];
@@ -1115,7 +1129,8 @@ TEST_F(WebFrameTest, ContextNotificationsReload)
     EXPECT_EQ(childFrame->mainWorldScriptContext(), secondRefreshNotification->context);
     EXPECT_EQ(0, secondRefreshNotification->worldId);
 
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds)
@@ -1126,7 +1141,7 @@ TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds)
     registerMockedHttpURLLoad("context_notifications_test_frame.html");
 
     ContextLifetimeTestWebFrameClient webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);
 
     // Add an isolated world.
     webFrameClient.reset();
@@ -1135,18 +1150,19 @@ TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds)
     WebScriptSource scriptSource("hi!");
     int numSources = 1;
     int extensionGroup = 0;
-    webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scriptSource, numSources, extensionGroup);
+    m_webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scriptSource, numSources, extensionGroup);
 
     // We should now have a new create notification.
     ASSERT_EQ(1u, webFrameClient.createNotifications.size());
     ContextLifetimeTestWebFrameClient::Notification* notification = webFrameClient.createNotifications[0];
     ASSERT_EQ(isolatedWorldId, notification->worldId);
-    ASSERT_EQ(webView->mainFrame(), notification->frame);
+    ASSERT_EQ(m_webView->mainFrame(), notification->frame);
 
     // 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.
-    ASSERT_NE(webView->mainFrame()->mainWorldScriptContext(), notification->context);
+    ASSERT_NE(m_webView->mainFrame()->mainWorldScriptContext(), notification->context);
 
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 
     // We should have gotten three release notifications (one for each of the frames, plus one for the isolated context).
     ASSERT_EQ(3u, webFrameClient.releaseNotifications.size());
@@ -1163,8 +1179,8 @@ TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds)
 TEST_F(WebFrameTest, FindInPage)
 {
     registerMockedHttpURLLoad("find.html");
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html");
-    WebFrame* frame = webView->mainFrame();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html");
+    WebFrame* frame = m_webView->mainFrame();
     const int findIdentifier = 12345;
     WebFindOptions options;
 
@@ -1214,23 +1230,21 @@ TEST_F(WebFrameTest, FindInPage)
     frame->stopFinding(false);
     range = frame->selectionRange();
     ASSERT_TRUE(range.isNull());
-
-    webView->close();
 }
 
 TEST_F(WebFrameTest, GetContentAsPlainText)
 {
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
+    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
     // We set the size because it impacts line wrapping, which changes the
     // resulting text value.
-    webView->resize(WebSize(640, 480));
-    WebFrame* frame = webView->mainFrame();
+    m_webView->resize(WebSize(640, 480));
+    WebFrame* frame = m_webView->mainFrame();
 
     // Generate a simple test case.
     const char simpleSource[] = "<div>Foo bar</div><div></div>baz";
     WebCore::KURL testURL = toKURL("about:blank");
     frame->loadHTMLString(simpleSource, testURL);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     // Make sure it comes out OK.
     const std::string expected("Foo bar\nbaz");
@@ -1245,13 +1259,13 @@ TEST_F(WebFrameTest, GetContentAsPlainText)
     // Now do a new test with a subframe.
     const char outerFrameSource[] = "Hello<iframe></iframe> world";
     frame->loadHTMLString(outerFrameSource, testURL);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     // Load something into the subframe.
     WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe"));
     ASSERT_TRUE(subframe);
     subframe->loadHTMLString("sub<p>text", testURL);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     text = frame->contentAsText(std::numeric_limits<size_t>::max());
     EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8().data()));
@@ -1260,20 +1274,18 @@ TEST_F(WebFrameTest, GetContentAsPlainText)
     // what we'll take. There used to be a crash in this case.
     text = frame->contentAsText(12);
     EXPECT_EQ("Hello world", std::string(text.utf8().data()));
-
-    webView->close();
 }
 
 TEST_F(WebFrameTest, GetFullHtmlOfPage)
 {
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
-    WebFrame* frame = webView->mainFrame();
+    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
+    WebFrame* frame = m_webView->mainFrame();
 
     // Generate a simple test case.
     const char simpleSource[] = "<p>Hello</p><p>World</p>";
     WebCore::KURL testURL = toKURL("about:blank");
     frame->loadHTMLString(simpleSource, testURL);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     WebString text = frame->contentAsText(std::numeric_limits<size_t>::max());
     EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data()));
@@ -1282,7 +1294,7 @@ TEST_F(WebFrameTest, GetFullHtmlOfPage)
 
     // Load again with the output html.
     frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data()));
 
@@ -1312,10 +1324,13 @@ TEST_F(WebFrameTest, ExecuteScriptDuringDidCreateScriptContext)
     registerMockedHttpURLLoad("hello_world.html");
 
     TestExecuteScriptDuringDidCreateScriptContext webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "hello_world.html", true, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "hello_world.html", true, &webFrameClient);
+
+    m_webView->mainFrame()->reload();
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
 
-    webView->mainFrame()->reload();
-    webkit_support::ServeAsynchronousMockedRequests();
+    m_webView->close();
+    m_webView = 0;
 }
 
 class TestDidCreateFrameWebFrameClient : public WebFrameClient {
@@ -1343,10 +1358,13 @@ TEST_F(WebFrameTest, DidCreateFrame)
     registerMockedHttpURLLoad("zero_sized_iframe.html");
 
     TestDidCreateFrameWebFrameClient webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", false, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", false, &webFrameClient);
 
     EXPECT_EQ(webFrameClient.m_frameCount, 3); 
-    EXPECT_EQ(webFrameClient.m_parent, webView->mainFrame());
+    EXPECT_EQ(webFrameClient.m_parent, m_webView->mainFrame());
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 class FindUpdateWebFrameClient : public WebFrameClient {
@@ -1383,10 +1401,10 @@ TEST_F(WebFrameTest, FindInPageMatchRects)
     registerMockedHttpURLLoad("find_in_page_frame.html");
 
     FindUpdateWebFrameClient client;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
-    webView->resize(WebSize(640, 480));
-    webView->layout();
-    webkit_support::RunAllPendingMessages();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
+    m_webView->resize(WebSize(640, 480));
+    m_webView->layout();
+    runPendingTasks();
 
     // Note that the 'result 19' in the <select> element is not expected to produce a match.
     static const char* kFindString = "result";
@@ -1395,7 +1413,7 @@ TEST_F(WebFrameTest, FindInPageMatchRects)
 
     WebFindOptions options;
     WebString searchText = WebString::fromUTF8(kFindString);
-    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
+    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
     EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0));
 
     mainFrame->resetMatchCount();
@@ -1403,7 +1421,7 @@ TEST_F(WebFrameTest, FindInPageMatchRects)
     for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
         frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_TRUE(client.findResultsAreReady());
 
     WebVector<WebFloatRect> webMatchRects;
@@ -1490,11 +1508,12 @@ TEST_F(WebFrameTest, FindInPageMatchRects)
     EXPECT_TRUE(webMatchRects[17].y > webMatchRects[18].y);
 
     // Resizing should update the rects version.
-    webView->resize(WebSize(800, 600));
-    webkit_support::RunAllPendingMessages();
+    m_webView->resize(WebSize(800, 600));
+    runPendingTasks();
     EXPECT_TRUE(mainFrame->findMatchMarkersVersion() != rectsVersion);
 
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, FindInPageSkipsHiddenFrames)
@@ -1502,10 +1521,10 @@ TEST_F(WebFrameTest, FindInPageSkipsHiddenFrames)
     registerMockedHttpURLLoad("find_in_hidden_frame.html");
 
     FindUpdateWebFrameClient client;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client);
-    webView->resize(WebSize(640, 480));
-    webView->layout();
-    webkit_support::RunAllPendingMessages();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client);
+    m_webView->resize(WebSize(640, 480));
+    m_webView->layout();
+    runPendingTasks();
 
     static const char* kFindString = "hello";
     static const int kFindIdentifier = 12345;
@@ -1513,7 +1532,7 @@ TEST_F(WebFrameTest, FindInPageSkipsHiddenFrames)
 
     WebFindOptions options;
     WebString searchText = WebString::fromUTF8(kFindString);
-    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
+    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
     EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0));
 
     mainFrame->resetMatchCount();
@@ -1521,11 +1540,12 @@ TEST_F(WebFrameTest, FindInPageSkipsHiddenFrames)
     for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
         frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_TRUE(client.findResultsAreReady());
     EXPECT_EQ(kNumResults, client.count());
 
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, FindOnDetachedFrame)
@@ -1534,17 +1554,17 @@ TEST_F(WebFrameTest, FindOnDetachedFrame)
     registerMockedHttpURLLoad("find_in_page_frame.html");
 
     FindUpdateWebFrameClient client;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
-    webView->resize(WebSize(640, 480));
-    webView->layout();
-    webkit_support::RunAllPendingMessages();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
+    m_webView->resize(WebSize(640, 480));
+    m_webView->layout();
+    runPendingTasks();
 
     static const char* kFindString = "result";
     static const int kFindIdentifier = 12345;
 
     WebFindOptions options;
     WebString searchText = WebString::fromUTF8(kFindString);
-    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
+    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
     WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false));
     RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame();
 
@@ -1554,7 +1574,7 @@ TEST_F(WebFrameTest, FindOnDetachedFrame)
     EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0));
     EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false, 0));
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_FALSE(client.findResultsAreReady());
 
     mainFrame->resetMatchCount();
@@ -1562,11 +1582,13 @@ TEST_F(WebFrameTest, FindOnDetachedFrame)
     for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
         frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_TRUE(client.findResultsAreReady());
 
     holdSecondFrame.release();
-    webView->close();
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, FindDetachFrameBeforeScopeStrings)
@@ -1575,24 +1597,24 @@ TEST_F(WebFrameTest, FindDetachFrameBeforeScopeStrings)
     registerMockedHttpURLLoad("find_in_page_frame.html");
 
     FindUpdateWebFrameClient client;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
-    webView->resize(WebSize(640, 480));
-    webView->layout();
-    webkit_support::RunAllPendingMessages();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
+    m_webView->resize(WebSize(640, 480));
+    m_webView->layout();
+    runPendingTasks();
 
     static const char* kFindString = "result";
     static const int kFindIdentifier = 12345;
 
     WebFindOptions options;
     WebString searchText = WebString::fromUTF8(kFindString);
-    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
+    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
     WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false));
     RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame();
 
     for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
         EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0));
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_FALSE(client.findResultsAreReady());
 
     // Detach the frame between finding and scoping.
@@ -1603,11 +1625,13 @@ TEST_F(WebFrameTest, FindDetachFrameBeforeScopeStrings)
     for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
         frame->scopeStringMatches(kFindIdentifier, searchText, options, true);
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_TRUE(client.findResultsAreReady());
 
     holdSecondFrame.release();
-    webView->close();
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings)
@@ -1616,24 +1640,24 @@ TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings)
     registerMockedHttpURLLoad("find_in_page_frame.html");
 
     FindUpdateWebFrameClient client;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
-    webView->resize(WebSize(640, 480));
-    webView->layout();
-    webkit_support::RunAllPendingMessages();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);
+    m_webView->resize(WebSize(640, 480));
+    m_webView->layout();
+    runPendingTasks();
 
     static const char* kFindString = "result";
     static const int kFindIdentifier = 12345;
 
     WebFindOptions options;
     WebString searchText = WebString::fromUTF8(kFindString);
-    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame());
+    WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
     WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false));
     RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame();
 
     for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
         EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0));
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_FALSE(client.findResultsAreReady());
 
     mainFrame->resetMatchCount();
@@ -1644,11 +1668,13 @@ TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings)
     // The first scopeStringMatches will have reset the state. Detach before it actually scopes.
     EXPECT_TRUE(mainFrame->document().getElementById("frame").remove());
 
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_TRUE(client.findResultsAreReady());
 
     holdSecondFrame.release();
-    webView->close();
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 static WebView* createWebViewForTextSelection(const std::string& url)
@@ -1686,7 +1712,6 @@ static std::string selectionAsString(WebFrame* frame)
 
 TEST_F(WebFrameTest, SelectRange)
 {
-    WebView* webView;
     WebFrame* frame;
     WebRect startWebRect;
     WebRect endWebRect;
@@ -1696,62 +1721,67 @@ TEST_F(WebFrameTest, SelectRange)
     registerMockedHttpURLLoad("select_range_iframe.html");
     registerMockedHttpURLLoad("select_range_editable.html");
 
-    webView = createWebViewForTextSelection(m_baseURL + "select_range_basic.html");
-    frame = webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_basic.html");
+    frame = m_webView->mainFrame();
     EXPECT_EQ("Some test text for testing.", selectionAsString(frame));
-    webView->selectionBounds(startWebRect, endWebRect);
+    m_webView->selectionBounds(startWebRect, endWebRect);
     frame->executeCommand(WebString::fromUTF8("Unselect"));
     EXPECT_EQ("", selectionAsString(frame));
     frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
     EXPECT_EQ("Some test text for testing.", selectionAsString(frame));
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 
-    webView = createWebViewForTextSelection(m_baseURL + "select_range_scroll.html");
-    frame = webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_scroll.html");
+    frame = m_webView->mainFrame();
     EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame));
-    webView->selectionBounds(startWebRect, endWebRect);
+    m_webView->selectionBounds(startWebRect, endWebRect);
     frame->executeCommand(WebString::fromUTF8("Unselect"));
     EXPECT_EQ("", selectionAsString(frame));
     frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
     EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame));
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 
-    webView = createWebViewForTextSelection(m_baseURL + "select_range_iframe.html");
-    frame = webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_iframe.html");
+    frame = m_webView->mainFrame();
     WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe"));
     EXPECT_EQ("Some test text for testing.", selectionAsString(subframe));
-    webView->selectionBounds(startWebRect, endWebRect);
+    m_webView->selectionBounds(startWebRect, endWebRect);
     subframe->executeCommand(WebString::fromUTF8("Unselect"));
     EXPECT_EQ("", selectionAsString(subframe));
     subframe->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect));
     EXPECT_EQ("Some test text for testing.", selectionAsString(subframe));
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 
     // Select the middle of an editable element, then try to extend the selection to the top of the document.
     // The selection range should be clipped to the bounds of the editable element.
-    webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
-    frame = webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
+    frame = m_webView->mainFrame();
     EXPECT_EQ("This text is initially selected.", selectionAsString(frame));
-    webView->selectionBounds(startWebRect, endWebRect);
+    m_webView->selectionBounds(startWebRect, endWebRect);
     frame->selectRange(bottomRightMinusOne(endWebRect), WebPoint(0, 0));
     EXPECT_EQ("16-char header. This text is initially selected.", selectionAsString(frame));
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 
     // As above, but extending the selection to the bottom of the document.
-    webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
-    frame = webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");
+    frame = m_webView->mainFrame();
     EXPECT_EQ("This text is initially selected.", selectionAsString(frame));
-    webView->selectionBounds(startWebRect, endWebRect);
+    m_webView->selectionBounds(startWebRect, endWebRect);
     frame->selectRange(topLeft(startWebRect), WebPoint(640, 480));
     EXPECT_EQ("This text is initially selected. 16-char footer.", selectionAsString(frame));
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, SelectRangeCanMoveSelectionStart)
 {
     registerMockedHttpURLLoad("text_selection.html");
-    WebView* webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
-    WebFrame* frame = webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
+    WebFrame* frame = m_webView->mainFrame();
 
     // Select second span. We can move the start to include the first span.
     frame->executeScript(WebScriptSource("selectElement('header_2');"));
@@ -1790,15 +1820,13 @@ TEST_F(WebFrameTest, SelectRangeCanMoveSelectionStart)
     EXPECT_EQ("Editable 2.", selectionAsString(frame));
     frame->selectRange(bottomRightMinusOne(elementBounds(frame, "editable_2")), topLeft(elementBounds(frame, "header_2")));
     EXPECT_EQ("[ Editable 1. Editable 2.", selectionAsString(frame));
-
-    webView->close();
 }
 
 TEST_F(WebFrameTest, SelectRangeCanMoveSelectionEnd)
 {
     registerMockedHttpURLLoad("text_selection.html");
-    WebView* webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
-    WebFrame* frame = webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");
+    WebFrame* frame = m_webView->mainFrame();
 
     // Select first span. We can move the end to include the second span.
     frame->executeScript(WebScriptSource("selectElement('header_1');"));
@@ -1837,19 +1865,16 @@ TEST_F(WebFrameTest, SelectRangeCanMoveSelectionEnd)
     EXPECT_EQ("Editable 1.", selectionAsString(frame));
     frame->selectRange(topLeft(elementBounds(frame, "editable_1")), bottomRightMinusOne(elementBounds(frame, "footer_1")));
     EXPECT_EQ("Editable 1. Editable 2. ]", selectionAsString(frame));
-
-    webView->close();
 }
 
 #if OS(ANDROID)
 TEST_F(WebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved)
 {
-    WebView* webView;
     WebFrameImpl* frame;
     registerMockedHttpURLLoad("move_caret.html");
 
-    webView = createWebViewForTextSelection(m_baseURL + "move_caret.html");
-    frame = (WebFrameImpl*)webView->mainFrame();
+    m_webView = createWebViewForTextSelection(m_baseURL + "move_caret.html");
+    frame = (WebFrameImpl*)m_webView->mainFrame();
 
     WebRect initialStartRect;
     WebRect initialEndRect;
@@ -1857,22 +1882,20 @@ TEST_F(WebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved)
     WebRect endRect;
 
     frame->executeScript(WebScriptSource("select();"));
-    webView->selectionBounds(initialStartRect, initialEndRect);
+    m_webView->selectionBounds(initialStartRect, initialEndRect);
     WebPoint moveTo(topLeft(initialStartRect));
 
     moveTo.y += 40;
     frame->moveCaretSelectionTowardsWindowPoint(moveTo);
-    webView->selectionBounds(startRect, endRect);
+    m_webView->selectionBounds(startRect, endRect);
     EXPECT_EQ(startRect, initialStartRect);
     EXPECT_EQ(endRect, initialEndRect);
 
     moveTo.y -= 80;
     frame->moveCaretSelectionTowardsWindowPoint(moveTo);
-    webView->selectionBounds(startRect, endRect);
+    m_webView->selectionBounds(startRect, endRect);
     EXPECT_EQ(startRect, initialStartRect);
     EXPECT_EQ(endRect, initialEndRect);
-
-    webView->close();
 }
 #endif
 
@@ -1910,23 +1933,23 @@ TEST_F(WebFrameTest, DisambiguationPopup)
 
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->resize(WebSize(1000, 1000));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->resize(WebSize(1000, 1000));
+    m_webView->layout();
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(0, 0));
+    m_webView->handleInputEvent(fatTap(0, 0));
     EXPECT_FALSE(client.triggered());
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(200, 115));
+    m_webView->handleInputEvent(fatTap(200, 115));
     EXPECT_FALSE(client.triggered());
 
     for (int i = 0; i <= 46; i++) {
         client.resetTriggered();
-        webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5));
+        m_webView->handleInputEvent(fatTap(120, 230 + i * 5));
 
         int j = i % 10;
         if (j >= 7 && j <= 9)
@@ -1937,7 +1960,7 @@ TEST_F(WebFrameTest, DisambiguationPopup)
 
     for (int i = 0; i <= 46; i++) {
         client.resetTriggered();
-        webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590));
+        m_webView->handleInputEvent(fatTap(10 + i * 5, 590));
 
         int j = i % 10;
         if (j >= 7 && j <= 9)
@@ -1946,6 +1969,9 @@ TEST_F(WebFrameTest, DisambiguationPopup)
             EXPECT_FALSE(client.triggered());
     }
 
+    m_webView->close();
+    m_webView = 0;
+
 }
 
 TEST_F(WebFrameTest, DisambiguationPopupNoContainer)
@@ -1956,15 +1982,18 @@ TEST_F(WebFrameTest, DisambiguationPopupNoContainer)
 
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->resize(WebSize(1000, 1000));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->resize(WebSize(1000, 1000));
+    m_webView->layout();
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(50, 50));
+    m_webView->handleInputEvent(fatTap(50, 50));
     EXPECT_FALSE(client.triggered());
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, DisambiguationPopupMobileSite)
@@ -1976,31 +2005,34 @@ TEST_F(WebFrameTest, DisambiguationPopupMobileSite)
 
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->resize(WebSize(1000, 1000));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->resize(WebSize(1000, 1000));
+    m_webView->layout();
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(0, 0));
+    m_webView->handleInputEvent(fatTap(0, 0));
     EXPECT_FALSE(client.triggered());
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(200, 115));
+    m_webView->handleInputEvent(fatTap(200, 115));
     EXPECT_FALSE(client.triggered());
 
     for (int i = 0; i <= 46; i++) {
         client.resetTriggered();
-        webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5));
+        m_webView->handleInputEvent(fatTap(120, 230 + i * 5));
         EXPECT_FALSE(client.triggered());
     }
 
     for (int i = 0; i <= 46; i++) {
         client.resetTriggered();
-        webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590));
+        m_webView->handleInputEvent(fatTap(10 + i * 5, 590));
         EXPECT_FALSE(client.triggered());
     }
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, DisambiguationPopupBlacklist)
@@ -2015,26 +2047,29 @@ TEST_F(WebFrameTest, DisambiguationPopupBlacklist)
 
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->resize(WebSize(viewportWidth, viewportHeight));
+    m_webView->layout();
 
     // Click somewhere where the popup shouldn't appear.
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, 0));
+    m_webView->handleInputEvent(fatTap(viewportWidth / 2, 0));
     EXPECT_FALSE(client.triggered());
 
     // Click directly in between two container divs with click handlers, with children that don't handle clicks.
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight));
+    m_webView->handleInputEvent(fatTap(viewportWidth / 2, divHeight));
     EXPECT_TRUE(client.triggered());
 
     // The third div container should be blacklisted if you click on the link it contains.
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight * 3.25));
+    m_webView->handleInputEvent(fatTap(viewportWidth / 2, divHeight * 3.25));
     EXPECT_FALSE(client.triggered());
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, DisambiguationPopupPageScale)
@@ -2045,30 +2080,33 @@ TEST_F(WebFrameTest, DisambiguationPopupPageScale)
 
     // Make sure we initialize to minimum scale, even if the window size
     // only becomes available after the load begins.
-    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_page_scale.html", true, 0, &client));
-    webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);
-    webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);
-    webViewImpl->resize(WebSize(1000, 1000));
-    webViewImpl->layout();
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_page_scale.html", true, 0, &client);
+    m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true);
+    m_webView->settings()->setApplyPageScaleFactorInCompositor(true);
+    m_webView->resize(WebSize(1000, 1000));
+    m_webView->layout();
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(80, 80));
+    m_webView->handleInputEvent(fatTap(80, 80));
     EXPECT_TRUE(client.triggered());
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(230, 190));
+    m_webView->handleInputEvent(fatTap(230, 190));
     EXPECT_TRUE(client.triggered());
 
-    webViewImpl->setPageScaleFactor(3.0f, WebPoint(0, 0));
-    webViewImpl->layout();
+    m_webView->setPageScaleFactor(3.0f, WebPoint(0, 0));
+    m_webView->layout();
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(240, 240));
+    m_webView->handleInputEvent(fatTap(240, 240));
     EXPECT_TRUE(client.triggered());
 
     client.resetTriggered();
-    webViewImpl->handleInputEvent(fatTap(690, 570));
+    m_webView->handleInputEvent(fatTap(690, 570));
     EXPECT_FALSE(client.triggered());
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 class TestSubstituteDataWebFrameClient : public WebFrameClient {
@@ -2081,7 +2119,7 @@ public:
     virtual void didFailProvisionalLoad(WebFrame* frame, const WebURLError& error)
     {
         frame->loadHTMLString("This should appear", toKURL("data:text/html,chromewebdata"), error.unreachableURL, true);
-        webkit_support::RunAllPendingMessages();
+        runPendingTasks();
     }
 
     virtual void didCommitProvisionalLoad(WebFrame* frame, bool)
@@ -2100,9 +2138,9 @@ TEST_F(WebFrameTest, ReplaceNavigationAfterHistoryNavigation)
 {
     TestSubstituteDataWebFrameClient webFrameClient;
 
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true, &webFrameClient);
-    webkit_support::RunAllPendingMessages();
-    WebFrame* frame = webView->mainFrame();
+    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true, &webFrameClient);
+    runPendingTasks();
+    WebFrame* frame = m_webView->mainFrame();
 
     // Load a url as a history navigation that will return an error. TestSubstituteDataWebFrameClient
     // will start a SubstituteData load in response to the load failure, which should get fully committed.
@@ -2121,13 +2159,16 @@ TEST_F(WebFrameTest, ReplaceNavigationAfterHistoryNavigation)
     errorHistoryItem.initialize();
     errorHistoryItem.setURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length()));
     errorHistoryItem.setOriginalURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length()));
-    webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error);
+    Platform::current()->unitTestSupport()->registerMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error);
     frame->loadHistoryItem(errorHistoryItem);
-    webkit_support::ServeAsynchronousMockedRequests();
+    Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
 
     WebString text = frame->contentAsText(std::numeric_limits<size_t>::max());
     EXPECT_EQ("This should appear", std::string(text.utf8().data()));
     EXPECT_TRUE(webFrameClient.commitCalled());
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 class TestWillInsertBodyWebFrameClient : public WebFrameClient {
@@ -2161,11 +2202,13 @@ TEST_F(WebFrameTest, HTMLDocument)
     registerMockedHttpURLLoad("clipped-body.html");
 
     TestWillInsertBodyWebFrameClient webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body.html", false, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body.html", false, &webFrameClient);
 
     EXPECT_TRUE(webFrameClient.m_didLoad);
     EXPECT_EQ(1, webFrameClient.m_numBodies);
-    webView->close();
+
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, EmptyDocument)
@@ -2173,17 +2216,18 @@ TEST_F(WebFrameTest, EmptyDocument)
     registerMockedHttpURLLoad("pageserializer/green_rectangle.svg");
 
     TestWillInsertBodyWebFrameClient webFrameClient;
-    WebView* webView = FrameTestHelpers::createWebView(false, &webFrameClient);
+    m_webView = FrameTestHelpers::createWebView(false, &webFrameClient);
 
     EXPECT_FALSE(webFrameClient.m_didLoad);
     EXPECT_EQ(1, webFrameClient.m_numBodies); // The empty document that a new frame starts with triggers this.
-    webView->close();
+    m_webView->close();
+    m_webView = 0;
 }
 
 TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection)
 {
-    WebView* webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
-    WebFrame* frame = webView->mainFrame();
+    m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);
+    WebFrame* frame = m_webView->mainFrame();
 
     // This test passes if this doesn't crash.
     frame->moveCaretSelectionTowardsWindowPoint(WebPoint(0, 0));
index 2f44e34b32bf1648de4b48f283657244dbce712e..5029f5157e2719a46b3d7beee821223936af1c6e 100644 (file)
 #include "FileSystem.h"
 #include "SharedBuffer.h"
 #include <gtest/gtest.h>
+#include <public/Platform.h>
 #include <public/WebData.h>
 #include <public/WebSize.h>
-#include <webkit/support/webkit_support.h>
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebCore;
 using namespace WebKit;
@@ -46,7 +47,7 @@ namespace {
 
 static PassRefPtr<SharedBuffer> readFile(const char* fileName)
 {
-    String filePath = webkit_support::GetWebKitRootDir();
+    String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
     filePath.append("/Source/WebKit/chromium/tests/data/");
     filePath.append(fileName);
 
index 4a2b72bdf9458f70d14cf4d4a1fbd9f8ada6d2ec..145d2d2cb4336360552e34433cb9d3b518ccad4e 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "config.h"
 
+#include "FrameTestHelpers.h"
 #include "URLTestHelpers.h"
 #include "WebFrame.h"
 #include "WebFrameClient.h"
 #include "WebScriptSource.h"
 #include "WebSettings.h"
 #include "WebView.h"
+#include <gtest/gtest.h>
+#include <public/Platform.h>
 #include <public/WebString.h>
+#include <public/WebThread.h>
 #include <public/WebURL.h>
 #include <public/WebURLRequest.h>
 #include <public/WebURLResponse.h>
-
-#include <gtest/gtest.h>
-#include <webkit/support/webkit_support.h>
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebKit;
+using WebKit::FrameTestHelpers::runPendingTasks;
 using WebKit::URLTestHelpers::toKURL;
 using WebKit::URLTestHelpers::registerMockedURLLoad;
 
@@ -109,7 +112,7 @@ protected:
 
     virtual void TearDown()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
         m_webView->close();
     }
 
@@ -138,11 +141,11 @@ protected:
         urlRequest.setURL(url);
         m_webView->mainFrame()->loadRequest(urlRequest);
         // Make sure any pending request get served.
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
         // Some requests get delayed, run the timer.
-        webkit_support::RunAllPendingMessages();
+        runPendingTasks();
         // Server the delayed resources.
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     }
 
     const WebString& htmlMimeType() const { return m_htmlMimeType; }
index cfef347502e4063c876ce790f673b70047f55232..11efd9626b71f887974f4c087c0600dd93315818 100644 (file)
 #include "WebFrame.h"
 #include "WebFrameClient.h"
 #include "WebView.h"
+#include <public/Platform.h>
 #include <public/WebString.h>
 #include <public/WebURL.h>
 #include <public/WebURLRequest.h>
 #include <public/WebURLResponse.h>
+#include <public/WebUnitTestSupport.h>
 
 #include <gtest/gtest.h>
-#include <webkit/support/webkit_support.h>
 
 using namespace WebKit;
 using WebKit::URLTestHelpers::toKURL;
@@ -70,7 +71,7 @@ protected:
 
     virtual void TearDown()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
         m_webView->close();
     }
 
@@ -86,7 +87,7 @@ protected:
         urlRequest.setURL(url);
         m_webView->mainFrame()->loadRequest(urlRequest);
         // Make sure any pending request get served.
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     }
 
     static bool webVectorContains(const WebVector<WebURL>& vector, const char* url)
index 50089c9d4d610dff397c52f6f14497a2063c5761..35a84718eb05a65110620e00138f035106a4450d 100644 (file)
@@ -46,7 +46,9 @@
 #include "WebView.h"
 #include "WebViewImpl.h"
 #include <gtest/gtest.h>
-#include <webkit/support/webkit_support.h>
+#include <public/Platform.h>
+#include <public/WebThread.h>
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebKit;
 
@@ -61,7 +63,7 @@ public:
 
     virtual void TearDown()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
     }
 
 protected:
@@ -91,7 +93,7 @@ TEST_F(WebPluginContainerTest, WindowToLocalPointTest)
     webView->settings()->setPluginsEnabled(true);
     webView->resize(WebSize(300, 300));
     webView->layout();
-    webkit_support::RunAllPendingMessages();
+    FrameTestHelpers::runPendingTasks();
 
     WebPluginContainer* pluginContainerOne = getWebPluginContainer(webView, WebString::fromUTF8("translated-plugin"));
     ASSERT(pluginContainerOne);
index f08522f387d17635b39f72a7862814a91d244145..24fecf557f438ad49371f3f2cfe6da5fbd64fff2 100644 (file)
 #include "WebViewClient.h"
 #include "WebViewImpl.h"
 #include <gtest/gtest.h>
+#include <public/Platform.h>
 #include <public/WebSize.h>
-#include <webkit/support/webkit_support.h>
+#include <public/WebThread.h>
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebKit;
+using WebKit::FrameTestHelpers::runPendingTasks;
 using WebKit::URLTestHelpers::toKURL;
 
 namespace {
@@ -163,7 +166,7 @@ public:
 
     virtual void TearDown()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
     }
 
 protected:
@@ -569,7 +572,7 @@ static bool tapElementById(WebView* webView, WebInputEvent::Type type, const Web
     event.y = center.y();
 
     webView->handleInputEvent(event);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     return true;
 }
 
@@ -581,7 +584,7 @@ TEST_F(WebViewTest, DetectContentAroundPosition)
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_listeners.html", true, 0, &client);
     webView->resize(WebSize(500, 300));
     webView->layout();
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     WebString clickListener = WebString::fromUTF8("clickListener");
     WebString touchstartListener = WebString::fromUTF8("touchstartListener");
@@ -618,7 +621,7 @@ TEST_F(WebViewTest, DetectContentAroundPosition)
     WebGestureEvent event;
     event.type = WebInputEvent::GestureTap;
     webView->handleInputEvent(event);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_TRUE(client.pendingIntentsCancelled());
     webView->close();
 }
@@ -633,7 +636,7 @@ TEST_F(WebViewTest, ClientTapHandling)
     event.x = 3;
     event.y = 8;
     webView->handleInputEvent(event);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_EQ(3, client.tapX());
     EXPECT_EQ(8, client.tapY());
     client.reset();
@@ -641,7 +644,7 @@ TEST_F(WebViewTest, ClientTapHandling)
     event.x = 25;
     event.y = 7;
     webView->handleInputEvent(event);
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
     EXPECT_EQ(25, client.longpressX());
     EXPECT_EQ(7, client.longpressY());
     webView->close();
@@ -655,7 +658,7 @@ TEST_F(WebViewTest, LongPressSelection)
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "longpress_selection.html", true);
     webView->resize(WebSize(500, 300));
     webView->layout();
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     WebString target = WebString::fromUTF8("target");
     WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse");
@@ -675,7 +678,7 @@ TEST_F(WebViewTest, SelectionOnDisabledInput)
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "selection_disabled.html", true);
     webView->resize(WebSize(640, 480));
     webView->layout();
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     std::string testWord = "This text should be selected.";
 
@@ -699,7 +702,7 @@ TEST_F(WebViewTest, SelectionOnReadOnlyInput)
     WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "selection_readonly.html", true);
     webView->resize(WebSize(640, 480));
     webView->layout();
-    webkit_support::RunAllPendingMessages();
+    runPendingTasks();
 
     std::string testWord = "This text should be selected.";
 
index c24cb3a86553deaf5301627fa6f54ffb99536ed8..91d07c59811f29c0b80fc8be2ca13ad5214d58a0 100644 (file)
     .out-of-flow {
       position: absolute;
     }
+    .big {
+      margin: 200px;
+    }
   </style>
 </head>
 
 <body>
   <div class="scrollable box">
-    Scrolling content.
+    <span class="big">Scrolling content</span>
     <div class="out-of-flow box">Out-of-flow content.</div>
   </div>
 </body>