Changeset 102683 in webkit
- Timestamp:
- Dec 13, 2011, 9:13:47 AM (13 years ago)
- Location:
- branches/chromium/963/Source/WebKit/chromium
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/chromium/963/Source/WebKit/chromium/WebKit.gyp
r101846 r102683 730 730 'tests/WebPageNewSerializerTest.cpp', 731 731 'tests/WebPageSerializerTest.cpp', 732 'tests/WebViewTest.cpp',733 732 ], 734 733 'conditions': [ -
branches/chromium/963/Source/WebKit/chromium/WebKit.gypi
r101844 r102683 71 71 'tests/CCThreadTaskTest.cpp', 72 72 'tests/FloatQuadTest.cpp', 73 'tests/FrameTestHelpers.cpp',74 'tests/FrameTestHelpers.h',75 73 'tests/IDBBindingUtilitiesTest.cpp', 76 74 'tests/IDBKeyPathTest.cpp', … … 97 95 'tests/WebPageSerializerTest.cpp', 98 96 'tests/WebURLRequestTest.cpp', 99 'tests/WebViewTest.cpp',100 97 ], 101 98 -
branches/chromium/963/Source/WebKit/chromium/src/WebViewImpl.cpp
r101852 r102683 1424 1424 { 1425 1425 m_page->focusController()->setFocused(enable); 1426 m_page->focusController()->setActive(enable);1427 1426 if (enable) { 1427 // Note that we don't call setActive() when disabled as this cause extra 1428 // focus/blur events to be dispatched. 1429 m_page->focusController()->setActive(true); 1428 1430 RefPtr<Frame> focusedFrame = m_page->focusController()->focusedFrame(); 1429 1431 if (focusedFrame) { -
branches/chromium/963/Source/WebKit/chromium/tests/WebFrameTest.cpp
r99940 r102683 31 31 #include "config.h" 32 32 33 #include "FrameTestHelpers.h"34 33 #include "ResourceError.h" 35 34 #include "WebDocument.h" … … 41 40 #include "WebSecurityPolicy.h" 42 41 #include "WebSettings.h" 42 #include "WebString.h" 43 #include "WebURL.h" 44 #include "WebURLRequest.h" 45 #include "WebURLResponse.h" 46 #include "WebViewClient.h" 43 47 #include "WebViewImpl.h" 44 48 #include "v8.h" 49 #include <googleurl/src/gurl.h> 45 50 #include <gtest/gtest.h> 46 51 #include <webkit/support/webkit_support.h> … … 53 58 public: 54 59 WebFrameTest() 55 : m_baseURL("http://www.test.com/"),56 m_chromeURL("chrome://")60 : baseURL("http://www.test.com/"), 61 chromeURL("chrome://") 57 62 { 58 63 } … … 65 70 void registerMockedHttpURLLoad(const std::string& fileName) 66 71 { 67 FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName);72 registerMockedURLLoad(baseURL, fileName); 68 73 } 69 74 70 75 void registerMockedChromeURLLoad(const std::string& fileName) 71 76 { 72 FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName); 77 registerMockedURLLoad(chromeURL, fileName); 78 } 79 80 void serveRequests() 81 { 82 webkit_support::ServeAsynchronousMockedRequests(); 83 } 84 85 void loadHttpFrame(WebFrame* frame, const std::string& fileName) 86 { 87 loadFrame(frame, baseURL, fileName); 88 } 89 90 void loadChromeFrame(WebFrame* frame, const std::string& fileName) 91 { 92 loadFrame(frame, chromeURL, fileName); 93 } 94 95 void registerMockedURLLoad(const std::string& base, const std::string& fileName) 96 { 97 WebURLResponse response; 98 response.initialize(); 99 response.setMIMEType("text/html"); 100 101 std::string filePath = webkit_support::GetWebKitRootDir().utf8(); 102 filePath += "/Source/WebKit/chromium/tests/data/"; 103 filePath += fileName; 104 105 webkit_support::RegisterMockedURL(WebURL(GURL(base + fileName)), response, WebString::fromUTF8(filePath)); 106 } 107 108 void loadFrame(WebFrame* frame, const std::string& base, const std::string& fileName) 109 { 110 WebURLRequest urlRequest; 111 urlRequest.initialize(); 112 urlRequest.setURL(WebURL(GURL(base + fileName))); 113 frame->loadRequest(urlRequest); 73 114 } 74 115 75 116 protected: 76 std::string m_baseURL; 77 std::string m_chromeURL; 117 std::string baseURL; 118 std::string chromeURL; 119 }; 120 121 class TestWebFrameClient : public WebFrameClient { 122 }; 123 124 class TestWebViewClient : public WebViewClient { 78 125 }; 79 126 … … 85 132 registerMockedHttpURLLoad("zero_sized_iframe.html"); 86 133 87 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html"); 134 // Create and initialize the WebView. 135 TestWebFrameClient webFrameClient; 136 WebView* webView = WebView::create(0); 137 webView->initializeMainFrame(&webFrameClient); 138 139 loadHttpFrame(webView->mainFrame(), "iframes_test.html"); 140 serveRequests(); 88 141 89 142 // Now retrieve the frames text and test it only includes visible elements. … … 105 158 registerMockedHttpURLLoad("zero_sized_iframe.html"); 106 159 107 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true); 160 // Create and initialize the WebView. 161 TestWebFrameClient webFrameClient; 162 WebView* webView = WebView::create(0); 163 webView->settings()->setJavaScriptEnabled(true); 164 webView->initializeMainFrame(&webFrameClient); 165 166 loadHttpFrame(webView->mainFrame(), "iframes_test.html"); 167 serveRequests(); 108 168 109 169 v8::HandleScope scope; … … 122 182 registerMockedHttpURLLoad("form.html"); 123 183 124 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html"); 184 TestWebFrameClient webFrameClient; 185 WebView* webView = WebView::create(0); 186 webView->initializeMainFrame(&webFrameClient); 187 188 loadHttpFrame(webView->mainFrame(), "form.html"); 189 serveRequests(); 125 190 126 191 WebVector<WebFormElement> forms; … … 138 203 registerMockedChromeURLLoad("history.html"); 139 204 140 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); 205 // Create and initialize the WebView. 206 TestWebFrameClient webFrameClient; 207 WebView* webView = WebView::create(0); 208 webView->settings()->setJavaScriptEnabled(true); 209 webView->initializeMainFrame(&webFrameClient); 210 211 loadChromeFrame(webView->mainFrame(), "history.html"); 212 serveRequests(); 141 213 142 214 // Try to run JS against the chrome-style URL. 143 215 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome"); 144 FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))");216 loadFrame(webView->mainFrame(), "javascript:", "document.body.appendChild(document.createTextNode('Clobbered'))"); 145 217 146 218 // Now retrieve the frames text and see if it was clobbered. … … 176 248 177 249 TestReloadDoesntRedirectWebFrameClient webFrameClient; 178 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient); 250 WebView* webView = WebView::create(0); 251 webView->initializeMainFrame(&webFrameClient); 252 253 loadHttpFrame(webView->mainFrame(), "form.html"); 254 serveRequests(); 255 // Frame is loaded. 179 256 180 257 webView->mainFrame()->reload(true); 181 258 // start reload before request is delivered. 182 259 webView->mainFrame()->reload(true); 183 webkit_support::ServeAsynchronousMockedRequests();260 serveRequests(); 184 261 } 185 262 … … 189 266 registerMockedHttpURLLoad("autofocus_input_field_iframe.html"); 190 267 191 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true)); 268 // Create and initialize the WebView. 269 TestWebFrameClient webFrameClient; 270 TestWebViewClient webviewClient; 271 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(WebView::create(&webviewClient)); 272 webViewImpl->settings()->setJavaScriptEnabled(true); 273 webViewImpl->initializeMainFrame(&webFrameClient); 274 275 loadHttpFrame(webViewImpl->mainFrame(), "iframe_clear_focused_node_test.html"); 276 serveRequests(); 192 277 193 278 // Clear the focused node. … … 269 354 // Load a frame with an iframe, make sure we get the right create notifications. 270 355 ContextLifetimeTestWebFrameClient webFrameClient; 271 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 356 WebView* webView = WebView::create(0); 357 webView->settings()->setJavaScriptEnabled(true); 358 webView->initializeMainFrame(&webFrameClient); 359 loadHttpFrame(webView->mainFrame(), "context_notifications_test.html"); 360 serveRequests(); 272 361 273 362 WebFrame* mainFrame = webView->mainFrame(); … … 307 396 308 397 ContextLifetimeTestWebFrameClient webFrameClient; 309 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 398 WebView* webView = WebView::create(0); 399 webView->settings()->setJavaScriptEnabled(true); 400 webView->initializeMainFrame(&webFrameClient); 401 loadHttpFrame(webView->mainFrame(), "context_notifications_test.html"); 402 serveRequests(); 310 403 311 404 // Refresh, we should get two release notifications and two more create notifications. 312 405 webView->mainFrame()->reload(false); 313 webkit_support::ServeAsynchronousMockedRequests();406 serveRequests(); 314 407 ASSERT_EQ(4u, webFrameClient.createNotifications.size()); 315 408 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); … … 346 439 347 440 ContextLifetimeTestWebFrameClient webFrameClient; 348 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 441 WebView* webView = WebView::create(0); 442 webView->settings()->setJavaScriptEnabled(true); 443 webView->initializeMainFrame(&webFrameClient); 444 loadHttpFrame(webView->mainFrame(), "context_notifications_test.html"); 445 serveRequests(); 349 446 350 447 // Add an isolated world.
Note:
See TracChangeset
for help on using the changeset viewer.