Changeset 142422 in webkit
- Timestamp:
- Feb 10, 2013 6:38:06 PM (11 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r142418 r142422 1 2013-02-10 James Robinson <jamesr@chromium.org> 2 3 [chromium] Enable more of webkit_unit_tests in component builds 4 https://bugs.webkit.org/show_bug.cgi?id=109369 5 6 Reviewed by Darin Fisher. 7 8 Updates all webkit_unit_tests (except for LevelDBTest) to go through the Platform API instead of directly 9 calling into webkit_support so they work in component builds. 10 11 * WebKit.gyp: 12 * tests/AssociatedURLLoaderTest.cpp: 13 * tests/EventListenerTest.cpp: 14 * tests/FrameTestHelpers.cpp: 15 (WebKit::FrameTestHelpers::createWebViewAndLoad): 16 (QuitTask): 17 (WebKit::FrameTestHelpers::QuitTask::run): 18 (FrameTestHelpers): 19 (WebKit::FrameTestHelpers::runPendingTasks): 20 * tests/FrameTestHelpers.h: 21 (FrameTestHelpers): 22 * tests/ListenerLeakTest.cpp: 23 * tests/PopupMenuTest.cpp: 24 * tests/PrerenderingTest.cpp: 25 * tests/ScrollingCoordinatorChromiumTest.cpp: 26 (WebKit::ScrollingCoordinatorChromiumTest::~ScrollingCoordinatorChromiumTest): 27 (WebKit::ScrollingCoordinatorChromiumTest::navigateTo): 28 * tests/URLTestHelpers.cpp: 29 (WebKit::URLTestHelpers::registerMockedURLLoad): 30 * tests/WebFrameTest.cpp: 31 * tests/WebImageTest.cpp: 32 (WebKit::readFile): 33 * tests/WebPageNewSerializerTest.cpp: 34 * tests/WebPageSerializerTest.cpp: 35 * tests/WebPluginContainerTest.cpp: 36 (WebKit::WebPluginContainerTest::TearDown): 37 (WebKit::TEST_F): 38 * tests/WebViewTest.cpp: 39 1 40 2013-02-10 Sheriff Bot <webkit.review.bot@gmail.com> 2 41 -
trunk/Source/WebKit/chromium/WebKit.gyp
r141943 r142422 654 654 # These tests depend on webkit_support and 655 655 # functions defined only in !WEBKIT_IMPLEMENTATION. 656 'tests/AssociatedURLLoaderTest.cpp',657 'tests/EventListenerTest.cpp',658 'tests/FakeWebPlugin.cpp',659 'tests/FrameTestHelpers.cpp',660 'tests/IDBBindingUtilitiesTest.cpp',661 'tests/IDBRequestTest.cpp',662 656 'tests/LevelDBTest.cpp', 663 'tests/ListenerLeakTest.cpp',664 'tests/LinkHighlightTest.cpp',665 'tests/PopupMenuTest.cpp',666 'tests/PrerenderingTest.cpp',667 'tests/RenderTableCellTest.cpp',668 'tests/RenderTableRowTest.cpp',669 'tests/ScrollingCoordinatorChromiumTest.cpp',670 'tests/URLTestHelpers.cpp',671 'tests/WebFrameTest.cpp',672 'tests/WebImageTest.cpp',673 'tests/WebPageNewSerializerTest.cpp',674 'tests/WebPageSerializerTest.cpp',675 'tests/WebPluginContainerTest.cpp',676 'tests/WebViewTest.cpp',677 657 ], 678 658 'conditions': [ -
trunk/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
r138798 r142422 36 36 #include "WebURLLoaderOptions.h" 37 37 #include "WebView.h" 38 #include <public/Platform.h> 38 39 #include <public/WebString.h> 40 #include <public/WebThread.h> 39 41 #include <public/WebURL.h> 40 42 #include <public/WebURLLoader.h> … … 42 44 #include <public/WebURLRequest.h> 43 45 #include <public/WebURLResponse.h> 46 #include <public/WebUnitTestSupport.h> 44 47 #include <wtf/text/WTFString.h> 45 48 46 49 #include <gtest/gtest.h> 47 #include <webkit/support/webkit_support.h>48 50 49 51 using namespace WebKit; … … 78 80 { 79 81 // Reuse one of the test files from WebFrameTest. 80 std::string filePath = std::string( webkit_support::GetWebKitRootDir().utf8().data());82 std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data()); 81 83 filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html"; 82 84 m_frameFilePath = WebString::fromUTF8(filePath.c_str()); … … 93 95 response.initialize(); 94 96 response.setMIMEType("text/html"); 95 webkit_support::RegisterMockedURL(url, response, m_frameFilePath);97 Platform::current()->unitTestSupport()->registerMockedURL(url, response, m_frameFilePath); 96 98 97 99 WebURLRequest request; … … 101 103 serveRequests(); 102 104 103 webkit_support::UnregisterMockedURL(url);105 Platform::current()->unitTestSupport()->unregisterMockedURL(url); 104 106 } 105 107 106 108 void TearDown() 107 109 { 108 webkit_support::UnregisterAllMockedURLs();110 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 109 111 m_webView->close(); 110 112 } … … 112 114 void serveRequests() 113 115 { 114 webkit_support::ServeAsynchronousMockedRequests();116 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 115 117 } 116 118 … … 178 180 if (m_runningMessageLoop) { 179 181 m_runningMessageLoop = false; 180 webkit_support::QuitMessageLoop();182 Platform::current()->currentThread()->exitRunLoop(); 181 183 } 182 184 } … … 219 221 // Allow the loader to return the error. 220 222 m_runningMessageLoop = true; 221 webkit_support::RunMessageLoop();223 Platform::current()->currentThread()->enterRunLoop(); 222 224 EXPECT_TRUE(m_didFail); 223 225 EXPECT_FALSE(m_didReceiveResponse); … … 245 247 m_expectedResponse.addHTTPHeaderField("access-control-expose-headers", headerNameString); 246 248 m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); 247 webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);249 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath); 248 250 249 251 WebURLLoaderOptions options; … … 292 294 m_expectedResponse.initialize(); 293 295 m_expectedResponse.setMIMEType("text/html"); 294 webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);296 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath); 295 297 296 298 m_expectedLoader = createAssociatedURLLoader(); … … 326 328 m_expectedResponse.initialize(); 327 329 m_expectedResponse.setMIMEType("text/html"); 328 webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);330 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath); 329 331 330 332 WebURLLoaderOptions options; … … 352 354 m_expectedResponse.setMIMEType("text/html"); 353 355 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); 354 webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);356 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath); 355 357 356 358 WebURLLoaderOptions options; … … 378 380 m_expectedResponse.setMIMEType("text/html"); 379 381 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); 380 webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);382 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath); 381 383 382 384 WebURLLoaderOptions options; … … 413 415 m_expectedRedirectResponse.setHTTPStatusCode(301); 414 416 m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect); 415 webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);417 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath); 416 418 417 419 m_expectedNewRequest = WebURLRequest(); … … 422 424 m_expectedResponse.initialize(); 423 425 m_expectedResponse.setMIMEType("text/html"); 424 webkit_support::RegisterMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);426 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_expectedResponse, m_frameFilePath); 425 427 426 428 m_expectedLoader = createAssociatedURLLoader(); … … 451 453 m_expectedRedirectResponse.setHTTPStatusCode(301); 452 454 m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect); 453 webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);455 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath); 454 456 455 457 WebURLLoaderOptions options; … … 484 486 m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect); 485 487 m_expectedRedirectResponse.addHTTPHeaderField("access-control-allow-origin", "*"); 486 webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);488 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRedirectResponse, m_frameFilePath); 487 489 488 490 m_expectedNewRequest = WebURLRequest(); … … 494 496 m_expectedResponse.setMIMEType("text/html"); 495 497 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); 496 webkit_support::RegisterMockedURL(redirectURL, m_expectedResponse, m_frameFilePath);498 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_expectedResponse, m_frameFilePath); 497 499 498 500 WebURLLoaderOptions options; … … 601 603 m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*"); 602 604 m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); 603 webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);605 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedResponse, m_frameFilePath); 604 606 605 607 WebURLLoaderOptions options; -
trunk/Source/WebKit/chromium/tests/EventListenerTest.cpp
r122344 r142422 42 42 #include "WebView.h" 43 43 #include <gtest/gtest.h> 44 #include <webkit/support/webkit_support.h> 44 #include <public/Platform.h> 45 #include <public/WebUnitTestSupport.h> 45 46 46 47 using namespace WebKit; … … 87 88 { 88 89 m_webView->close(); 89 webkit_support::UnregisterAllMockedURLs();90 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 90 91 } 91 92 -
trunk/Source/WebKit/chromium/tests/FrameTestHelpers.cpp
r138798 r142422 39 39 #include "WebView.h" 40 40 #include "WebViewClient.h" 41 #include <public/Platform.h> 41 42 #include <public/WebString.h> 43 #include <public/WebThread.h> 42 44 #include <public/WebURLRequest.h> 43 45 #include <public/WebURLResponse.h> 44 #include < webkit/support/webkit_support.h>46 #include <public/WebUnitTestSupport.h> 45 47 46 48 namespace WebKit { … … 92 94 93 95 loadFrame(webView->mainFrame(), url); 94 webkit_support::ServeAsynchronousMockedRequests();96 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 95 97 96 98 return webView; 97 99 } 98 100 101 class QuitTask : public WebThread::Task { 102 public: 103 virtual void run() 104 { 105 Platform::current()->currentThread()->exitRunLoop(); 106 } 107 }; 108 109 void runPendingTasks() 110 { 111 Platform::current()->currentThread()->postTask(new QuitTask); 112 Platform::current()->currentThread()->enterRunLoop(); 113 } 114 99 115 } // namespace FrameTestHelpers 100 116 } // namespace WebKit -
trunk/Source/WebKit/chromium/tests/FrameTestHelpers.h
r137045 r142422 33 33 34 34 #include <string> 35 #include <wtf/PassOwnPtr.h> 35 36 36 37 namespace WebKit { … … 48 49 WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0); 49 50 51 void runPendingTasks(); 52 50 53 } // namespace FrameTestHelpers 51 54 } // namespace WebKit -
trunk/Source/WebKit/chromium/tests/ListenerLeakTest.cpp
r122344 r142422 35 35 #include "WebView.h" 36 36 #include <gtest/gtest.h> 37 #include <public/Platform.h> 38 #include <public/WebUnitTestSupport.h> 37 39 #include <v8/include/v8-profiler.h> 38 40 #include <v8/include/v8.h> 39 #include <webkit/support/webkit_support.h>40 41 41 42 using namespace WebKit; … … 100 101 if (m_webView) 101 102 m_webView->close(); 102 webkit_support::UnregisterAllMockedURLs();103 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 103 104 } 104 105 -
trunk/Source/WebKit/chromium/tests/PopupMenuTest.cpp
r138798 r142422 31 31 #include "config.h" 32 32 33 #include <gtest/gtest.h>34 #include <webkit/support/webkit_support.h>35 36 33 #include "Color.h" 37 34 #include "Element.h" … … 41 38 #include "PopupContainer.h" 42 39 #include "PopupMenu.h" 40 #include "PopupMenuChromium.h" 43 41 #include "PopupMenuClient.h" 44 #include "PopupMenuChromium.h"45 42 #include "RuntimeEnabledFeatures.h" 46 43 #include "URLTestHelpers.h" … … 58 55 #include "WebViewImpl.h" 59 56 #include "v8.h" 57 #include <gtest/gtest.h> 58 #include <public/Platform.h> 60 59 #include <public/WebString.h> 61 60 #include <public/WebURL.h> 62 61 #include <public/WebURLRequest.h> 63 62 #include <public/WebURLResponse.h> 63 #include <public/WebUnitTestSupport.h> 64 64 65 65 using namespace WebCore; … … 194 194 m_popupMenu = 0; 195 195 m_webView->close(); 196 webkit_support::UnregisterAllMockedURLs();196 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 197 197 } 198 198 … … 257 257 void serveRequests() 258 258 { 259 webkit_support::ServeAsynchronousMockedRequests();259 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 260 260 } 261 261 -
trunk/Source/WebKit/chromium/tests/PrerenderingTest.cpp
r138173 r142422 46 46 #include <gtest/gtest.h> 47 47 #include <list> 48 #include <public/Platform.h> 48 49 #include <public/WebPrerender.h> 49 50 #include <public/WebPrerenderingSupport.h> 50 51 #include <public/WebString.h> 51 #include < webkit/support/webkit_support.h>52 #include <public/WebUnitTestSupport.h> 52 53 #include <wtf/OwnPtr.h> 53 54 … … 182 183 ~PrerenderingTest() 183 184 { 184 webkit_support::UnregisterAllMockedURLs();185 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 185 186 if (m_webView) 186 187 close(); … … 196 197 197 198 FrameTestHelpers::loadFrame(m_webView->mainFrame(), std::string(baseURL) + fileName); 198 webkit_support::ServeAsynchronousMockedRequests();199 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 199 200 } 200 201 … … 202 203 { 203 204 FrameTestHelpers::loadFrame(m_webView->mainFrame(), "about:blank"); 204 // webkit_support::RunAllPendingMessages();205 205 } 206 206 -
trunk/Source/WebKit/chromium/tests/ScrollingCoordinatorChromiumTest.cpp
r141769 r142422 29 29 #include "CompositorFakeWebGraphicsContext3D.h" 30 30 #include "FrameTestHelpers.h" 31 #include "GraphicsLayerChromium.h" 31 32 #include "RenderLayerBacking.h" 32 33 #include "RenderLayerCompositor.h" … … 40 41 #include "WebViewImpl.h" 41 42 #include <gtest/gtest.h> 43 #include <public/Platform.h> 42 44 #include <public/WebCompositorSupport.h> 43 45 #include <public/WebLayer.h> 44 #include <webkit/support/webkit_support.h> 45 46 #include "GraphicsLayerChromium.h" 46 #include <public/WebUnitTestSupport.h> 47 47 48 48 using namespace WebCore; … … 98 98 virtual ~ScrollingCoordinatorChromiumTest() 99 99 { 100 webkit_support::UnregisterAllMockedURLs();100 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 101 101 m_webViewImpl->close(); 102 102 … … 107 107 { 108 108 FrameTestHelpers::loadFrame(m_webViewImpl->mainFrame(), url); 109 webkit_support::ServeAsynchronousMockedRequests();109 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 110 110 } 111 111 -
trunk/Source/WebKit/chromium/tests/URLTestHelpers.cpp
r138798 r142422 32 32 #include "URLTestHelpers.h" 33 33 34 #include <public/Platform.h> 34 35 #include <public/WebString.h> 35 36 #include <public/WebURL.h> 36 37 #include <public/WebURLResponse.h> 37 #include < webkit/support/webkit_support.h>38 #include <public/WebUnitTestSupport.h> 38 39 39 40 namespace WebKit { … … 60 61 61 62 // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName. 62 std::string filePath = std::string( webkit_support::GetWebKitRootDir().utf8().data());63 std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data()); 63 64 filePath.append("/Source/WebKit/chromium/tests/data/"); 64 65 filePath.append(std::string(relativeBaseDirectory.utf8().data())); 65 66 filePath.append(std::string(fileName.utf8().data())); 66 67 67 webkit_support::RegisterMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str()));68 Platform::current()->unitTestSupport()->registerMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str())); 68 69 } 69 70 -
trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp
r142250 r142422 62 62 #include "v8.h" 63 63 #include <gtest/gtest.h> 64 #include <public/Platform.h> 64 65 #include <public/WebFloatRect.h> 66 #include <public/WebThread.h> 65 67 #include <public/WebURLResponse.h> 66 #include < webkit/support/webkit_support.h>68 #include <public/WebUnitTestSupport.h> 67 69 #include <wtf/Forward.h> 68 70 … … 71 73 using WebCore::Range; 72 74 using WebKit::URLTestHelpers::toKURL; 75 using WebKit::FrameTestHelpers::runPendingTasks; 73 76 74 77 namespace { … … 83 86 public: 84 87 WebFrameTest() 85 : m_baseURL("http://www.test.com/"), 86 m_chromeURL("chrome://") 87 { 88 : m_baseURL("http://www.test.com/") 89 , m_chromeURL("chrome://") 90 , m_webView(0) 91 { 92 } 93 94 virtual ~WebFrameTest() 95 { 96 if (m_webView) 97 m_webView->close(); 88 98 } 89 99 90 100 virtual void TearDown() 91 101 { 92 webkit_support::UnregisterAllMockedURLs();102 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 93 103 } 94 104 … … 106 116 std::string m_baseURL; 107 117 std::string m_chromeURL; 118 119 WebView* m_webView; 108 120 }; 109 121 … … 115 127 registerMockedHttpURLLoad("zero_sized_iframe.html"); 116 128 117 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html");129 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html"); 118 130 119 131 // Now retrieve the frames text and test it only includes visible elements. 120 std::string content = std::string( webView->mainFrame()->contentAsText(1024).utf8().data());132 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data()); 121 133 EXPECT_NE(std::string::npos, content.find(" visible paragraph")); 122 134 EXPECT_NE(std::string::npos, content.find(" visible iframe")); … … 124 136 EXPECT_EQ(std::string::npos, content.find(" invisible iframe")); 125 137 EXPECT_EQ(std::string::npos, content.find("iframe with zero size")); 126 127 webView->close();128 138 } 129 139 … … 135 145 registerMockedHttpURLLoad("zero_sized_iframe.html"); 136 146 137 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true);147 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true); 138 148 139 149 v8::HandleScope scope; 140 EXPECT_EQ( webView->mainFrame(),150 EXPECT_EQ(m_webView->mainFrame(), 141 151 WebFrame::frameForContext( 142 webView->mainFrame()->mainWorldScriptContext()));143 EXPECT_EQ( webView->mainFrame()->firstChild(),152 m_webView->mainFrame()->mainWorldScriptContext())); 153 EXPECT_EQ(m_webView->mainFrame()->firstChild(), 144 154 WebFrame::frameForContext( 145 webView->mainFrame()->firstChild()->mainWorldScriptContext())); 146 147 webView->close(); 155 m_webView->mainFrame()->firstChild()->mainWorldScriptContext())); 148 156 } 149 157 … … 152 160 registerMockedHttpURLLoad("form.html"); 153 161 154 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html");162 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html"); 155 163 156 164 WebVector<WebFormElement> forms; 157 webView->mainFrame()->document().forms(forms); 158 webView->close(); 165 m_webView->mainFrame()->document().forms(forms); 166 m_webView->close(); 167 m_webView = 0; 159 168 160 169 EXPECT_EQ(forms.size(), 1U); … … 169 178 170 179 // Pass true to enable JavaScript. 171 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);180 m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); 172 181 173 182 // Try to run JS against the chrome-style URL. 174 FrameTestHelpers::loadFrame( webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");183 FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); 175 184 176 185 // Required to see any updates in contentAsText. 177 webView->layout();186 m_webView->layout(); 178 187 179 188 // Now retrieve the frame's text and ensure it was modified by running javascript. 180 std::string content = std::string( webView->mainFrame()->contentAsText(1024).utf8().data());189 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data()); 181 190 EXPECT_NE(std::string::npos, content.find("Clobbered")); 182 191 } … … 187 196 188 197 /// Pass true to enable JavaScript. 189 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);198 m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); 190 199 191 200 // Try to run JS against the chrome-style URL after prohibiting it. 192 201 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome"); 193 FrameTestHelpers::loadFrame( webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");202 FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); 194 203 195 204 // Required to see any updates in contentAsText. 196 webView->layout();205 m_webView->layout(); 197 206 198 207 // Now retrieve the frame's text and ensure it wasn't modified by running javascript. 199 std::string content = std::string( webView->mainFrame()->contentAsText(1024).utf8().data());208 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data()); 200 209 EXPECT_EQ(std::string::npos, content.find("Clobbered")); 201 210 } … … 206 215 207 216 // Pass true to enable JavaScript. 208 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true);217 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true); 209 218 210 219 // Send a message with the correct origin. 211 220 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL))); 212 WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent");221 WebDOMEvent event = m_webView->mainFrame()->document().createEvent("MessageEvent"); 213 222 WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); 214 223 WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); 215 224 message.initMessageEvent("message", false, false, data, "http://origin.com", 0, ""); 216 webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message);225 m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message); 217 226 218 227 // Send another message with incorrect origin. 219 228 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL))); 220 webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message);229 m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message); 221 230 222 231 // Required to see any updates in contentAsText. 223 webView->layout();232 m_webView->layout(); 224 233 225 234 // Verify that only the first addition is in the body of the page. 226 std::string content = std::string( webView->mainFrame()->contentAsText(1024).utf8().data());235 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024).utf8().data()); 227 236 EXPECT_NE(std::string::npos, content.find("Message 1.")); 228 237 EXPECT_EQ(std::string::npos, content.find("Message 2.")); … … 248 257 // Make sure we initialize to minimum scale, even if the window size 249 258 // only becomes available after the load begins. 250 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client)); 251 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true); 252 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true); 253 webViewImpl->enableFixedLayoutMode(true); 254 webViewImpl->settings()->setViewportEnabled(true); 255 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 256 webViewImpl->layout(); 257 259 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); 260 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 261 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 262 m_webView->enableFixedLayoutMode(true); 263 m_webView->settings()->setViewportEnabled(true); 264 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 265 m_webView->layout(); 266 267 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 258 268 webViewImpl->mainFrameImpl()->frameView()->setFixedLayoutSize(WebCore::IntSize(100, 100)); 259 269 EXPECT_TRUE(webViewImpl->mainFrameImpl()->frameView()->needsLayout()); … … 276 286 client.m_screenInfo.deviceScaleFactor = 2; 277 287 278 WebView* webView = static_cast<WebView*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client));279 280 webView->settings()->setApplyDeviceScaleFactorInCompositor(true);281 webView->settings()->setApplyPageScaleFactorInCompositor(true);282 webView->settings()->setViewportEnabled(true);283 webView->enableFixedLayoutMode(true);284 webView->resize(WebSize(viewportWidth, viewportHeight));285 webView->layout();286 287 EXPECT_EQ(2, webView->deviceScaleFactor());288 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client); 289 290 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 291 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 292 m_webView->settings()->setViewportEnabled(true); 293 m_webView->enableFixedLayoutMode(true); 294 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 295 m_webView->layout(); 296 297 EXPECT_EQ(2, m_webView->deviceScaleFactor()); 288 298 289 299 // Device scale factor should be independent of page scale. 290 webView->setPageScaleFactorLimits(1, 2);291 webView->setPageScaleFactorPreservingScrollOffset(0.5);292 webView->layout();293 EXPECT_EQ(1, webView->pageScaleFactor());300 m_webView->setPageScaleFactorLimits(1, 2); 301 m_webView->setPageScaleFactorPreservingScrollOffset(0.5); 302 m_webView->layout(); 303 EXPECT_EQ(1, m_webView->pageScaleFactor()); 294 304 295 305 // Force the layout to happen before leaving the test. 296 webView->mainFrame()->contentAsText(1024).utf8();306 m_webView->mainFrame()->contentAsText(1024).utf8(); 297 307 } 298 308 … … 308 318 // Make sure we initialize to minimum scale, even if the window size 309 319 // only becomes available after the load begins. 310 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));311 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);312 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);313 webViewImpl->enableFixedLayoutMode(true);314 webViewImpl->settings()->setViewportEnabled(true);315 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));320 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); 321 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 322 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 323 m_webView->enableFixedLayoutMode(true); 324 m_webView->settings()->setViewportEnabled(true); 325 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 316 326 317 327 int defaultFixedLayoutWidth = 980; 318 328 float minimumPageScaleFactor = viewportWidth / (float) defaultFixedLayoutWidth; 319 EXPECT_EQ(minimumPageScaleFactor, webViewImpl->pageScaleFactor());329 EXPECT_EQ(minimumPageScaleFactor, m_webView->pageScaleFactor()); 320 330 321 331 // Assume the user has pinch zoomed to page scale factor 2. 322 332 float userPinchPageScaleFactor = 2; 323 webViewImpl->setPageScaleFactorPreservingScrollOffset(userPinchPageScaleFactor);324 webViewImpl->mainFrameImpl()->frameView()->layout();333 m_webView->setPageScaleFactorPreservingScrollOffset(userPinchPageScaleFactor); 334 m_webView->layout(); 325 335 326 336 // Make sure we don't reset to initial scale if the page continues to load. 327 337 bool isNewNavigation; 328 webViewImpl->didCommitLoad(&isNewNavigation, false); 329 webViewImpl->didChangeContentsSize(); 330 EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor()); 338 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 339 webViewImpl ->didCommitLoad(&isNewNavigation, false); 340 webViewImpl ->didChangeContentsSize(); 341 EXPECT_EQ(userPinchPageScaleFactor, m_webView->pageScaleFactor()); 331 342 332 343 // Make sure we don't reset to initial scale if the viewport size changes. 333 webViewImpl->resize(WebSize(viewportWidth, viewportHeight + 100));334 EXPECT_EQ(userPinchPageScaleFactor, webViewImpl->pageScaleFactor());344 m_webView->resize(WebSize(viewportWidth, viewportHeight + 100)); 345 EXPECT_EQ(userPinchPageScaleFactor, m_webView->pageScaleFactor()); 335 346 } 336 347 … … 344 355 int viewportHeight = 1057; 345 356 346 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscillate.html", true, 0, &client));347 webViewImpl->enableFixedLayoutMode(true);348 webViewImpl->settings()->setViewportEnabled(true);349 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));350 webViewImpl->layout();357 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "scale_oscillate.html", true, 0, &client); 358 m_webView->enableFixedLayoutMode(true); 359 m_webView->settings()->setViewportEnabled(true); 360 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 361 m_webView->layout(); 351 362 } 352 363 … … 360 371 int viewportHeight = 480; 361 372 362 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client)); 363 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true); 364 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true); 365 webViewImpl->enableFixedLayoutMode(true); 366 webViewImpl->settings()->setViewportEnabled(true); 367 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 368 webViewImpl->layout(); 369 373 m_webView = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client)); 374 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 375 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 376 m_webView->enableFixedLayoutMode(true); 377 m_webView->settings()->setViewportEnabled(true); 378 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 379 m_webView->layout(); 380 381 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 370 382 int prevLayoutCount = webViewImpl->mainFrameImpl()->frameView()->layoutCount(); 371 383 webViewImpl->setPageScaleFactor(3, WebPoint()); … … 383 395 int viewportHeight = 480; 384 396 385 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client)); 386 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true); 387 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true); 388 webViewImpl->enableFixedLayoutMode(true); 389 webViewImpl->settings()->setViewportEnabled(true); 390 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 391 webViewImpl->layout(); 392 393 webViewImpl->setPageScaleFactor(3, WebPoint()); 397 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); 398 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 399 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 400 m_webView->enableFixedLayoutMode(true); 401 m_webView->settings()->setViewportEnabled(true); 402 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 403 m_webView->layout(); 404 405 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 406 m_webView->setPageScaleFactor(3, WebPoint()); 394 407 webViewImpl->page()->mainFrame()->loader()->history()->saveDocumentAndScrollState(); 395 webViewImpl->setPageScaleFactor(1, WebPoint());408 m_webView->setPageScaleFactor(1, WebPoint()); 396 409 webViewImpl->page()->mainFrame()->loader()->history()->restoreScrollPositionAndViewState(); 397 EXPECT_EQ(3, webViewImpl->pageScaleFactor());410 EXPECT_EQ(3, m_webView->pageScaleFactor()); 398 411 } 399 412 … … 407 420 int viewportHeight = 480; 408 421 409 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));410 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);411 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);412 webViewImpl->enableFixedLayoutMode(true);413 webViewImpl->settings()->setViewportEnabled(true);414 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));415 webViewImpl->layout();416 417 WebCore::FrameView* view = webViewImpl->mainFrameImpl()->frameView();422 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); 423 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 424 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 425 m_webView->enableFixedLayoutMode(true); 426 m_webView->settings()->setViewportEnabled(true); 427 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 428 m_webView->layout(); 429 430 WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameImpl()->frameView(); 418 431 int viewportWidthMinusScrollbar = 640 - (view->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15); 419 432 int viewportHeightMinusScrollbar = 480 - (view->horizontalScrollbar()->isOverlayScrollbar() ? 0 : 15); 420 433 421 webViewImpl->setPageScaleFactor(2, WebPoint());434 m_webView->setPageScaleFactor(2, WebPoint()); 422 435 423 436 WebCore::IntSize unscaledSize = view->unscaledVisibleContentSize(true); … … 443 456 int viewportHeight = 480; 444 457 445 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client)); 446 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true); 447 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true); 448 webViewImpl->enableFixedLayoutMode(true); 449 webViewImpl->settings()->setViewportEnabled(true); 450 webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); 451 webViewImpl->layout(); 452 453 webViewImpl->setPageScaleFactor(2, WebPoint()); 454 458 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); 459 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 460 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 461 m_webView->enableFixedLayoutMode(true); 462 m_webView->settings()->setViewportEnabled(true); 463 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 464 m_webView->layout(); 465 466 m_webView->setPageScaleFactor(2, WebPoint()); 467 468 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 455 469 EXPECT_EQ(1, webViewImpl->page()->mainFrame()->frameScaleFactor()); 456 470 EXPECT_EQ(980, webViewImpl->page()->mainFrame()->contentRenderer()->unscaledDocumentRect().width()); … … 468 482 int viewportHeight = 50; 469 483 470 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client));471 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);472 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);473 webViewImpl->enableFixedLayoutMode(true);474 webViewImpl->settings()->setViewportEnabled(true);475 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));476 webViewImpl->layout();484 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "fixed_layout.html", true, 0, &client); 485 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 486 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 487 m_webView->enableFixedLayoutMode(true); 488 m_webView->settings()->setViewportEnabled(true); 489 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 490 m_webView->layout(); 477 491 478 492 // Set <1 page scale so that the clip rect should be larger than 479 493 // the viewport size as passed into resize(). 480 webViewImpl->setPageScaleFactor(0.5, WebPoint());494 m_webView->setPageScaleFactor(0.5, WebPoint()); 481 495 482 496 SkBitmap bitmap; … … 492 506 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect()); 493 507 494 WebCore::FrameView* view = webViewImpl->mainFrameImpl()->frameView();508 WebCore::FrameView* view = static_cast<WebViewImpl*>(m_webView)->mainFrameImpl()->frameView(); 495 509 WebCore::IntRect paintRect(0, 0, 200, 200); 496 510 view->paint(&context, paintRect); … … 511 525 int viewportHeight = 480; 512 526 513 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client));514 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);515 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);516 webViewImpl->enableFixedLayoutMode(true);517 webViewImpl->settings()->setViewportEnabled(true);518 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));519 520 EXPECT_EQ(1.0f, webViewImpl->maximumPageScaleFactor());521 522 webViewImpl->setIgnoreViewportTagMaximumScale(true);523 webViewImpl->layout();524 525 EXPECT_EQ(4.0f, webViewImpl->maximumPageScaleFactor());527 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client); 528 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 529 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 530 m_webView->enableFixedLayoutMode(true); 531 m_webView->settings()->setViewportEnabled(true); 532 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 533 534 EXPECT_EQ(1.0f, m_webView->maximumPageScaleFactor()); 535 536 m_webView->setIgnoreViewportTagMaximumScale(true); 537 m_webView->layout(); 538 539 EXPECT_EQ(4.0f, m_webView->maximumPageScaleFactor()); 526 540 } 527 541 … … 540 554 int viewportWidth = 640 / deviceScaleFactor; 541 555 int viewportHeight = 1280 / deviceScaleFactor; 542 WebKit::WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html"); //543 webView->settings()->setApplyDeviceScaleFactorInCompositor(true);544 webView->settings()->setApplyPageScaleFactorInCompositor(true);545 webView->setDeviceScaleFactor(deviceScaleFactor);546 webView->setPageScaleFactorLimits(0.01f, 4);547 webView->setPageScaleFactor(0.5f, WebPoint(0, 0));548 webView->resize(WebSize(viewportWidth, viewportHeight));549 webView->enableFixedLayoutMode(true);550 webView->layout();556 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html"); // 557 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 558 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 559 m_webView->setDeviceScaleFactor(deviceScaleFactor); 560 m_webView->setPageScaleFactorLimits(0.01f, 4); 561 m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0)); 562 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 563 m_webView->enableFixedLayoutMode(true); 564 m_webView->layout(); 551 565 552 566 WebRect wideDiv(200, 100, 400, 150); … … 558 572 bool isAnchor; 559 573 560 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>( webView);574 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 561 575 // Test double-tap zooming into wide div. 562 576 webViewImpl->computeScaleAndScrollForHitRect(doubleTapPointWide, WebViewImpl::DoubleTap, scale, scroll, isAnchor); … … 606 620 int viewportHeight = 1280 / deviceScaleFactor; 607 621 float doubleTapZoomAlreadyLegibleRatio = 1.2f; 608 WebKit::WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html");609 webView->settings()->setApplyDeviceScaleFactorInCompositor(true);610 webView->settings()->setApplyPageScaleFactorInCompositor(true);611 webView->enableFixedLayoutMode(true);612 webView->resize(WebSize(viewportWidth, viewportHeight));613 webView->setPageScaleFactorLimits(0.5f, 4);614 webView->setDeviceScaleFactor(deviceScaleFactor);615 webView->setPageScaleFactor(0.5f, WebPoint(0, 0));616 webView->layout();617 618 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>( webView);622 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_multiple_divs_for_auto_zoom_test.html"); 623 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 624 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 625 m_webView->enableFixedLayoutMode(true); 626 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 627 m_webView->setPageScaleFactorLimits(0.5f, 4); 628 m_webView->setDeviceScaleFactor(deviceScaleFactor); 629 m_webView->setPageScaleFactor(0.5f, WebPoint(0, 0)); 630 m_webView->layout(); 631 632 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 619 633 webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true); 620 634 … … 648 662 int viewportHeight = 480; 649 663 float doubleTapZoomAlreadyLegibleRatio = 1.2f; 650 WebKit::WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");651 webView->settings()->setApplyDeviceScaleFactorInCompositor(true);652 webView->settings()->setApplyPageScaleFactorInCompositor(true);653 webView->enableFixedLayoutMode(true);654 webView->resize(WebSize(viewportWidth, viewportHeight));655 webView->setDeviceScaleFactor(1.5f);656 webView->layout();657 658 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>( webView);664 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html"); 665 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 666 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 667 m_webView->enableFixedLayoutMode(true); 668 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 669 m_webView->setDeviceScaleFactor(1.5f); 670 m_webView->layout(); 671 672 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 659 673 webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true); 660 674 … … 665 679 // Test double tap scale bounds. 666 680 // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1 667 webView->setPageScaleFactorLimits(0.5f, 4);668 webView->layout();681 m_webView->setPageScaleFactorLimits(0.5f, 4); 682 m_webView->layout(); 669 683 float doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 670 684 setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); … … 679 693 webViewImpl->applyScrollAndScale(WebSize(), 1.1f); 680 694 // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale 681 webView->setPageScaleFactorLimits(1.1f, 4);682 webView->layout();695 m_webView->setPageScaleFactorLimits(1.1f, 4); 696 m_webView->layout(); 683 697 doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 684 698 setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); … … 693 707 webViewImpl->applyScrollAndScale(WebSize(), 1.1f); 694 708 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale 695 webView->setPageScaleFactorLimits(0.95f, 4);696 webView->layout();709 m_webView->setPageScaleFactorLimits(0.95f, 4); 710 m_webView->layout(); 697 711 doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 698 712 setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); … … 714 728 float doubleTapZoomAlreadyLegibleRatio = 1.2f; 715 729 float textAutosizingFontScaleFactor = 1.13f; 716 WebKit::WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html");717 webView->settings()->setApplyDeviceScaleFactorInCompositor(true);718 webView->settings()->setApplyPageScaleFactorInCompositor(true);719 webView->enableFixedLayoutMode(true);720 webView->resize(WebSize(viewportWidth, viewportHeight));721 webView->layout();722 723 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>( webView);730 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_bounds_check_for_auto_zoom_test.html"); 731 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 732 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 733 m_webView->enableFixedLayoutMode(true); 734 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 735 m_webView->layout(); 736 737 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 724 738 webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true); 725 739 webViewImpl->page()->settings()->setTextAutosizingFontScaleFactor(textAutosizingFontScaleFactor); … … 734 748 setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); 735 749 float doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 736 webView->setPageScaleFactorLimits(0.5f, 4);737 webView->layout();750 m_webView->setPageScaleFactorLimits(0.5f, 4); 751 m_webView->layout(); 738 752 simulateDoubleTap(webViewImpl, doubleTapPoint, scale); 739 753 EXPECT_FLOAT_EQ(legibleScale, scale); … … 746 760 webViewImpl->applyScrollAndScale(WebSize(), 1.1f); 747 761 // 1 < textAutosizingFontScaleFactor < minimumPageScale < doubleTapZoomAlreadyLegibleScale 748 webView->setPageScaleFactorLimits(1.0f, 4);749 webView->layout();762 m_webView->setPageScaleFactorLimits(1.0f, 4); 763 m_webView->layout(); 750 764 doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 751 765 setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); … … 760 774 webViewImpl->applyScrollAndScale(WebSize(), 1.1f); 761 775 // minimumPageScale < 1 < textAutosizingFontScaleFactor < doubleTapZoomAlreadyLegibleScale 762 webView->setPageScaleFactorLimits(0.95f, 4);763 webView->layout();776 m_webView->setPageScaleFactorLimits(0.95f, 4); 777 m_webView->layout(); 764 778 doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 765 779 setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); … … 774 788 webViewImpl->applyScrollAndScale(WebSize(), 1.1f); 775 789 // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < textAutosizingFontScaleFactor 776 webView->setPageScaleFactorLimits(0.9f, 4);777 webView->layout();790 m_webView->setPageScaleFactorLimits(0.9f, 4); 791 m_webView->layout(); 778 792 doubleTapZoomAlreadyLegibleScale = webViewImpl->minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio; 779 793 setScaleAndScrollAndLayout(webViewImpl, WebPoint(0, 0), (webViewImpl->minimumPageScaleFactor()) * (1 + doubleTapZoomAlreadyLegibleRatio) / 2); … … 796 810 int caretPadding = 10; 797 811 float minReadableCaretHeight = 18.0f; 798 WebKit::WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html");799 webView->settings()->setApplyDeviceScaleFactorInCompositor(true);800 webView->settings()->setApplyPageScaleFactorInCompositor(true);801 webView->enableFixedLayoutMode(true);802 webView->resize(WebSize(viewportWidth, viewportHeight));803 webView->setPageScaleFactorLimits(1, 4);804 webView->layout();805 webView->setDeviceScaleFactor(1.5f);806 webView->settings()->setAutoZoomFocusedNodeToLegibleScale(true);807 808 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>( webView);812 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_zoom_into_editable_test.html"); 813 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 814 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 815 m_webView->enableFixedLayoutMode(true); 816 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 817 m_webView->setPageScaleFactorLimits(1, 4); 818 m_webView->layout(); 819 m_webView->setDeviceScaleFactor(1.5f); 820 m_webView->settings()->setAutoZoomFocusedNodeToLegibleScale(true); 821 822 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 809 823 webViewImpl->shouldUseAnimateDoubleTapTimeZeroForTesting(true); 810 824 … … 814 828 // Test scrolling the focused node 815 829 // The edit box is shorter and narrower than the viewport when legible. 816 webView->advanceFocus(false);830 m_webView->advanceFocus(false); 817 831 // Set the caret to the end of the input box. 818 webView->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000);819 setScaleAndScrollAndLayout( webView, WebPoint(0, 0), 1);832 m_webView->mainFrame()->document().getElementById("EditBoxWithText").to<WebInputElement>().setSelectionRange(1000, 1000); 833 setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1); 820 834 WebRect rect, caret; 821 835 webViewImpl->selectionBounds(caret, rect); … … 836 850 viewportWidth = 200; 837 851 viewportHeight = 150; 838 webView->resize(WebSize(viewportWidth, viewportHeight));839 setScaleAndScrollAndLayout( webView, WebPoint(0, 0), 1);852 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 853 setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1); 840 854 webViewImpl->selectionBounds(caret, rect); 841 855 webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation); … … 846 860 EXPECT_NEAR(minReadableCaretHeight / caret.height, scale, 0.1); 847 861 848 setScaleAndScrollAndLayout( webView, WebPoint(0, 0), 1);862 setScaleAndScrollAndLayout(m_webView, WebPoint(0, 0), 1); 849 863 // Move focus to edit box with text. 850 webView->advanceFocus(false);864 m_webView->advanceFocus(false); 851 865 webViewImpl->selectionBounds(caret, rect); 852 866 webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation); … … 862 876 863 877 // Move focus back to the first edit box. 864 webView->advanceFocus(true);878 m_webView->advanceFocus(true); 865 879 webViewImpl->computeScaleAndScrollForFocusedNode(webViewImpl->focusedWebCoreNode(), scale, scroll, needAnimation); 866 880 // The position should have stayed the same since this box was already on screen with the right scale. … … 901 915 902 916 TestReloadDoesntRedirectWebFrameClient webFrameClient; 903 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient);904 905 webView->mainFrame()->reload(true);917 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient); 918 919 m_webView->mainFrame()->reload(true); 906 920 // start reload before request is delivered. 907 webView->mainFrame()->reload(true); 908 webkit_support::ServeAsynchronousMockedRequests(); 921 m_webView->mainFrame()->reload(true); 922 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 923 924 m_webView->close(); 925 m_webView = 0; 909 926 } 910 927 … … 922 939 registerMockedHttpURLLoad(thirdURL); 923 940 924 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + firstURL, true)); 941 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + firstURL, true); 942 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(m_webView); 925 943 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 926 944 webViewImpl->mainFrame()->setScrollOffset(WebSize(pageWidth / 4, pageHeight / 4)); … … 932 950 // Reload the page using the cache. 933 951 webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false); 934 webkit_support::ServeAsynchronousMockedRequests();952 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 935 953 ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); 936 954 ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); … … 938 956 // Reload the page while ignoring the cache. 939 957 webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), true); 940 webkit_support::ServeAsynchronousMockedRequests();958 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 941 959 ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); 942 960 ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); … … 948 966 registerMockedHttpURLLoad("visible_iframe.html"); 949 967 950 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true); 951 webkit_support::RunAllPendingMessages(); // Queue the iframe. 952 webkit_support::ServeAsynchronousMockedRequests(); // Load the iframe. 953 954 WebFrame* iframe = webView->findFrameByName(WebString::fromUTF8("ifr")); 968 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true); 969 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); // Load the iframe. 970 971 WebFrame* iframe = m_webView->findFrameByName(WebString::fromUTF8("ifr")); 955 972 ASSERT_TRUE(iframe); 956 973 WebDataSource* iframeDataSource = iframe->dataSource(); … … 961 978 EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data())); 962 979 EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data())); 963 964 webView->close();965 980 } 966 981 … … 970 985 registerMockedHttpURLLoad("autofocus_input_field_iframe.html"); 971 986 972 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true));987 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true); 973 988 974 989 // Clear the focused node. 975 webViewImpl->clearFocusedNode();990 m_webView->clearFocusedNode(); 976 991 977 992 // Now retrieve the FocusedNode and test it should be null. 978 EXPECT_EQ(0, webViewImpl->focusedWebCoreNode()); 979 980 webViewImpl->close(); 993 EXPECT_EQ(0, static_cast<WebViewImpl*>(m_webView)->focusedWebCoreNode()); 981 994 } 982 995 … … 1009 1022 }; 1010 1023 1011 ~ContextLifetimeTestWebFrameClient()1024 virtual ~ContextLifetimeTestWebFrameClient() 1012 1025 { 1013 1026 reset(); … … 1050 1063 // Load a frame with an iframe, make sure we get the right create notifications. 1051 1064 ContextLifetimeTestWebFrameClient webFrameClient; 1052 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);1053 1054 WebFrame* mainFrame = webView->mainFrame();1065 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 1066 1067 WebFrame* mainFrame = m_webView->mainFrame(); 1055 1068 WebFrame* childFrame = mainFrame->firstChild(); 1056 1069 … … 1070 1083 1071 1084 // Close the view. We should get two release notifications that are exactly the same as the create ones, in reverse order. 1072 webView->close(); 1085 m_webView->close(); 1086 m_webView = 0; 1073 1087 1074 1088 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); … … 1088 1102 1089 1103 ContextLifetimeTestWebFrameClient webFrameClient; 1090 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);1104 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 1091 1105 1092 1106 // Refresh, we should get two release notifications and two more create notifications. 1093 webView->mainFrame()->reload(false);1094 webkit_support::ServeAsynchronousMockedRequests();1107 m_webView->mainFrame()->reload(false); 1108 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 1095 1109 ASSERT_EQ(4u, webFrameClient.createNotifications.size()); 1096 1110 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); … … 1103 1117 1104 1118 // The last two create notifications should be for the current frames and context. 1105 WebFrame* mainFrame = webView->mainFrame();1119 WebFrame* mainFrame = m_webView->mainFrame(); 1106 1120 WebFrame* childFrame = mainFrame->firstChild(); 1107 1121 ContextLifetimeTestWebFrameClient::Notification* firstRefreshNotification = webFrameClient.createNotifications[2]; … … 1116 1130 EXPECT_EQ(0, secondRefreshNotification->worldId); 1117 1131 1118 webView->close(); 1132 m_webView->close(); 1133 m_webView = 0; 1119 1134 } 1120 1135 … … 1127 1142 1128 1143 ContextLifetimeTestWebFrameClient webFrameClient; 1129 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient);1144 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 1130 1145 1131 1146 // Add an isolated world. … … 1136 1151 int numSources = 1; 1137 1152 int extensionGroup = 0; 1138 webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scriptSource, numSources, extensionGroup);1153 m_webView->mainFrame()->executeScriptInIsolatedWorld(isolatedWorldId, &scriptSource, numSources, extensionGroup); 1139 1154 1140 1155 // We should now have a new create notification. … … 1142 1157 ContextLifetimeTestWebFrameClient::Notification* notification = webFrameClient.createNotifications[0]; 1143 1158 ASSERT_EQ(isolatedWorldId, notification->worldId); 1144 ASSERT_EQ( webView->mainFrame(), notification->frame);1159 ASSERT_EQ(m_webView->mainFrame(), notification->frame); 1145 1160 1146 1161 // We don't have an API to enumarate isolated worlds for a frame, but we can at least assert that the context we got is *not* the main world's context. 1147 ASSERT_NE(webView->mainFrame()->mainWorldScriptContext(), notification->context); 1148 1149 webView->close(); 1162 ASSERT_NE(m_webView->mainFrame()->mainWorldScriptContext(), notification->context); 1163 1164 m_webView->close(); 1165 m_webView = 0; 1150 1166 1151 1167 // We should have gotten three release notifications (one for each of the frames, plus one for the isolated context). … … 1164 1180 { 1165 1181 registerMockedHttpURLLoad("find.html"); 1166 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html");1167 WebFrame* frame = webView->mainFrame();1182 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html"); 1183 WebFrame* frame = m_webView->mainFrame(); 1168 1184 const int findIdentifier = 12345; 1169 1185 WebFindOptions options; … … 1215 1231 range = frame->selectionRange(); 1216 1232 ASSERT_TRUE(range.isNull()); 1217 1218 webView->close();1219 1233 } 1220 1234 1221 1235 TEST_F(WebFrameTest, GetContentAsPlainText) 1222 1236 { 1223 WebView*webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);1237 m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); 1224 1238 // We set the size because it impacts line wrapping, which changes the 1225 1239 // resulting text value. 1226 webView->resize(WebSize(640, 480));1227 WebFrame* frame = webView->mainFrame();1240 m_webView->resize(WebSize(640, 480)); 1241 WebFrame* frame = m_webView->mainFrame(); 1228 1242 1229 1243 // Generate a simple test case. … … 1231 1245 WebCore::KURL testURL = toKURL("about:blank"); 1232 1246 frame->loadHTMLString(simpleSource, testURL); 1233 webkit_support::RunAllPendingMessages();1247 runPendingTasks(); 1234 1248 1235 1249 // Make sure it comes out OK. … … 1246 1260 const char outerFrameSource[] = "Hello<iframe></iframe> world"; 1247 1261 frame->loadHTMLString(outerFrameSource, testURL); 1248 webkit_support::RunAllPendingMessages();1262 runPendingTasks(); 1249 1263 1250 1264 // Load something into the subframe. … … 1252 1266 ASSERT_TRUE(subframe); 1253 1267 subframe->loadHTMLString("sub<p>text", testURL); 1254 webkit_support::RunAllPendingMessages();1268 runPendingTasks(); 1255 1269 1256 1270 text = frame->contentAsText(std::numeric_limits<size_t>::max()); … … 1261 1275 text = frame->contentAsText(12); 1262 1276 EXPECT_EQ("Hello world", std::string(text.utf8().data())); 1263 1264 webView->close();1265 1277 } 1266 1278 1267 1279 TEST_F(WebFrameTest, GetFullHtmlOfPage) 1268 1280 { 1269 WebView*webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);1270 WebFrame* frame = webView->mainFrame();1281 m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); 1282 WebFrame* frame = m_webView->mainFrame(); 1271 1283 1272 1284 // Generate a simple test case. … … 1274 1286 WebCore::KURL testURL = toKURL("about:blank"); 1275 1287 frame->loadHTMLString(simpleSource, testURL); 1276 webkit_support::RunAllPendingMessages();1288 runPendingTasks(); 1277 1289 1278 1290 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); … … 1283 1295 // Load again with the output html. 1284 1296 frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL); 1285 webkit_support::RunAllPendingMessages();1297 runPendingTasks(); 1286 1298 1287 1299 EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data())); … … 1313 1325 1314 1326 TestExecuteScriptDuringDidCreateScriptContext webFrameClient; 1315 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "hello_world.html", true, &webFrameClient); 1316 1317 webView->mainFrame()->reload(); 1318 webkit_support::ServeAsynchronousMockedRequests(); 1327 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "hello_world.html", true, &webFrameClient); 1328 1329 m_webView->mainFrame()->reload(); 1330 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 1331 1332 m_webView->close(); 1333 m_webView = 0; 1319 1334 } 1320 1335 … … 1344 1359 1345 1360 TestDidCreateFrameWebFrameClient webFrameClient; 1346 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", false, &webFrameClient);1361 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", false, &webFrameClient); 1347 1362 1348 1363 EXPECT_EQ(webFrameClient.m_frameCount, 3); 1349 EXPECT_EQ(webFrameClient.m_parent, webView->mainFrame()); 1364 EXPECT_EQ(webFrameClient.m_parent, m_webView->mainFrame()); 1365 1366 m_webView->close(); 1367 m_webView = 0; 1350 1368 } 1351 1369 … … 1384 1402 1385 1403 FindUpdateWebFrameClient client; 1386 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);1387 webView->resize(WebSize(640, 480));1388 webView->layout();1389 webkit_support::RunAllPendingMessages();1404 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client); 1405 m_webView->resize(WebSize(640, 480)); 1406 m_webView->layout(); 1407 runPendingTasks(); 1390 1408 1391 1409 // Note that the 'result 19' in the <select> element is not expected to produce a match. … … 1396 1414 WebFindOptions options; 1397 1415 WebString searchText = WebString::fromUTF8(kFindString); 1398 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>( webView->mainFrame());1416 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); 1399 1417 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); 1400 1418 … … 1404 1422 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); 1405 1423 1406 webkit_support::RunAllPendingMessages();1424 runPendingTasks(); 1407 1425 EXPECT_TRUE(client.findResultsAreReady()); 1408 1426 … … 1491 1509 1492 1510 // Resizing should update the rects version. 1493 webView->resize(WebSize(800, 600));1494 webkit_support::RunAllPendingMessages();1511 m_webView->resize(WebSize(800, 600)); 1512 runPendingTasks(); 1495 1513 EXPECT_TRUE(mainFrame->findMatchMarkersVersion() != rectsVersion); 1496 1514 1497 webView->close(); 1515 m_webView->close(); 1516 m_webView = 0; 1498 1517 } 1499 1518 … … 1503 1522 1504 1523 FindUpdateWebFrameClient client; 1505 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client);1506 webView->resize(WebSize(640, 480));1507 webView->layout();1508 webkit_support::RunAllPendingMessages();1524 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client); 1525 m_webView->resize(WebSize(640, 480)); 1526 m_webView->layout(); 1527 runPendingTasks(); 1509 1528 1510 1529 static const char* kFindString = "hello"; … … 1514 1533 WebFindOptions options; 1515 1534 WebString searchText = WebString::fromUTF8(kFindString); 1516 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>( webView->mainFrame());1535 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); 1517 1536 EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); 1518 1537 … … 1522 1541 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); 1523 1542 1524 webkit_support::RunAllPendingMessages();1543 runPendingTasks(); 1525 1544 EXPECT_TRUE(client.findResultsAreReady()); 1526 1545 EXPECT_EQ(kNumResults, client.count()); 1527 1546 1528 webView->close(); 1547 m_webView->close(); 1548 m_webView = 0; 1529 1549 } 1530 1550 … … 1535 1555 1536 1556 FindUpdateWebFrameClient client; 1537 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);1538 webView->resize(WebSize(640, 480));1539 webView->layout();1540 webkit_support::RunAllPendingMessages();1557 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client); 1558 m_webView->resize(WebSize(640, 480)); 1559 m_webView->layout(); 1560 runPendingTasks(); 1541 1561 1542 1562 static const char* kFindString = "result"; … … 1545 1565 WebFindOptions options; 1546 1566 WebString searchText = WebString::fromUTF8(kFindString); 1547 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>( webView->mainFrame());1567 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); 1548 1568 WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false)); 1549 1569 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); … … 1555 1575 EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false, 0)); 1556 1576 1557 webkit_support::RunAllPendingMessages();1577 runPendingTasks(); 1558 1578 EXPECT_FALSE(client.findResultsAreReady()); 1559 1579 … … 1563 1583 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); 1564 1584 1565 webkit_support::RunAllPendingMessages();1585 runPendingTasks(); 1566 1586 EXPECT_TRUE(client.findResultsAreReady()); 1567 1587 1568 1588 holdSecondFrame.release(); 1569 webView->close(); 1589 1590 m_webView->close(); 1591 m_webView = 0; 1570 1592 } 1571 1593 … … 1576 1598 1577 1599 FindUpdateWebFrameClient client; 1578 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);1579 webView->resize(WebSize(640, 480));1580 webView->layout();1581 webkit_support::RunAllPendingMessages();1600 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client); 1601 m_webView->resize(WebSize(640, 480)); 1602 m_webView->layout(); 1603 runPendingTasks(); 1582 1604 1583 1605 static const char* kFindString = "result"; … … 1586 1608 WebFindOptions options; 1587 1609 WebString searchText = WebString::fromUTF8(kFindString); 1588 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>( webView->mainFrame());1610 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); 1589 1611 WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false)); 1590 1612 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); … … 1593 1615 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0)); 1594 1616 1595 webkit_support::RunAllPendingMessages();1617 runPendingTasks(); 1596 1618 EXPECT_FALSE(client.findResultsAreReady()); 1597 1619 … … 1604 1626 frame->scopeStringMatches(kFindIdentifier, searchText, options, true); 1605 1627 1606 webkit_support::RunAllPendingMessages();1628 runPendingTasks(); 1607 1629 EXPECT_TRUE(client.findResultsAreReady()); 1608 1630 1609 1631 holdSecondFrame.release(); 1610 webView->close(); 1632 1633 m_webView->close(); 1634 m_webView = 0; 1611 1635 } 1612 1636 … … 1617 1641 1618 1642 FindUpdateWebFrameClient client; 1619 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client);1620 webView->resize(WebSize(640, 480));1621 webView->layout();1622 webkit_support::RunAllPendingMessages();1643 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_page.html", true, &client); 1644 m_webView->resize(WebSize(640, 480)); 1645 m_webView->layout(); 1646 runPendingTasks(); 1623 1647 1624 1648 static const char* kFindString = "result"; … … 1627 1651 WebFindOptions options; 1628 1652 WebString searchText = WebString::fromUTF8(kFindString); 1629 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>( webView->mainFrame());1653 WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); 1630 1654 WebFrameImpl* secondFrame = static_cast<WebFrameImpl*>(mainFrame->traverseNext(false)); 1631 1655 RefPtr<WebCore::Frame> holdSecondFrame = secondFrame->frame(); … … 1634 1658 EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0)); 1635 1659 1636 webkit_support::RunAllPendingMessages();1660 runPendingTasks(); 1637 1661 EXPECT_FALSE(client.findResultsAreReady()); 1638 1662 … … 1645 1669 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); 1646 1670 1647 webkit_support::RunAllPendingMessages();1671 runPendingTasks(); 1648 1672 EXPECT_TRUE(client.findResultsAreReady()); 1649 1673 1650 1674 holdSecondFrame.release(); 1651 webView->close(); 1675 1676 m_webView->close(); 1677 m_webView = 0; 1652 1678 } 1653 1679 … … 1687 1713 TEST_F(WebFrameTest, SelectRange) 1688 1714 { 1689 WebView* webView;1690 1715 WebFrame* frame; 1691 1716 WebRect startWebRect; … … 1697 1722 registerMockedHttpURLLoad("select_range_editable.html"); 1698 1723 1699 webView = createWebViewForTextSelection(m_baseURL + "select_range_basic.html");1700 frame = webView->mainFrame();1724 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_basic.html"); 1725 frame = m_webView->mainFrame(); 1701 1726 EXPECT_EQ("Some test text for testing.", selectionAsString(frame)); 1702 webView->selectionBounds(startWebRect, endWebRect);1727 m_webView->selectionBounds(startWebRect, endWebRect); 1703 1728 frame->executeCommand(WebString::fromUTF8("Unselect")); 1704 1729 EXPECT_EQ("", selectionAsString(frame)); 1705 1730 frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); 1706 1731 EXPECT_EQ("Some test text for testing.", selectionAsString(frame)); 1707 webView->close(); 1708 1709 webView = createWebViewForTextSelection(m_baseURL + "select_range_scroll.html"); 1710 frame = webView->mainFrame(); 1732 m_webView->close(); 1733 m_webView = 0; 1734 1735 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_scroll.html"); 1736 frame = m_webView->mainFrame(); 1711 1737 EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame)); 1712 webView->selectionBounds(startWebRect, endWebRect);1738 m_webView->selectionBounds(startWebRect, endWebRect); 1713 1739 frame->executeCommand(WebString::fromUTF8("Unselect")); 1714 1740 EXPECT_EQ("", selectionAsString(frame)); 1715 1741 frame->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); 1716 1742 EXPECT_EQ("Some offscreen test text for testing.", selectionAsString(frame)); 1717 webView->close(); 1718 1719 webView = createWebViewForTextSelection(m_baseURL + "select_range_iframe.html"); 1720 frame = webView->mainFrame(); 1743 m_webView->close(); 1744 m_webView = 0; 1745 1746 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_iframe.html"); 1747 frame = m_webView->mainFrame(); 1721 1748 WebFrame* subframe = frame->findChildByExpression(WebString::fromUTF8("/html/body/iframe")); 1722 1749 EXPECT_EQ("Some test text for testing.", selectionAsString(subframe)); 1723 webView->selectionBounds(startWebRect, endWebRect);1750 m_webView->selectionBounds(startWebRect, endWebRect); 1724 1751 subframe->executeCommand(WebString::fromUTF8("Unselect")); 1725 1752 EXPECT_EQ("", selectionAsString(subframe)); 1726 1753 subframe->selectRange(topLeft(startWebRect), bottomRightMinusOne(endWebRect)); 1727 1754 EXPECT_EQ("Some test text for testing.", selectionAsString(subframe)); 1728 webView->close(); 1755 m_webView->close(); 1756 m_webView = 0; 1729 1757 1730 1758 // Select the middle of an editable element, then try to extend the selection to the top of the document. 1731 1759 // The selection range should be clipped to the bounds of the editable element. 1732 webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");1733 frame = webView->mainFrame();1760 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html"); 1761 frame = m_webView->mainFrame(); 1734 1762 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); 1735 webView->selectionBounds(startWebRect, endWebRect);1763 m_webView->selectionBounds(startWebRect, endWebRect); 1736 1764 frame->selectRange(bottomRightMinusOne(endWebRect), WebPoint(0, 0)); 1737 1765 EXPECT_EQ("16-char header. This text is initially selected.", selectionAsString(frame)); 1738 webView->close(); 1766 m_webView->close(); 1767 m_webView = 0; 1739 1768 1740 1769 // As above, but extending the selection to the bottom of the document. 1741 webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html");1742 frame = webView->mainFrame();1770 m_webView = createWebViewForTextSelection(m_baseURL + "select_range_editable.html"); 1771 frame = m_webView->mainFrame(); 1743 1772 EXPECT_EQ("This text is initially selected.", selectionAsString(frame)); 1744 webView->selectionBounds(startWebRect, endWebRect);1773 m_webView->selectionBounds(startWebRect, endWebRect); 1745 1774 frame->selectRange(topLeft(startWebRect), WebPoint(640, 480)); 1746 1775 EXPECT_EQ("This text is initially selected. 16-char footer.", selectionAsString(frame)); 1747 webView->close(); 1776 m_webView->close(); 1777 m_webView = 0; 1748 1778 } 1749 1779 … … 1751 1781 { 1752 1782 registerMockedHttpURLLoad("text_selection.html"); 1753 WebView*webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");1754 WebFrame* frame = webView->mainFrame();1783 m_webView = createWebViewForTextSelection(m_baseURL + "text_selection.html"); 1784 WebFrame* frame = m_webView->mainFrame(); 1755 1785 1756 1786 // Select second span. We can move the start to include the first span. … … 1791 1821 frame->selectRange(bottomRightMinusOne(elementBounds(frame, "editable_2")), topLeft(elementBounds(frame, "header_2"))); 1792 1822 EXPECT_EQ("[ Editable 1. Editable 2.", selectionAsString(frame)); 1793 1794 webView->close();1795 1823 } 1796 1824 … … 1798 1826 { 1799 1827 registerMockedHttpURLLoad("text_selection.html"); 1800 WebView*webView = createWebViewForTextSelection(m_baseURL + "text_selection.html");1801 WebFrame* frame = webView->mainFrame();1828 m_webView = createWebViewForTextSelection(m_baseURL + "text_selection.html"); 1829 WebFrame* frame = m_webView->mainFrame(); 1802 1830 1803 1831 // Select first span. We can move the end to include the second span. … … 1838 1866 frame->selectRange(topLeft(elementBounds(frame, "editable_1")), bottomRightMinusOne(elementBounds(frame, "footer_1"))); 1839 1867 EXPECT_EQ("Editable 1. Editable 2. ]", selectionAsString(frame)); 1840 1841 webView->close();1842 1868 } 1843 1869 … … 1845 1871 TEST_F(WebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved) 1846 1872 { 1847 WebView* webView;1848 1873 WebFrameImpl* frame; 1849 1874 registerMockedHttpURLLoad("move_caret.html"); 1850 1875 1851 webView = createWebViewForTextSelection(m_baseURL + "move_caret.html");1852 frame = (WebFrameImpl*) webView->mainFrame();1876 m_webView = createWebViewForTextSelection(m_baseURL + "move_caret.html"); 1877 frame = (WebFrameImpl*)m_webView->mainFrame(); 1853 1878 1854 1879 WebRect initialStartRect; … … 1858 1883 1859 1884 frame->executeScript(WebScriptSource("select();")); 1860 webView->selectionBounds(initialStartRect, initialEndRect);1885 m_webView->selectionBounds(initialStartRect, initialEndRect); 1861 1886 WebPoint moveTo(topLeft(initialStartRect)); 1862 1887 1863 1888 moveTo.y += 40; 1864 1889 frame->moveCaretSelectionTowardsWindowPoint(moveTo); 1865 webView->selectionBounds(startRect, endRect);1890 m_webView->selectionBounds(startRect, endRect); 1866 1891 EXPECT_EQ(startRect, initialStartRect); 1867 1892 EXPECT_EQ(endRect, initialEndRect); … … 1869 1894 moveTo.y -= 80; 1870 1895 frame->moveCaretSelectionTowardsWindowPoint(moveTo); 1871 webView->selectionBounds(startRect, endRect);1896 m_webView->selectionBounds(startRect, endRect); 1872 1897 EXPECT_EQ(startRect, initialStartRect); 1873 1898 EXPECT_EQ(endRect, initialEndRect); 1874 1875 webView->close();1876 1899 } 1877 1900 #endif … … 1911 1934 // Make sure we initialize to minimum scale, even if the window size 1912 1935 // only becomes available after the load begins. 1913 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));1914 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);1915 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);1916 webViewImpl->resize(WebSize(1000, 1000));1917 webViewImpl->layout();1936 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client); 1937 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 1938 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 1939 m_webView->resize(WebSize(1000, 1000)); 1940 m_webView->layout(); 1918 1941 1919 1942 client.resetTriggered(); 1920 webViewImpl->handleInputEvent(fatTap(0, 0));1943 m_webView->handleInputEvent(fatTap(0, 0)); 1921 1944 EXPECT_FALSE(client.triggered()); 1922 1945 1923 1946 client.resetTriggered(); 1924 webViewImpl->handleInputEvent(fatTap(200, 115));1947 m_webView->handleInputEvent(fatTap(200, 115)); 1925 1948 EXPECT_FALSE(client.triggered()); 1926 1949 1927 1950 for (int i = 0; i <= 46; i++) { 1928 1951 client.resetTriggered(); 1929 webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5));1952 m_webView->handleInputEvent(fatTap(120, 230 + i * 5)); 1930 1953 1931 1954 int j = i % 10; … … 1938 1961 for (int i = 0; i <= 46; i++) { 1939 1962 client.resetTriggered(); 1940 webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590));1963 m_webView->handleInputEvent(fatTap(10 + i * 5, 590)); 1941 1964 1942 1965 int j = i % 10; … … 1947 1970 } 1948 1971 1972 m_webView->close(); 1973 m_webView = 0; 1974 1949 1975 } 1950 1976 … … 1957 1983 // Make sure we initialize to minimum scale, even if the window size 1958 1984 // only becomes available after the load begins. 1959 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &client));1960 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);1961 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);1962 webViewImpl->resize(WebSize(1000, 1000));1963 webViewImpl->layout();1985 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &client); 1986 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 1987 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 1988 m_webView->resize(WebSize(1000, 1000)); 1989 m_webView->layout(); 1964 1990 1965 1991 client.resetTriggered(); 1966 webViewImpl->handleInputEvent(fatTap(50, 50));1992 m_webView->handleInputEvent(fatTap(50, 50)); 1967 1993 EXPECT_FALSE(client.triggered()); 1994 1995 m_webView->close(); 1996 m_webView = 0; 1968 1997 } 1969 1998 … … 1977 2006 // Make sure we initialize to minimum scale, even if the window size 1978 2007 // only becomes available after the load begins. 1979 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));1980 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);1981 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);1982 webViewImpl->resize(WebSize(1000, 1000));1983 webViewImpl->layout();2008 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client); 2009 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 2010 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 2011 m_webView->resize(WebSize(1000, 1000)); 2012 m_webView->layout(); 1984 2013 1985 2014 client.resetTriggered(); 1986 webViewImpl->handleInputEvent(fatTap(0, 0));2015 m_webView->handleInputEvent(fatTap(0, 0)); 1987 2016 EXPECT_FALSE(client.triggered()); 1988 2017 1989 2018 client.resetTriggered(); 1990 webViewImpl->handleInputEvent(fatTap(200, 115));2019 m_webView->handleInputEvent(fatTap(200, 115)); 1991 2020 EXPECT_FALSE(client.triggered()); 1992 2021 1993 2022 for (int i = 0; i <= 46; i++) { 1994 2023 client.resetTriggered(); 1995 webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5));2024 m_webView->handleInputEvent(fatTap(120, 230 + i * 5)); 1996 2025 EXPECT_FALSE(client.triggered()); 1997 2026 } … … 1999 2028 for (int i = 0; i <= 46; i++) { 2000 2029 client.resetTriggered(); 2001 webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590));2030 m_webView->handleInputEvent(fatTap(10 + i * 5, 590)); 2002 2031 EXPECT_FALSE(client.triggered()); 2003 2032 } 2033 2034 m_webView->close(); 2035 m_webView = 0; 2004 2036 } 2005 2037 … … 2016 2048 // Make sure we initialize to minimum scale, even if the window size 2017 2049 // only becomes available after the load begins. 2018 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client));2019 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);2020 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);2021 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));2022 webViewImpl->layout();2050 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client); 2051 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 2052 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 2053 m_webView->resize(WebSize(viewportWidth, viewportHeight)); 2054 m_webView->layout(); 2023 2055 2024 2056 // Click somewhere where the popup shouldn't appear. 2025 2057 client.resetTriggered(); 2026 webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, 0));2058 m_webView->handleInputEvent(fatTap(viewportWidth / 2, 0)); 2027 2059 EXPECT_FALSE(client.triggered()); 2028 2060 2029 2061 // Click directly in between two container divs with click handlers, with children that don't handle clicks. 2030 2062 client.resetTriggered(); 2031 webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight));2063 m_webView->handleInputEvent(fatTap(viewportWidth / 2, divHeight)); 2032 2064 EXPECT_TRUE(client.triggered()); 2033 2065 2034 2066 // The third div container should be blacklisted if you click on the link it contains. 2035 2067 client.resetTriggered(); 2036 webViewImpl->handleInputEvent(fatTap(viewportWidth / 2, divHeight * 3.25));2068 m_webView->handleInputEvent(fatTap(viewportWidth / 2, divHeight * 3.25)); 2037 2069 EXPECT_FALSE(client.triggered()); 2070 2071 m_webView->close(); 2072 m_webView = 0; 2038 2073 } 2039 2074 … … 2046 2081 // Make sure we initialize to minimum scale, even if the window size 2047 2082 // only becomes available after the load begins. 2048 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_page_scale.html", true, 0, &client));2049 webViewImpl->settings()->setApplyDeviceScaleFactorInCompositor(true);2050 webViewImpl->settings()->setApplyPageScaleFactorInCompositor(true);2051 webViewImpl->resize(WebSize(1000, 1000));2052 webViewImpl->layout();2083 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "disambiguation_popup_page_scale.html", true, 0, &client); 2084 m_webView->settings()->setApplyDeviceScaleFactorInCompositor(true); 2085 m_webView->settings()->setApplyPageScaleFactorInCompositor(true); 2086 m_webView->resize(WebSize(1000, 1000)); 2087 m_webView->layout(); 2053 2088 2054 2089 client.resetTriggered(); 2055 webViewImpl->handleInputEvent(fatTap(80, 80));2090 m_webView->handleInputEvent(fatTap(80, 80)); 2056 2091 EXPECT_TRUE(client.triggered()); 2057 2092 2058 2093 client.resetTriggered(); 2059 webViewImpl->handleInputEvent(fatTap(230, 190));2094 m_webView->handleInputEvent(fatTap(230, 190)); 2060 2095 EXPECT_TRUE(client.triggered()); 2061 2096 2062 webViewImpl->setPageScaleFactor(3.0f, WebPoint(0, 0));2063 webViewImpl->layout();2097 m_webView->setPageScaleFactor(3.0f, WebPoint(0, 0)); 2098 m_webView->layout(); 2064 2099 2065 2100 client.resetTriggered(); 2066 webViewImpl->handleInputEvent(fatTap(240, 240));2101 m_webView->handleInputEvent(fatTap(240, 240)); 2067 2102 EXPECT_TRUE(client.triggered()); 2068 2103 2069 2104 client.resetTriggered(); 2070 webViewImpl->handleInputEvent(fatTap(690, 570));2105 m_webView->handleInputEvent(fatTap(690, 570)); 2071 2106 EXPECT_FALSE(client.triggered()); 2107 2108 m_webView->close(); 2109 m_webView = 0; 2072 2110 } 2073 2111 … … 2082 2120 { 2083 2121 frame->loadHTMLString("This should appear", toKURL("data:text/html,chromewebdata"), error.unreachableURL, true); 2084 webkit_support::RunAllPendingMessages();2122 runPendingTasks(); 2085 2123 } 2086 2124 … … 2101 2139 TestSubstituteDataWebFrameClient webFrameClient; 2102 2140 2103 WebView*webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true, &webFrameClient);2104 webkit_support::RunAllPendingMessages();2105 WebFrame* frame = webView->mainFrame();2141 m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true, &webFrameClient); 2142 runPendingTasks(); 2143 WebFrame* frame = m_webView->mainFrame(); 2106 2144 2107 2145 // Load a url as a history navigation that will return an error. TestSubstituteDataWebFrameClient … … 2122 2160 errorHistoryItem.setURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length())); 2123 2161 errorHistoryItem.setOriginalURLString(WebString::fromUTF8(errorURL.c_str(), errorURL.length())); 2124 webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error);2162 Platform::current()->unitTestSupport()->registerMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error); 2125 2163 frame->loadHistoryItem(errorHistoryItem); 2126 webkit_support::ServeAsynchronousMockedRequests();2164 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 2127 2165 2128 2166 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); 2129 2167 EXPECT_EQ("This should appear", std::string(text.utf8().data())); 2130 2168 EXPECT_TRUE(webFrameClient.commitCalled()); 2169 2170 m_webView->close(); 2171 m_webView = 0; 2131 2172 } 2132 2173 … … 2162 2203 2163 2204 TestWillInsertBodyWebFrameClient webFrameClient; 2164 WebView*webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body.html", false, &webFrameClient);2205 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "clipped-body.html", false, &webFrameClient); 2165 2206 2166 2207 EXPECT_TRUE(webFrameClient.m_didLoad); 2167 2208 EXPECT_EQ(1, webFrameClient.m_numBodies); 2168 webView->close(); 2209 2210 m_webView->close(); 2211 m_webView = 0; 2169 2212 } 2170 2213 … … 2174 2217 2175 2218 TestWillInsertBodyWebFrameClient webFrameClient; 2176 WebView*webView = FrameTestHelpers::createWebView(false, &webFrameClient);2219 m_webView = FrameTestHelpers::createWebView(false, &webFrameClient); 2177 2220 2178 2221 EXPECT_FALSE(webFrameClient.m_didLoad); 2179 2222 EXPECT_EQ(1, webFrameClient.m_numBodies); // The empty document that a new frame starts with triggers this. 2180 webView->close(); 2223 m_webView->close(); 2224 m_webView = 0; 2181 2225 } 2182 2226 2183 2227 TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection) 2184 2228 { 2185 WebView*webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true);2186 WebFrame* frame = webView->mainFrame();2229 m_webView = FrameTestHelpers::createWebViewAndLoad("about:blank", true); 2230 WebFrame* frame = m_webView->mainFrame(); 2187 2231 2188 2232 // This test passes if this doesn't crash. -
trunk/Source/WebKit/chromium/tests/WebImageTest.cpp
r140379 r142422 36 36 #include "SharedBuffer.h" 37 37 #include <gtest/gtest.h> 38 #include <public/Platform.h> 38 39 #include <public/WebData.h> 39 40 #include <public/WebSize.h> 40 #include < webkit/support/webkit_support.h>41 #include <public/WebUnitTestSupport.h> 41 42 42 43 using namespace WebCore; … … 47 48 static PassRefPtr<SharedBuffer> readFile(const char* fileName) 48 49 { 49 String filePath = webkit_support::GetWebKitRootDir();50 String filePath = Platform::current()->unitTestSupport()->webKitRootDir(); 50 51 filePath.append("/Source/WebKit/chromium/tests/data/"); 51 52 filePath.append(fileName); -
trunk/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp
r138798 r142422 31 31 #include "config.h" 32 32 33 #include "FrameTestHelpers.h" 33 34 #include "URLTestHelpers.h" 34 35 #include "WebFrame.h" … … 38 39 #include "WebSettings.h" 39 40 #include "WebView.h" 41 #include <gtest/gtest.h> 42 #include <public/Platform.h> 40 43 #include <public/WebString.h> 44 #include <public/WebThread.h> 41 45 #include <public/WebURL.h> 42 46 #include <public/WebURLRequest.h> 43 47 #include <public/WebURLResponse.h> 44 45 #include <gtest/gtest.h> 46 #include <webkit/support/webkit_support.h> 48 #include <public/WebUnitTestSupport.h> 47 49 48 50 using namespace WebKit; 51 using WebKit::FrameTestHelpers::runPendingTasks; 49 52 using WebKit::URLTestHelpers::toKURL; 50 53 using WebKit::URLTestHelpers::registerMockedURLLoad; … … 110 113 virtual void TearDown() 111 114 { 112 webkit_support::UnregisterAllMockedURLs();115 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 113 116 m_webView->close(); 114 117 } … … 139 142 m_webView->mainFrame()->loadRequest(urlRequest); 140 143 // Make sure any pending request get served. 141 webkit_support::ServeAsynchronousMockedRequests();144 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 142 145 // Some requests get delayed, run the timer. 143 webkit_support::RunAllPendingMessages();146 runPendingTasks(); 144 147 // Server the delayed resources. 145 webkit_support::ServeAsynchronousMockedRequests();148 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 146 149 } 147 150 -
trunk/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp
r138798 r142422 36 36 #include "WebFrameClient.h" 37 37 #include "WebView.h" 38 #include <public/Platform.h> 38 39 #include <public/WebString.h> 39 40 #include <public/WebURL.h> 40 41 #include <public/WebURLRequest.h> 41 42 #include <public/WebURLResponse.h> 43 #include <public/WebUnitTestSupport.h> 42 44 43 45 #include <gtest/gtest.h> 44 #include <webkit/support/webkit_support.h>45 46 46 47 using namespace WebKit; … … 71 72 virtual void TearDown() 72 73 { 73 webkit_support::UnregisterAllMockedURLs();74 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 74 75 m_webView->close(); 75 76 } … … 87 88 m_webView->mainFrame()->loadRequest(urlRequest); 88 89 // Make sure any pending request get served. 89 webkit_support::ServeAsynchronousMockedRequests();90 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 90 91 } 91 92 -
trunk/Source/WebKit/chromium/tests/WebPluginContainerTest.cpp
r135315 r142422 47 47 #include "WebViewImpl.h" 48 48 #include <gtest/gtest.h> 49 #include <webkit/support/webkit_support.h> 49 #include <public/Platform.h> 50 #include <public/WebThread.h> 51 #include <public/WebUnitTestSupport.h> 50 52 51 53 using namespace WebKit; … … 62 64 virtual void TearDown() 63 65 { 64 webkit_support::UnregisterAllMockedURLs();66 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 65 67 } 66 68 … … 92 94 webView->resize(WebSize(300, 300)); 93 95 webView->layout(); 94 webkit_support::RunAllPendingMessages();96 FrameTestHelpers::runPendingTasks(); 95 97 96 98 WebPluginContainer* pluginContainerOne = getWebPluginContainer(webView, WebString::fromUTF8("translated-plugin")); -
trunk/Source/WebKit/chromium/tests/WebViewTest.cpp
r142011 r142422 48 48 #include "WebViewImpl.h" 49 49 #include <gtest/gtest.h> 50 #include <public/Platform.h> 50 51 #include <public/WebSize.h> 51 #include <webkit/support/webkit_support.h> 52 #include <public/WebThread.h> 53 #include <public/WebUnitTestSupport.h> 52 54 53 55 using namespace WebKit; 56 using WebKit::FrameTestHelpers::runPendingTasks; 54 57 using WebKit::URLTestHelpers::toKURL; 55 58 … … 164 167 virtual void TearDown() 165 168 { 166 webkit_support::UnregisterAllMockedURLs();169 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 167 170 } 168 171 … … 570 573 571 574 webView->handleInputEvent(event); 572 webkit_support::RunAllPendingMessages();575 runPendingTasks(); 573 576 return true; 574 577 } … … 582 585 webView->resize(WebSize(500, 300)); 583 586 webView->layout(); 584 webkit_support::RunAllPendingMessages();587 runPendingTasks(); 585 588 586 589 WebString clickListener = WebString::fromUTF8("clickListener"); … … 619 622 event.type = WebInputEvent::GestureTap; 620 623 webView->handleInputEvent(event); 621 webkit_support::RunAllPendingMessages();624 runPendingTasks(); 622 625 EXPECT_TRUE(client.pendingIntentsCancelled()); 623 626 webView->close(); … … 634 637 event.y = 8; 635 638 webView->handleInputEvent(event); 636 webkit_support::RunAllPendingMessages();639 runPendingTasks(); 637 640 EXPECT_EQ(3, client.tapX()); 638 641 EXPECT_EQ(8, client.tapY()); … … 642 645 event.y = 7; 643 646 webView->handleInputEvent(event); 644 webkit_support::RunAllPendingMessages();647 runPendingTasks(); 645 648 EXPECT_EQ(25, client.longpressX()); 646 649 EXPECT_EQ(7, client.longpressY()); … … 656 659 webView->resize(WebSize(500, 300)); 657 660 webView->layout(); 658 webkit_support::RunAllPendingMessages();661 runPendingTasks(); 659 662 660 663 WebString target = WebString::fromUTF8("target"); … … 676 679 webView->resize(WebSize(640, 480)); 677 680 webView->layout(); 678 webkit_support::RunAllPendingMessages();681 runPendingTasks(); 679 682 680 683 std::string testWord = "This text should be selected."; … … 700 703 webView->resize(WebSize(640, 480)); 701 704 webView->layout(); 702 webkit_support::RunAllPendingMessages();705 runPendingTasks(); 703 706 704 707 std::string testWord = "This text should be selected."; -
trunk/Source/WebKit/chromium/tests/data/non-fast-scrollable.html
r141769 r142422 13 13 position: absolute; 14 14 } 15 .big { 16 margin: 200px; 17 } 15 18 </style> 16 19 </head> … … 18 21 <body> 19 22 <div class="scrollable box"> 20 Scrolling content.23 <span class="big">Scrolling content</span> 21 24 <div class="out-of-flow box">Out-of-flow content.</div> 22 25 </div>
Note: See TracChangeset
for help on using the changeset viewer.