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" | |
88 #include "platform/PlatformResourceLoader.h" | 89 #include "platform/PlatformResourceLoader.h" |
89 #include "platform/RuntimeEnabledFeatures.h" | 90 #include "platform/RuntimeEnabledFeatures.h" |
90 #include "platform/UserGestureIndicator.h" | 91 #include "platform/UserGestureIndicator.h" |
91 #include "platform/geometry/FloatRect.h" | 92 #include "platform/geometry/FloatRect.h" |
92 #include "platform/loader/fetch/FetchRequest.h" | 93 #include "platform/loader/fetch/FetchRequest.h" |
93 #include "platform/loader/fetch/MemoryCache.h" | 94 #include "platform/loader/fetch/MemoryCache.h" |
94 #include "platform/loader/fetch/ResourceFetcher.h" | 95 #include "platform/loader/fetch/ResourceFetcher.h" |
95 #include "platform/network/ResourceError.h" | 96 #include "platform/network/ResourceError.h" |
96 #include "platform/scroll/Scrollbar.h" | 97 #include "platform/scroll/Scrollbar.h" |
97 #include "platform/scroll/ScrollbarTestSuite.h" | 98 #include "platform/scroll/ScrollbarTestSuite.h" |
98 #include "platform/scroll/ScrollbarTheme.h" | 99 #include "platform/scroll/ScrollbarTheme.h" |
99 #include "platform/scroll/ScrollbarThemeMock.h" | 100 #include "platform/scroll/ScrollbarThemeMock.h" |
100 #include "platform/scroll/ScrollbarThemeOverlayMock.h" | 101 #include "platform/scroll/ScrollbarThemeOverlayMock.h" |
101 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 102 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
102 #include "platform/testing/URLTestHelpers.h" | 103 #include "platform/testing/URLTestHelpers.h" |
103 #include "platform/testing/UnitTestHelpers.h" | 104 #include "platform/testing/UnitTestHelpers.h" |
104 #include "platform/weborigin/KURLHash.h" | 105 #include "platform/weborigin/KURLHash.h" |
105 #include "platform/weborigin/SchemeRegistry.h" | 106 #include "platform/weborigin/SchemeRegistry.h" |
106 #include "platform/weborigin/SecurityOrigin.h" | 107 #include "platform/weborigin/SecurityOrigin.h" |
107 #include "public/platform/Platform.h" | 108 #include "public/platform/Platform.h" |
108 #include "public/platform/WebCache.h" | 109 #include "public/platform/WebCache.h" |
109 #include "public/platform/WebCachePolicy.h" | 110 #include "public/platform/WebCachePolicy.h" |
110 #include "public/platform/WebClipboard.h" | 111 #include "public/platform/WebClipboard.h" |
111 #include "public/platform/WebFloatRect.h" | 112 #include "public/platform/WebFloatRect.h" |
113 #include "public/platform/WebKeyboardEvent.h" | |
112 #include "public/platform/WebMockClipboard.h" | 114 #include "public/platform/WebMockClipboard.h" |
113 #include "public/platform/WebSecurityOrigin.h" | 115 #include "public/platform/WebSecurityOrigin.h" |
114 #include "public/platform/WebThread.h" | 116 #include "public/platform/WebThread.h" |
115 #include "public/platform/WebURL.h" | 117 #include "public/platform/WebURL.h" |
116 #include "public/platform/WebURLLoaderClient.h" | 118 #include "public/platform/WebURLLoaderClient.h" |
117 #include "public/platform/WebURLLoaderMockFactory.h" | 119 #include "public/platform/WebURLLoaderMockFactory.h" |
118 #include "public/platform/WebURLResponse.h" | 120 #include "public/platform/WebURLResponse.h" |
119 #include "public/web/WebConsoleMessage.h" | 121 #include "public/web/WebConsoleMessage.h" |
120 #include "public/web/WebDataSource.h" | 122 #include "public/web/WebDataSource.h" |
121 #include "public/web/WebDeviceEmulationParams.h" | 123 #include "public/web/WebDeviceEmulationParams.h" |
(...skipping 4128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4250 webViewHelper.initializeAndLoad( | 4252 webViewHelper.initializeAndLoad( |
4251 m_baseURL + "iframe_clear_focused_node_test.html", true); | 4253 m_baseURL + "iframe_clear_focused_node_test.html", true); |
4252 | 4254 |
4253 // Clear the focused node. | 4255 // Clear the focused node. |
4254 webViewHelper.webView()->clearFocusedElement(); | 4256 webViewHelper.webView()->clearFocusedElement(); |
4255 | 4257 |
4256 // Now retrieve the FocusedNode and test it should be null. | 4258 // Now retrieve the FocusedNode and test it should be null. |
4257 EXPECT_EQ(0, webViewHelper.webView()->focusedElement()); | 4259 EXPECT_EQ(0, webViewHelper.webView()->focusedElement()); |
4258 } | 4260 } |
4259 | 4261 |
4262 class ChangedSelectionCounter : public FrameTestHelpers::TestWebFrameClient { | |
4263 public: | |
4264 ChangedSelectionCounter() : m_callCount(0) {} | |
4265 void didChangeSelection(bool isSelectionEmpty) { ++m_callCount; } | |
4266 int count() const { return m_callCount; } | |
4267 void reset() { m_callCount = 0; } | |
4268 | |
4269 private: | |
4270 int m_callCount; | |
4271 }; | |
4272 | |
4273 TEST_P(ParameterizedWebFrameTest, TabKeyCursorMoveTriggersOneSelectionChange) { | |
4274 ChangedSelectionCounter counter; | |
4275 FrameTestHelpers::WebViewHelper webViewHelper; | |
4276 registerMockedHttpURLLoad("editable_elements.html"); | |
4277 WebViewImpl* webView = webViewHelper.initializeAndLoad( | |
4278 m_baseURL + "editable_elements.html", true, &counter); | |
4279 | |
4280 WebKeyboardEvent tabDownEvent(WebInputEvent::KeyDown, | |
4281 WebInputEvent::NoModifiers, | |
4282 WebInputEvent::TimeStampForTesting); | |
4283 WebKeyboardEvent tabUpEvent(WebInputEvent::KeyUp, WebInputEvent::NoModifiers, | |
4284 WebInputEvent::TimeStampForTesting); | |
4285 tabDownEvent.domKey = Platform::current()->domKeyEnumFromString("\t"); | |
4286 tabUpEvent.domKey = Platform::current()->domKeyEnumFromString("\t"); | |
4287 tabDownEvent.windowsKeyCode = VKEY_TAB; | |
4288 tabUpEvent.windowsKeyCode = VKEY_TAB; | |
4289 | |
4290 // Move to the next text-field: 1 cursor change. | |
4291 counter.reset(); | |
4292 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
4293 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
4294 EXPECT_EQ(1, counter.count()); | |
4295 | |
4296 // Move to another text-field: 1 cursor change. | |
4297 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
4298 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
4299 EXPECT_EQ(2, counter.count()); | |
4300 | |
4301 // Move to a number-field: 1 cursor change. | |
4302 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
4303 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
4304 EXPECT_EQ(3, counter.count()); | |
4305 | |
4306 // Move to an editable element: 1 cursor change. | |
4307 webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
4308 webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
4309 EXPECT_EQ(4, counter.count()); | |
4310 | |
4311 // Move to a non-editable element: 0 cursor changes. | |
4312 // TODO(blink-editing): Once we've fixed crbug.com/692898 test this too: | |
yosin_UTC9
2017/03/21 06:49:59
nit: s/blink-editing/editing-dev/
hugoh_UTC2
2017/03/22 02:54:47
Done.
| |
4313 // webView->handleInputEvent(WebCoalescedInputEvent(tabDownEvent)); | |
4314 // webView->handleInputEvent(WebCoalescedInputEvent(tabUpEvent)); | |
4315 // EXPECT_EQ(4, counter.count()); | |
4316 } | |
4317 | |
4260 // Implementation of WebFrameClient that tracks the v8 contexts that are created | 4318 // Implementation of WebFrameClient that tracks the v8 contexts that are created |
4261 // and destroyed for verification. | 4319 // and destroyed for verification. |
4262 class ContextLifetimeTestWebFrameClient | 4320 class ContextLifetimeTestWebFrameClient |
4263 : public FrameTestHelpers::TestWebFrameClient { | 4321 : public FrameTestHelpers::TestWebFrameClient { |
4264 public: | 4322 public: |
4265 struct Notification { | 4323 struct Notification { |
4266 public: | 4324 public: |
4267 Notification(WebLocalFrame* frame, | 4325 Notification(WebLocalFrame* frame, |
4268 v8::Local<v8::Context> context, | 4326 v8::Local<v8::Context> context, |
4269 int worldId) | 4327 int worldId) |
(...skipping 7092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11362 FrameTestHelpers::WebViewHelper openerHelper; | 11420 FrameTestHelpers::WebViewHelper openerHelper; |
11363 openerHelper.initialize(false, nullptr, &openerWebViewClient); | 11421 openerHelper.initialize(false, nullptr, &openerWebViewClient); |
11364 FrameTestHelpers::WebViewHelper helper; | 11422 FrameTestHelpers::WebViewHelper helper; |
11365 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); | 11423 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); |
11366 | 11424 |
11367 openerHelper.reset(); | 11425 openerHelper.reset(); |
11368 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); | 11426 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); |
11369 } | 11427 } |
11370 | 11428 |
11371 } // namespace blink | 11429 } // namespace blink |
OLD | NEW |