Changeset 96912 in webkit
- Timestamp:
- Oct 7, 2011 12:43:10 AM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r96910 r96912 1 2011-10-07 Nate Chapin <japhet@chromium.org> 2 3 Always call setActive() in WebViewImpl::setFocus(), 4 not just when enabling focus. 5 https://bugs.webkit.org/show_bug.cgi?id=65220 6 7 Reviewed by Darin Fisher. 8 9 * WebKit.gyp: 10 * WebKit.gypi: 11 * src/WebViewImpl.cpp: 12 (WebKit::WebViewImpl::setFocus): 13 * tests/FrameTestHelpers.cpp: Added, refactored out of WebFrameTest.cpp. 14 (WebKit::FrameTestHelpers::registerMockedURLLoad): 15 (WebKit::FrameTestHelpers::loadFrame): 16 (WebKit::FrameTestHelpers::defaultWebFrameClient): 17 (WebKit::FrameTestHelpers::defaultWebViewClient): 18 (WebKit::FrameTestHelpers::createWebViewAndLoad): 19 * tests/FrameTestHelpers.h: Added, refactored out of WebFrameTest.cpp. 20 * tests/WebFrameTest.cpp: 21 * tests/WebViewTest.cpp: Added. 22 1 23 2011-10-06 Bill Budge <bbudge@chromium.org> 2 24 -
trunk/Source/WebKit/chromium/WebKit.gyp
r96909 r96912 692 692 'tests/WebPageNewSerializerTest.cpp', 693 693 'tests/WebPageSerializerTest.cpp', 694 'tests/WebViewTest.cpp', 694 695 'tests/PopupMenuTest.cpp', 695 696 ], -
trunk/Source/WebKit/chromium/WebKit.gypi
r96655 r96912 61 61 'tests/CCThreadTaskTest.cpp', 62 62 'tests/CCThreadTest.cpp', 63 'tests/FrameTestHelpers.cpp', 64 'tests/FrameTestHelpers.h', 63 65 'tests/IDBBindingUtilitiesTest.cpp', 64 66 'tests/IDBKeyPathTest.cpp', … … 81 83 'tests/WebFrameTest.cpp', 82 84 'tests/WebURLRequestTest.cpp', 85 'tests/WebViewTest.cpp', 83 86 ], 84 87 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r96878 r96912 1301 1301 { 1302 1302 m_page->focusController()->setFocused(enable); 1303 m_page->focusController()->setActive(enable); 1303 1304 if (enable) { 1304 // Note that we don't call setActive() when disabled as this cause extra1305 // focus/blur events to be dispatched.1306 m_page->focusController()->setActive(true);1307 1305 RefPtr<Frame> focusedFrame = m_page->focusController()->focusedFrame(); 1308 1306 if (focusedFrame) { -
trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp
r95901 r96912 31 31 #include "config.h" 32 32 33 #include "FrameTestHelpers.h" 33 34 #include "ResourceError.h" 34 35 #include "WebDocument.h" … … 40 41 #include "WebSecurityPolicy.h" 41 42 #include "WebSettings.h" 42 #include "WebString.h"43 #include "WebURL.h"44 #include "WebURLRequest.h"45 #include "WebURLResponse.h"46 #include "WebViewClient.h"47 43 #include "WebViewImpl.h" 48 44 #include "v8.h" 49 #include <googleurl/src/gurl.h>50 45 #include <gtest/gtest.h> 51 46 #include <webkit/support/webkit_support.h> … … 58 53 public: 59 54 WebFrameTest() 60 : baseURL("http://www.test.com/"),61 chromeURL("chrome://")55 : m_baseURL("http://www.test.com/"), 56 m_chromeURL("chrome://") 62 57 { 63 58 } … … 70 65 void registerMockedHttpURLLoad(const std::string& fileName) 71 66 { 72 registerMockedURLLoad(baseURL, fileName);67 FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName); 73 68 } 74 69 75 70 void registerMockedChromeURLLoad(const std::string& fileName) 76 71 { 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); 72 FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName); 114 73 } 115 74 116 75 protected: 117 std::string baseURL; 118 std::string chromeURL; 119 }; 120 121 class TestWebFrameClient : public WebFrameClient { 122 }; 123 124 class TestWebViewClient : public WebViewClient { 76 std::string m_baseURL; 77 std::string m_chromeURL; 125 78 }; 126 79 … … 132 85 registerMockedHttpURLLoad("zero_sized_iframe.html"); 133 86 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(); 87 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html"); 141 88 142 89 // Now retrieve the frames text and test it only includes visible elements. … … 158 105 registerMockedHttpURLLoad("zero_sized_iframe.html"); 159 106 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(); 107 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html", true); 168 108 169 109 v8::HandleScope scope; … … 182 122 registerMockedHttpURLLoad("form.html"); 183 123 184 TestWebFrameClient webFrameClient; 185 WebView* webView = WebView::create(0); 186 webView->initializeMainFrame(&webFrameClient); 187 188 loadHttpFrame(webView->mainFrame(), "form.html"); 189 serveRequests(); 124 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html"); 190 125 191 126 WebVector<WebFormElement> forms; … … 203 138 registerMockedChromeURLLoad("history.html"); 204 139 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(); 140 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true); 213 141 214 142 // Try to run JS against the chrome-style URL. 215 143 WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome"); 216 loadFrame(webView->mainFrame(), "javascript:", "document.body.appendChild(document.createTextNode('Clobbered'))");144 FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.body.appendChild(document.createTextNode('Clobbered'))"); 217 145 218 146 // Now retrieve the frames text and see if it was clobbered. … … 248 176 249 177 TestReloadDoesntRedirectWebFrameClient webFrameClient; 250 WebView* webView = WebView::create(0); 251 webView->initializeMainFrame(&webFrameClient); 252 253 loadHttpFrame(webView->mainFrame(), "form.html"); 254 serveRequests(); 255 // Frame is loaded. 178 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html", false, &webFrameClient); 256 179 257 180 webView->mainFrame()->reload(true); 258 181 // start reload before request is delivered. 259 182 webView->mainFrame()->reload(true); 260 serveRequests();183 webkit_support::ServeAsynchronousMockedRequests(); 261 184 } 262 185 … … 266 189 registerMockedHttpURLLoad("autofocus_input_field_iframe.html"); 267 190 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(); 191 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_clear_focused_node_test.html", true)); 277 192 278 193 // Clear the focused node. … … 354 269 // Load a frame with an iframe, make sure we get the right create notifications. 355 270 ContextLifetimeTestWebFrameClient 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(); 271 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 361 272 362 273 WebFrame* mainFrame = webView->mainFrame(); … … 396 307 397 308 ContextLifetimeTestWebFrameClient 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(); 309 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 403 310 404 311 // Refresh, we should get two release notifications and two more create notifications. 405 312 webView->mainFrame()->reload(false); 406 serveRequests();313 webkit_support::ServeAsynchronousMockedRequests(); 407 314 ASSERT_EQ(4u, webFrameClient.createNotifications.size()); 408 315 ASSERT_EQ(2u, webFrameClient.releaseNotifications.size()); … … 439 346 440 347 ContextLifetimeTestWebFrameClient 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(); 348 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "context_notifications_test.html", true, &webFrameClient); 446 349 447 350 // Add an isolated world.
Note: See TracChangeset
for help on using the changeset viewer.