| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "core/loader/FrameLoadRequest.h" | 78 #include "core/loader/FrameLoadRequest.h" |
| 79 #include "core/loader/ThreadableLoader.h" | 79 #include "core/loader/ThreadableLoader.h" |
| 80 #include "core/page/Page.h" | 80 #include "core/page/Page.h" |
| 81 #include "core/page/ScopedPageSuspender.h" | 81 #include "core/page/ScopedPageSuspender.h" |
| 82 #include "core/paint/PaintLayer.h" | 82 #include "core/paint/PaintLayer.h" |
| 83 #include "core/testing/NullExecutionContext.h" | 83 #include "core/testing/NullExecutionContext.h" |
| 84 #include "modules/mediastream/MediaStream.h" | 84 #include "modules/mediastream/MediaStream.h" |
| 85 #include "modules/mediastream/MediaStreamRegistry.h" | 85 #include "modules/mediastream/MediaStreamRegistry.h" |
| 86 #include "platform/Cursor.h" | 86 #include "platform/Cursor.h" |
| 87 #include "platform/DragImage.h" | 87 #include "platform/DragImage.h" |
| 88 #include "platform/KeyboardCodes.h" | |
| 89 #include "platform/PlatformResourceLoader.h" | 88 #include "platform/PlatformResourceLoader.h" |
| 90 #include "platform/RuntimeEnabledFeatures.h" | 89 #include "platform/RuntimeEnabledFeatures.h" |
| 91 #include "platform/UserGestureIndicator.h" | 90 #include "platform/UserGestureIndicator.h" |
| 92 #include "platform/geometry/FloatRect.h" | 91 #include "platform/geometry/FloatRect.h" |
| 93 #include "platform/loader/fetch/FetchRequest.h" | 92 #include "platform/loader/fetch/FetchRequest.h" |
| 94 #include "platform/loader/fetch/MemoryCache.h" | 93 #include "platform/loader/fetch/MemoryCache.h" |
| 95 #include "platform/loader/fetch/ResourceError.h" | 94 #include "platform/loader/fetch/ResourceError.h" |
| 96 #include "platform/loader/fetch/ResourceFetcher.h" | 95 #include "platform/loader/fetch/ResourceFetcher.h" |
| 97 #include "platform/scroll/Scrollbar.h" | 96 #include "platform/scroll/Scrollbar.h" |
| 98 #include "platform/scroll/ScrollbarTestSuite.h" | 97 #include "platform/scroll/ScrollbarTestSuite.h" |
| 99 #include "platform/scroll/ScrollbarTheme.h" | 98 #include "platform/scroll/ScrollbarTheme.h" |
| 100 #include "platform/scroll/ScrollbarThemeMock.h" | 99 #include "platform/scroll/ScrollbarThemeMock.h" |
| 101 #include "platform/scroll/ScrollbarThemeOverlayMock.h" | 100 #include "platform/scroll/ScrollbarThemeOverlayMock.h" |
| 102 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 101 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 103 #include "platform/testing/URLTestHelpers.h" | 102 #include "platform/testing/URLTestHelpers.h" |
| 104 #include "platform/testing/UnitTestHelpers.h" | 103 #include "platform/testing/UnitTestHelpers.h" |
| 105 #include "platform/weborigin/KURLHash.h" | 104 #include "platform/weborigin/KURLHash.h" |
| 106 #include "platform/weborigin/SchemeRegistry.h" | 105 #include "platform/weborigin/SchemeRegistry.h" |
| 107 #include "platform/weborigin/SecurityOrigin.h" | 106 #include "platform/weborigin/SecurityOrigin.h" |
| 108 #include "public/platform/Platform.h" | 107 #include "public/platform/Platform.h" |
| 109 #include "public/platform/WebCache.h" | 108 #include "public/platform/WebCache.h" |
| 110 #include "public/platform/WebCachePolicy.h" | 109 #include "public/platform/WebCachePolicy.h" |
| 111 #include "public/platform/WebClipboard.h" | 110 #include "public/platform/WebClipboard.h" |
| 112 #include "public/platform/WebFloatRect.h" | 111 #include "public/platform/WebFloatRect.h" |
| 113 #include "public/platform/WebKeyboardEvent.h" | |
| 114 #include "public/platform/WebMockClipboard.h" | 112 #include "public/platform/WebMockClipboard.h" |
| 115 #include "public/platform/WebSecurityOrigin.h" | 113 #include "public/platform/WebSecurityOrigin.h" |
| 116 #include "public/platform/WebThread.h" | 114 #include "public/platform/WebThread.h" |
| 117 #include "public/platform/WebURL.h" | 115 #include "public/platform/WebURL.h" |
| 118 #include "public/platform/WebURLLoaderClient.h" | 116 #include "public/platform/WebURLLoaderClient.h" |
| 119 #include "public/platform/WebURLLoaderMockFactory.h" | 117 #include "public/platform/WebURLLoaderMockFactory.h" |
| 120 #include "public/platform/WebURLResponse.h" | 118 #include "public/platform/WebURLResponse.h" |
| 121 #include "public/web/WebConsoleMessage.h" | 119 #include "public/web/WebConsoleMessage.h" |
| 122 #include "public/web/WebContextMenuData.h" | 120 #include "public/web/WebContextMenuData.h" |
| 123 #include "public/web/WebDataSource.h" | 121 #include "public/web/WebDataSource.h" |
| (...skipping 4140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4264 webViewHelper.initializeAndLoad( | 4262 webViewHelper.initializeAndLoad( |
| 4265 m_baseURL + "iframe_clear_focused_node_test.html", true); | 4263 m_baseURL + "iframe_clear_focused_node_test.html", true); |
| 4266 | 4264 |
| 4267 // Clear the focused node. | 4265 // Clear the focused node. |
| 4268 webViewHelper.webView()->clearFocusedElement(); | 4266 webViewHelper.webView()->clearFocusedElement(); |
| 4269 | 4267 |
| 4270 // Now retrieve the FocusedNode and test it should be null. | 4268 // Now retrieve the FocusedNode and test it should be null. |
| 4271 EXPECT_EQ(0, webViewHelper.webView()->focusedElement()); | 4269 EXPECT_EQ(0, webViewHelper.webView()->focusedElement()); |
| 4272 } | 4270 } |
| 4273 | 4271 |
| 4274 class ChangedSelectionCounter : public FrameTestHelpers::TestWebFrameClient { | |
| 4275 public: | |
| 4276 ChangedSelectionCounter() : m_callCount(0) {} | |
| 4277 void didChangeSelection(bool isSelectionEmpty) { ++m_callCount; } | |
| 4278 int count() const { return m_callCount; } | |
| 4279 void reset() { m_callCount = 0; } | |
| 4280 | |
| 4281 private: | |
| 4282 int m_callCount; | |
| 4283 }; | |
| 4284 | |
| 4285 TEST_P(ParameterizedWebFrameTest, TabKeyCursorMoveTriggersOneSelectionChange) { | |
| 4286 ChangedSelectionCounter counter; | |
| 4287 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 4288 registerMockedHttpURLLoad("editable_elements.html"); | |
| 4289 WebViewImpl* webView = webViewHelper.initializeAndLoad( | |
| 4290 m_baseURL + "editable_elements.html", true, &counter); | |
| 4291 | |
| 4292 WebKeyboardEvent tabDownEvent(WebInputEvent::KeyDown, | |
| 4293 WebInputEvent::NoModifiers, | |
| 4294 WebInputEvent::TimeStampForTesting); | |
| 4295 WebKeyboardEvent tabUpEvent(WebInputEvent::KeyUp, WebInputEvent::NoModifiers, | |
| 4296 WebInputEvent::TimeStampForTesting); | |
| 4297 tabDownEvent.domKey = Platform::current()->domKeyEnumFromString("\t"); | |
| 4298 tabUpEvent.domKey = Platform::current()->domKeyEnumFromString("\t"); | |
| 4299 tabDownEvent.windowsKeyCode = VKEY_TAB; | |
| 4300 tabUpEvent.windowsKeyCode = VKEY_TAB; | |
| 4301 | |
| 4302 // Move to the next text-field: 1 cursor change. | |
| 4303 counter.reset(); | |
| 4304 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
| 4305 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
| 4306 EXPECT_EQ(1, counter.count()); | |
| 4307 | |
| 4308 // Move to another text-field: 1 cursor change. | |
| 4309 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
| 4310 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
| 4311 EXPECT_EQ(2, counter.count()); | |
| 4312 | |
| 4313 // Move to a number-field: 1 cursor change. | |
| 4314 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
| 4315 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
| 4316 EXPECT_EQ(3, counter.count()); | |
| 4317 | |
| 4318 // Move to an editable element: 1 cursor change. | |
| 4319 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
| 4320 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
| 4321 EXPECT_EQ(4, counter.count()); | |
| 4322 | |
| 4323 // Move to a non-editable element: 0 cursor changes. | |
| 4324 // TODO(editing-dev): Once we've fixed crbug.com/692898 test this too: | |
| 4325 // webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
| 4326 // webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
| 4327 // EXPECT_EQ(4, counter.count()); | |
| 4328 } | |
| 4329 | |
| 4330 // Implementation of WebFrameClient that tracks the v8 contexts that are created | 4272 // Implementation of WebFrameClient that tracks the v8 contexts that are created |
| 4331 // and destroyed for verification. | 4273 // and destroyed for verification. |
| 4332 class ContextLifetimeTestWebFrameClient | 4274 class ContextLifetimeTestWebFrameClient |
| 4333 : public FrameTestHelpers::TestWebFrameClient { | 4275 : public FrameTestHelpers::TestWebFrameClient { |
| 4334 public: | 4276 public: |
| 4335 struct Notification { | 4277 struct Notification { |
| 4336 public: | 4278 public: |
| 4337 Notification(WebLocalFrame* frame, | 4279 Notification(WebLocalFrame* frame, |
| 4338 v8::Local<v8::Context> context, | 4280 v8::Local<v8::Context> context, |
| 4339 int worldId) | 4281 int worldId) |
| (...skipping 7242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11582 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page"); | 11524 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page"); |
| 11583 | 11525 |
| 11584 // Local frame with remote parent should have transparent baseBackgroundColor. | 11526 // Local frame with remote parent should have transparent baseBackgroundColor. |
| 11585 Color color = localFrame->frameView()->baseBackgroundColor(); | 11527 Color color = localFrame->frameView()->baseBackgroundColor(); |
| 11586 EXPECT_EQ(Color::transparent, color); | 11528 EXPECT_EQ(Color::transparent, color); |
| 11587 | 11529 |
| 11588 view->close(); | 11530 view->close(); |
| 11589 } | 11531 } |
| 11590 | 11532 |
| 11591 } // namespace blink | 11533 } // namespace blink |
| OLD | NEW |