OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "ipc/ipc.mojom.h" | 61 #include "ipc/ipc.mojom.h" |
62 #include "ipc/ipc_security_test_util.h" | 62 #include "ipc/ipc_security_test_util.h" |
63 #include "net/dns/mock_host_resolver.h" | 63 #include "net/dns/mock_host_resolver.h" |
64 #include "net/test/embedded_test_server/embedded_test_server.h" | 64 #include "net/test/embedded_test_server/embedded_test_server.h" |
65 #include "testing/gtest/include/gtest/gtest.h" | 65 #include "testing/gtest/include/gtest/gtest.h" |
66 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 66 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
67 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" | 67 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" |
68 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 68 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
69 #include "ui/display/display_switches.h" | 69 #include "ui/display/display_switches.h" |
70 #include "ui/display/screen.h" | 70 #include "ui/display/screen.h" |
| 71 #include "ui/events/base_event_utils.h" |
71 #include "ui/events/event.h" | 72 #include "ui/events/event.h" |
72 #include "ui/events/event_utils.h" | 73 #include "ui/events/event_utils.h" |
73 #include "ui/events/latency_info.h" | 74 #include "ui/events/latency_info.h" |
74 #include "ui/gfx/geometry/point.h" | 75 #include "ui/gfx/geometry/point.h" |
75 #include "ui/native_theme/native_theme_switches.h" | 76 #include "ui/native_theme/native_theme_switches.h" |
76 | 77 |
77 #if defined(USE_AURA) | 78 #if defined(USE_AURA) |
78 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 79 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
79 #endif | 80 #endif |
80 | 81 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 "window.domAutomationController.send(" | 134 "window.domAutomationController.send(" |
134 " !!window.open('" + url.spec() + "', '" + name + "'));", | 135 " !!window.open('" + url.spec() + "', '" + name + "'));", |
135 &success)); | 136 &success)); |
136 EXPECT_TRUE(success); | 137 EXPECT_TRUE(success); |
137 } | 138 } |
138 | 139 |
139 // Helper function to generate a click on the given RenderWidgetHost. The | 140 // Helper function to generate a click on the given RenderWidgetHost. The |
140 // mouse event is forwarded directly to the RenderWidgetHost without any | 141 // mouse event is forwarded directly to the RenderWidgetHost without any |
141 // hit-testing. | 142 // hit-testing. |
142 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { | 143 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { |
143 blink::WebMouseEvent mouse_event; | 144 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
144 mouse_event.type = blink::WebInputEvent::MouseDown; | 145 blink::WebInputEvent::NoModifiers, |
| 146 blink::WebInputEvent::TimeStampForTesting); |
145 mouse_event.button = blink::WebPointerProperties::Button::Left; | 147 mouse_event.button = blink::WebPointerProperties::Button::Left; |
146 mouse_event.x = x; | 148 mouse_event.x = x; |
147 mouse_event.y = y; | 149 mouse_event.y = y; |
148 rwh->ForwardMouseEvent(mouse_event); | 150 rwh->ForwardMouseEvent(mouse_event); |
149 } | 151 } |
150 | 152 |
151 // Retrieve document.origin for the frame |ftn|. | 153 // Retrieve document.origin for the frame |ftn|. |
152 std::string GetDocumentOrigin(FrameTreeNode* ftn) { | 154 std::string GetDocumentOrigin(FrameTreeNode* ftn) { |
153 std::string origin; | 155 std::string origin; |
154 EXPECT_TRUE(ExecuteScriptAndExtractString( | 156 EXPECT_TRUE(ExecuteScriptAndExtractString( |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 250 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
249 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 251 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
250 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 252 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
251 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 253 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
252 | 254 |
253 SurfaceHitTestReadyNotifier notifier( | 255 SurfaceHitTestReadyNotifier notifier( |
254 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); | 256 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); |
255 notifier.WaitForSurfaceReady(); | 257 notifier.WaitForSurfaceReady(); |
256 | 258 |
257 // Target input event to child frame. | 259 // Target input event to child frame. |
258 blink::WebMouseEvent child_event; | 260 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, |
259 child_event.type = blink::WebInputEvent::MouseDown; | 261 blink::WebInputEvent::NoModifiers, |
| 262 blink::WebInputEvent::TimeStampForTesting); |
260 child_event.button = blink::WebPointerProperties::Button::Left; | 263 child_event.button = blink::WebPointerProperties::Button::Left; |
261 child_event.x = 75; | 264 child_event.x = 75; |
262 child_event.y = 75; | 265 child_event.y = 75; |
263 child_event.clickCount = 1; | 266 child_event.clickCount = 1; |
264 main_frame_monitor.ResetEventReceived(); | 267 main_frame_monitor.ResetEventReceived(); |
265 child_frame_monitor.ResetEventReceived(); | 268 child_frame_monitor.ResetEventReceived(); |
266 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); | 269 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); |
267 | 270 |
268 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 271 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
269 EXPECT_EQ(23, child_frame_monitor.event().x); | 272 EXPECT_EQ(23, child_frame_monitor.event().x); |
270 EXPECT_EQ(23, child_frame_monitor.event().y); | 273 EXPECT_EQ(23, child_frame_monitor.event().y); |
271 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 274 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
272 | 275 |
273 child_frame_monitor.ResetEventReceived(); | 276 child_frame_monitor.ResetEventReceived(); |
274 main_frame_monitor.ResetEventReceived(); | 277 main_frame_monitor.ResetEventReceived(); |
275 | 278 |
276 // Target input event to main frame. | 279 // Target input event to main frame. |
277 blink::WebMouseEvent main_event; | 280 blink::WebMouseEvent main_event(blink::WebInputEvent::MouseDown, |
278 main_event.type = blink::WebInputEvent::MouseDown; | 281 blink::WebInputEvent::NoModifiers, |
| 282 blink::WebInputEvent::TimeStampForTesting); |
279 main_event.button = blink::WebPointerProperties::Button::Left; | 283 main_event.button = blink::WebPointerProperties::Button::Left; |
280 main_event.x = 1; | 284 main_event.x = 1; |
281 main_event.y = 1; | 285 main_event.y = 1; |
282 main_event.clickCount = 1; | 286 main_event.clickCount = 1; |
283 // Ladies and gentlemen, THIS is the main_event! | 287 // Ladies and gentlemen, THIS is the main_event! |
284 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo()); | 288 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo()); |
285 | 289 |
286 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 290 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
287 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 291 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
288 EXPECT_EQ(1, main_frame_monitor.event().x); | 292 EXPECT_EQ(1, main_frame_monitor.event().x); |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 gfx::Rect bounds = rwhv_nested->GetViewBounds(); | 997 gfx::Rect bounds = rwhv_nested->GetViewBounds(); |
994 EXPECT_EQ(bounds.x() - rwhv_root->GetViewBounds().x(), 397); | 998 EXPECT_EQ(bounds.x() - rwhv_root->GetViewBounds().x(), 397); |
995 EXPECT_EQ(bounds.y() - rwhv_root->GetViewBounds().y(), 112); | 999 EXPECT_EQ(bounds.y() - rwhv_root->GetViewBounds().y(), 112); |
996 | 1000 |
997 scoped_refptr<FrameRectChangedMessageFilter> filter = | 1001 scoped_refptr<FrameRectChangedMessageFilter> filter = |
998 new FrameRectChangedMessageFilter(); | 1002 new FrameRectChangedMessageFilter(); |
999 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 1003 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
1000 | 1004 |
1001 // Scroll the parent frame downward to verify that the child rect gets updated | 1005 // Scroll the parent frame downward to verify that the child rect gets updated |
1002 // correctly. | 1006 // correctly. |
1003 blink::WebMouseWheelEvent scroll_event; | 1007 blink::WebMouseWheelEvent scroll_event( |
1004 scroll_event.type = blink::WebInputEvent::MouseWheel; | 1008 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, |
| 1009 blink::WebInputEvent::TimeStampForTesting); |
1005 scroll_event.x = 387; | 1010 scroll_event.x = 387; |
1006 scroll_event.y = 110; | 1011 scroll_event.y = 110; |
1007 scroll_event.deltaX = 0.0f; | 1012 scroll_event.deltaX = 0.0f; |
1008 scroll_event.deltaY = -30.0f; | 1013 scroll_event.deltaY = -30.0f; |
1009 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); | 1014 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
1010 | 1015 |
1011 filter->Wait(); | 1016 filter->Wait(); |
1012 | 1017 |
1013 // The precise amount of scroll for the first view position update is not | 1018 // The precise amount of scroll for the first view position update is not |
1014 // deterministic, so this simply verifies that the OOPIF moved from its | 1019 // deterministic, so this simply verifies that the OOPIF moved from its |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested)); | 1085 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested)); |
1081 notifier.WaitForSurfaceReady(); | 1086 notifier.WaitForSurfaceReady(); |
1082 | 1087 |
1083 // Save the original offset as a point of reference. | 1088 // Save the original offset as a point of reference. |
1084 filter->Wait(); | 1089 filter->Wait(); |
1085 gfx::Rect update_rect = filter->last_rect(); | 1090 gfx::Rect update_rect = filter->last_rect(); |
1086 int initial_y = update_rect.y(); | 1091 int initial_y = update_rect.y(); |
1087 filter->Reset(); | 1092 filter->Reset(); |
1088 | 1093 |
1089 // Scroll the parent frame downward. | 1094 // Scroll the parent frame downward. |
1090 blink::WebMouseWheelEvent scroll_event; | 1095 blink::WebMouseWheelEvent scroll_event( |
1091 scroll_event.type = blink::WebInputEvent::MouseWheel; | 1096 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, |
| 1097 blink::WebInputEvent::TimeStampForTesting); |
1092 scroll_event.x = 1; | 1098 scroll_event.x = 1; |
1093 scroll_event.y = 1; | 1099 scroll_event.y = 1; |
1094 scroll_event.deltaX = 0.0f; | 1100 scroll_event.deltaX = 0.0f; |
1095 scroll_event.deltaY = -5.0f; | 1101 scroll_event.deltaY = -5.0f; |
1096 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); | 1102 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
1097 | 1103 |
1098 // Ensure that the view position is propagated to the child properly. | 1104 // Ensure that the view position is propagated to the child properly. |
1099 filter->Wait(); | 1105 filter->Wait(); |
1100 update_rect = filter->last_rect(); | 1106 update_rect = filter->last_rect(); |
1101 EXPECT_LT(update_rect.y(), initial_y); | 1107 EXPECT_LT(update_rect.y(), initial_y); |
(...skipping 27 matching lines...) Expand all Loading... |
1129 // gestures. | 1135 // gestures. |
1130 scroll_event.deltaY = -5.0f; | 1136 scroll_event.deltaY = -5.0f; |
1131 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); | 1137 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
1132 | 1138 |
1133 // Ensure ensuing offset change is received, and then reset the filter. | 1139 // Ensure ensuing offset change is received, and then reset the filter. |
1134 filter->Wait(); | 1140 filter->Wait(); |
1135 filter->Reset(); | 1141 filter->Reset(); |
1136 | 1142 |
1137 // Scroll down the nested iframe via gesture. This requires 3 separate input | 1143 // Scroll down the nested iframe via gesture. This requires 3 separate input |
1138 // events. | 1144 // events. |
1139 blink::WebGestureEvent gesture_event; | 1145 blink::WebGestureEvent gesture_event( |
1140 gesture_event.type = blink::WebGestureEvent::GestureScrollBegin; | 1146 blink::WebGestureEvent::GestureScrollBegin, |
| 1147 blink::WebInputEvent::NoModifiers, |
| 1148 blink::WebInputEvent::TimeStampForTesting); |
1141 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad; | 1149 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad; |
1142 gesture_event.x = 1; | 1150 gesture_event.x = 1; |
1143 gesture_event.y = 1; | 1151 gesture_event.y = 1; |
1144 rwhv_nested->GetRenderWidgetHost()->ForwardGestureEvent(gesture_event); | 1152 rwhv_nested->GetRenderWidgetHost()->ForwardGestureEvent(gesture_event); |
1145 | 1153 |
1146 gesture_event.type = blink::WebGestureEvent::GestureScrollUpdate; | 1154 gesture_event.setType(blink::WebGestureEvent::GestureScrollUpdate); |
1147 gesture_event.data.scrollUpdate.deltaX = 0.0f; | 1155 gesture_event.data.scrollUpdate.deltaX = 0.0f; |
1148 gesture_event.data.scrollUpdate.deltaY = 6.0f; | 1156 gesture_event.data.scrollUpdate.deltaY = 6.0f; |
1149 gesture_event.data.scrollUpdate.velocityX = 0; | 1157 gesture_event.data.scrollUpdate.velocityX = 0; |
1150 gesture_event.data.scrollUpdate.velocityY = 0; | 1158 gesture_event.data.scrollUpdate.velocityY = 0; |
1151 rwhv_nested->GetRenderWidgetHost()->ForwardGestureEvent(gesture_event); | 1159 rwhv_nested->GetRenderWidgetHost()->ForwardGestureEvent(gesture_event); |
1152 | 1160 |
1153 gesture_event.type = blink::WebGestureEvent::GestureScrollEnd; | 1161 gesture_event.setType(blink::WebGestureEvent::GestureScrollEnd); |
1154 rwhv_nested->GetRenderWidgetHost()->ForwardGestureEvent(gesture_event); | 1162 rwhv_nested->GetRenderWidgetHost()->ForwardGestureEvent(gesture_event); |
1155 | 1163 |
1156 filter->Wait(); | 1164 filter->Wait(); |
1157 update_rect = filter->last_rect(); | 1165 update_rect = filter->last_rect(); |
1158 // As above, if this loop does not terminate then it indicates an issue | 1166 // As above, if this loop does not terminate then it indicates an issue |
1159 // with scroll bubbling. | 1167 // with scroll bubbling. |
1160 while (update_rect.y() > initial_y) { | 1168 while (update_rect.y() > initial_y) { |
1161 base::RunLoop run_loop; | 1169 base::RunLoop run_loop; |
1162 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1170 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1163 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); | 1171 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 static_cast<RenderWidgetHostViewBase*>( | 1324 static_cast<RenderWidgetHostViewBase*>( |
1317 nested_iframe_node->current_frame_host() | 1325 nested_iframe_node->current_frame_host() |
1318 ->GetRenderWidgetHost() | 1326 ->GetRenderWidgetHost() |
1319 ->GetView()); | 1327 ->GetView()); |
1320 | 1328 |
1321 SurfaceHitTestReadyNotifier notifier( | 1329 SurfaceHitTestReadyNotifier notifier( |
1322 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested)); | 1330 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested)); |
1323 notifier.WaitForSurfaceReady(); | 1331 notifier.WaitForSurfaceReady(); |
1324 | 1332 |
1325 // Target input event to nested frame. | 1333 // Target input event to nested frame. |
1326 blink::WebMouseEvent nested_event; | 1334 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown, |
1327 nested_event.type = blink::WebInputEvent::MouseDown; | 1335 blink::WebInputEvent::NoModifiers, |
| 1336 blink::WebInputEvent::TimeStampForTesting); |
1328 nested_event.button = blink::WebPointerProperties::Button::Left; | 1337 nested_event.button = blink::WebPointerProperties::Button::Left; |
1329 nested_event.x = 125; | 1338 nested_event.x = 125; |
1330 nested_event.y = 125; | 1339 nested_event.y = 125; |
1331 nested_event.clickCount = 1; | 1340 nested_event.clickCount = 1; |
1332 nested_frame_monitor.ResetEventReceived(); | 1341 nested_frame_monitor.ResetEventReceived(); |
1333 main_frame_monitor.ResetEventReceived(); | 1342 main_frame_monitor.ResetEventReceived(); |
1334 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo()); | 1343 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo()); |
1335 | 1344 |
1336 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); | 1345 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); |
1337 EXPECT_EQ(21, nested_frame_monitor.event().x); | 1346 EXPECT_EQ(21, nested_frame_monitor.event().x); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 1386 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
1378 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1387 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
1379 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 1388 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
1380 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1389 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
1381 | 1390 |
1382 SurfaceHitTestReadyNotifier notifier( | 1391 SurfaceHitTestReadyNotifier notifier( |
1383 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); | 1392 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); |
1384 notifier.WaitForSurfaceReady(); | 1393 notifier.WaitForSurfaceReady(); |
1385 | 1394 |
1386 // Target input event to child frame. | 1395 // Target input event to child frame. |
1387 blink::WebMouseEvent child_event; | 1396 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, |
1388 child_event.type = blink::WebInputEvent::MouseDown; | 1397 blink::WebInputEvent::NoModifiers, |
| 1398 blink::WebInputEvent::TimeStampForTesting); |
1389 child_event.button = blink::WebPointerProperties::Button::Left; | 1399 child_event.button = blink::WebPointerProperties::Button::Left; |
1390 child_event.x = 75; | 1400 child_event.x = 75; |
1391 child_event.y = 75; | 1401 child_event.y = 75; |
1392 child_event.clickCount = 1; | 1402 child_event.clickCount = 1; |
1393 main_frame_monitor.ResetEventReceived(); | 1403 main_frame_monitor.ResetEventReceived(); |
1394 child_frame_monitor.ResetEventReceived(); | 1404 child_frame_monitor.ResetEventReceived(); |
1395 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); | 1405 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); |
1396 | 1406 |
1397 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1407 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
1398 EXPECT_EQ(75, main_frame_monitor.event().x); | 1408 EXPECT_EQ(75, main_frame_monitor.event().x); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 b_node->current_frame_host()->GetRenderWidgetHost()); | 1473 b_node->current_frame_host()->GetRenderWidgetHost()); |
1464 RenderWidgetHostMouseEventMonitor c_frame_monitor( | 1474 RenderWidgetHostMouseEventMonitor c_frame_monitor( |
1465 c_node->current_frame_host()->GetRenderWidgetHost()); | 1475 c_node->current_frame_host()->GetRenderWidgetHost()); |
1466 RenderWidgetHostMouseEventMonitor d_frame_monitor( | 1476 RenderWidgetHostMouseEventMonitor d_frame_monitor( |
1467 d_node->current_frame_host()->GetRenderWidgetHost()); | 1477 d_node->current_frame_host()->GetRenderWidgetHost()); |
1468 | 1478 |
1469 gfx::Point point_in_a_frame(2, 2); | 1479 gfx::Point point_in_a_frame(2, 2); |
1470 gfx::Point point_in_b_frame(313, 147); | 1480 gfx::Point point_in_b_frame(313, 147); |
1471 gfx::Point point_in_d_frame(471, 207); | 1481 gfx::Point point_in_d_frame(471, 207); |
1472 | 1482 |
1473 blink::WebMouseEvent mouse_event; | 1483 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove, |
1474 mouse_event.type = blink::WebInputEvent::MouseMove; | 1484 blink::WebInputEvent::NoModifiers, |
| 1485 blink::WebInputEvent::TimeStampForTesting); |
1475 mouse_event.x = point_in_a_frame.x(); | 1486 mouse_event.x = point_in_a_frame.x(); |
1476 mouse_event.y = point_in_a_frame.y(); | 1487 mouse_event.y = point_in_a_frame.y(); |
1477 | 1488 |
1478 // Send an initial MouseMove to the root view, which shouldn't affect the | 1489 // Send an initial MouseMove to the root view, which shouldn't affect the |
1479 // other renderers. | 1490 // other renderers. |
1480 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, | 1491 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, |
1481 ui::LatencyInfo()); | 1492 ui::LatencyInfo()); |
1482 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); | 1493 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); |
1483 a_frame_monitor.ResetEventReceived(); | 1494 a_frame_monitor.ResetEventReceived(); |
1484 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); | 1495 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 1563 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
1553 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1564 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
1554 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 1565 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
1555 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1566 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
1556 | 1567 |
1557 SurfaceHitTestReadyNotifier notifier( | 1568 SurfaceHitTestReadyNotifier notifier( |
1558 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); | 1569 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); |
1559 notifier.WaitForSurfaceReady(); | 1570 notifier.WaitForSurfaceReady(); |
1560 | 1571 |
1561 // Target MouseDown to child frame. | 1572 // Target MouseDown to child frame. |
1562 blink::WebMouseEvent mouse_event; | 1573 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
1563 mouse_event.type = blink::WebInputEvent::MouseDown; | 1574 blink::WebInputEvent::NoModifiers, |
| 1575 blink::WebInputEvent::TimeStampForTesting); |
1564 mouse_event.button = blink::WebPointerProperties::Button::Left; | 1576 mouse_event.button = blink::WebPointerProperties::Button::Left; |
1565 mouse_event.x = 75; | 1577 mouse_event.x = 75; |
1566 mouse_event.y = 75; | 1578 mouse_event.y = 75; |
1567 mouse_event.clickCount = 1; | 1579 mouse_event.clickCount = 1; |
1568 main_frame_monitor.ResetEventReceived(); | 1580 main_frame_monitor.ResetEventReceived(); |
1569 child_frame_monitor.ResetEventReceived(); | 1581 child_frame_monitor.ResetEventReceived(); |
1570 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1582 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1571 | 1583 |
1572 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1584 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
1573 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1585 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
1574 | 1586 |
1575 // Target MouseMove to main frame. This should still be routed to the | 1587 // Target MouseMove to main frame. This should still be routed to the |
1576 // child frame because it is now capturing mouse input. | 1588 // child frame because it is now capturing mouse input. |
1577 mouse_event.type = blink::WebInputEvent::MouseMove; | 1589 mouse_event.setType(blink::WebInputEvent::MouseMove); |
1578 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; | 1590 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown); |
1579 mouse_event.x = 1; | 1591 mouse_event.x = 1; |
1580 mouse_event.y = 1; | 1592 mouse_event.y = 1; |
1581 // Note that this event is sent twice, with the monitors cleared after | 1593 // Note that this event is sent twice, with the monitors cleared after |
1582 // the first time, because the first MouseMove to the child frame | 1594 // the first time, because the first MouseMove to the child frame |
1583 // causes a MouseMove to be sent to the main frame also, which we | 1595 // causes a MouseMove to be sent to the main frame also, which we |
1584 // need to ignore. | 1596 // need to ignore. |
1585 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1597 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1586 main_frame_monitor.ResetEventReceived(); | 1598 main_frame_monitor.ResetEventReceived(); |
1587 child_frame_monitor.ResetEventReceived(); | 1599 child_frame_monitor.ResetEventReceived(); |
1588 mouse_event.x = 1; | 1600 mouse_event.x = 1; |
1589 mouse_event.y = 2; | 1601 mouse_event.y = 2; |
1590 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1602 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1591 | 1603 |
1592 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1604 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
1593 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1605 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
1594 | 1606 |
1595 // A MouseUp to the child frame should cancel the mouse capture. | 1607 // A MouseUp to the child frame should cancel the mouse capture. |
1596 mouse_event.type = blink::WebInputEvent::MouseUp; | 1608 mouse_event.setType(blink::WebInputEvent::MouseUp); |
1597 mouse_event.modifiers = 0; | 1609 mouse_event.setModifiers(blink::WebInputEvent::NoModifiers); |
1598 mouse_event.x = 75; | 1610 mouse_event.x = 75; |
1599 mouse_event.y = 75; | 1611 mouse_event.y = 75; |
1600 main_frame_monitor.ResetEventReceived(); | 1612 main_frame_monitor.ResetEventReceived(); |
1601 child_frame_monitor.ResetEventReceived(); | 1613 child_frame_monitor.ResetEventReceived(); |
1602 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1614 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1603 | 1615 |
1604 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1616 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
1605 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1617 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
1606 | 1618 |
1607 // Subsequent MouseMove events targeted to the main frame should be routed | 1619 // Subsequent MouseMove events targeted to the main frame should be routed |
1608 // to that frame. | 1620 // to that frame. |
1609 mouse_event.type = blink::WebInputEvent::MouseMove; | 1621 mouse_event.setType(blink::WebInputEvent::MouseMove); |
1610 mouse_event.x = 1; | 1622 mouse_event.x = 1; |
1611 mouse_event.y = 3; | 1623 mouse_event.y = 3; |
1612 // Sending the MouseMove twice for the same reason as above. | 1624 // Sending the MouseMove twice for the same reason as above. |
1613 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1625 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1614 main_frame_monitor.ResetEventReceived(); | 1626 main_frame_monitor.ResetEventReceived(); |
1615 child_frame_monitor.ResetEventReceived(); | 1627 child_frame_monitor.ResetEventReceived(); |
1616 mouse_event.x = 1; | 1628 mouse_event.x = 1; |
1617 mouse_event.y = 4; | 1629 mouse_event.y = 4; |
1618 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1630 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1619 | 1631 |
1620 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1632 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
1621 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1633 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
1622 | 1634 |
1623 // Target MouseDown to the main frame to cause it to capture input. | 1635 // Target MouseDown to the main frame to cause it to capture input. |
1624 mouse_event.type = blink::WebInputEvent::MouseDown; | 1636 mouse_event.setType(blink::WebInputEvent::MouseDown); |
1625 mouse_event.x = 1; | 1637 mouse_event.x = 1; |
1626 mouse_event.y = 1; | 1638 mouse_event.y = 1; |
1627 main_frame_monitor.ResetEventReceived(); | 1639 main_frame_monitor.ResetEventReceived(); |
1628 child_frame_monitor.ResetEventReceived(); | 1640 child_frame_monitor.ResetEventReceived(); |
1629 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1641 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1630 | 1642 |
1631 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1643 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
1632 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1644 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
1633 | 1645 |
1634 // Sending a MouseMove to the child frame should still result in the main | 1646 // Sending a MouseMove to the child frame should still result in the main |
1635 // frame receiving the event. | 1647 // frame receiving the event. |
1636 mouse_event.type = blink::WebInputEvent::MouseMove; | 1648 mouse_event.setType(blink::WebInputEvent::MouseMove); |
1637 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; | 1649 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown); |
1638 mouse_event.x = 75; | 1650 mouse_event.x = 75; |
1639 mouse_event.y = 75; | 1651 mouse_event.y = 75; |
1640 main_frame_monitor.ResetEventReceived(); | 1652 main_frame_monitor.ResetEventReceived(); |
1641 child_frame_monitor.ResetEventReceived(); | 1653 child_frame_monitor.ResetEventReceived(); |
1642 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1654 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
1643 | 1655 |
1644 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1656 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
1645 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1657 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
1646 } | 1658 } |
1647 | 1659 |
(...skipping 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5290 | 5302 |
5291 FrameTreeNode* child_node = root->child_at(0); | 5303 FrameTreeNode* child_node = root->child_at(0); |
5292 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 5304 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
5293 child_node->current_frame_host()->GetSiteInstance()); | 5305 child_node->current_frame_host()->GetSiteInstance()); |
5294 | 5306 |
5295 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); | 5307 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); |
5296 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 5308 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
5297 | 5309 |
5298 // Send a MouseMove to the subframe. The frame contains text, and moving the | 5310 // Send a MouseMove to the subframe. The frame contains text, and moving the |
5299 // mouse over it should cause the renderer to send a mouse cursor update. | 5311 // mouse over it should cause the renderer to send a mouse cursor update. |
5300 blink::WebMouseEvent mouse_event; | 5312 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove, |
5301 mouse_event.type = blink::WebInputEvent::MouseMove; | 5313 blink::WebInputEvent::NoModifiers, |
| 5314 blink::WebInputEvent::TimeStampForTesting); |
5302 mouse_event.x = 60; | 5315 mouse_event.x = 60; |
5303 mouse_event.y = 60; | 5316 mouse_event.y = 60; |
5304 RenderWidgetHost* rwh_child = | 5317 RenderWidgetHost* rwh_child = |
5305 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 5318 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
5306 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 5319 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
5307 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5320 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
5308 web_contents()->GetInputEventRouter()->RouteMouseEvent( | 5321 web_contents()->GetInputEventRouter()->RouteMouseEvent( |
5309 root_view, &mouse_event, ui::LatencyInfo()); | 5322 root_view, &mouse_event, ui::LatencyInfo()); |
5310 | 5323 |
5311 // CursorMessageFilter::Wait() implicitly tests whether we receive a | 5324 // CursorMessageFilter::Wait() implicitly tests whether we receive a |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5818 ContextMenuObserverDelegate context_menu_delegate; | 5831 ContextMenuObserverDelegate context_menu_delegate; |
5819 shell->web_contents()->SetDelegate(&context_menu_delegate); | 5832 shell->web_contents()->SetDelegate(&context_menu_delegate); |
5820 | 5833 |
5821 RenderWidgetHostInputEventRouter* router = | 5834 RenderWidgetHostInputEventRouter* router = |
5822 static_cast<WebContentsImpl*>(shell->web_contents()) | 5835 static_cast<WebContentsImpl*>(shell->web_contents()) |
5823 ->GetInputEventRouter(); | 5836 ->GetInputEventRouter(); |
5824 | 5837 |
5825 gfx::Point point(75, 75); | 5838 gfx::Point point(75, 75); |
5826 | 5839 |
5827 // Target right-click event to child frame. | 5840 // Target right-click event to child frame. |
5828 blink::WebMouseEvent click_event; | 5841 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, |
5829 click_event.type = blink::WebInputEvent::MouseDown; | 5842 blink::WebInputEvent::NoModifiers, |
| 5843 blink::WebInputEvent::TimeStampForTesting); |
5830 click_event.button = blink::WebPointerProperties::Button::Right; | 5844 click_event.button = blink::WebPointerProperties::Button::Right; |
5831 click_event.x = point.x(); | 5845 click_event.x = point.x(); |
5832 click_event.y = point.y(); | 5846 click_event.y = point.y(); |
5833 click_event.clickCount = 1; | 5847 click_event.clickCount = 1; |
5834 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); | 5848 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); |
5835 | 5849 |
5836 // We also need a MouseUp event, needed by Windows. | 5850 // We also need a MouseUp event, needed by Windows. |
5837 click_event.type = blink::WebInputEvent::MouseUp; | 5851 click_event.setType(blink::WebInputEvent::MouseUp); |
5838 click_event.x = point.x(); | 5852 click_event.x = point.x(); |
5839 click_event.y = point.y(); | 5853 click_event.y = point.y(); |
5840 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); | 5854 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); |
5841 | 5855 |
5842 context_menu_delegate.Wait(); | 5856 context_menu_delegate.Wait(); |
5843 | 5857 |
5844 ContextMenuParams params = context_menu_delegate.getParams(); | 5858 ContextMenuParams params = context_menu_delegate.getParams(); |
5845 | 5859 |
5846 EXPECT_EQ(point.x(), params.x); | 5860 EXPECT_EQ(point.x(), params.x); |
5847 EXPECT_EQ(point.y(), params.y); | 5861 EXPECT_EQ(point.y(), params.y); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5973 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 5987 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
5974 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5988 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
5975 | 5989 |
5976 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 5990 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
5977 child_node->current_frame_host()->GetSiteInstance()); | 5991 child_node->current_frame_host()->GetSiteInstance()); |
5978 | 5992 |
5979 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); | 5993 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); |
5980 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 5994 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
5981 | 5995 |
5982 // Target left-click event to child frame. | 5996 // Target left-click event to child frame. |
5983 blink::WebMouseEvent click_event; | 5997 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, |
5984 click_event.type = blink::WebInputEvent::MouseDown; | 5998 blink::WebInputEvent::NoModifiers, |
| 5999 blink::WebInputEvent::TimeStampForTesting); |
5985 click_event.button = blink::WebPointerProperties::Button::Left; | 6000 click_event.button = blink::WebPointerProperties::Button::Left; |
5986 click_event.x = 15; | 6001 click_event.x = 15; |
5987 click_event.y = 15; | 6002 click_event.y = 15; |
5988 click_event.clickCount = 1; | 6003 click_event.clickCount = 1; |
5989 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); | 6004 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
5990 | 6005 |
5991 // Dismiss the popup. | 6006 // Dismiss the popup. |
5992 click_event.x = 1; | 6007 click_event.x = 1; |
5993 click_event.y = 1; | 6008 click_event.y = 1; |
5994 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); | 6009 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6048 static_cast<RenderWidgetHostViewBase*>( | 6063 static_cast<RenderWidgetHostViewBase*>( |
6049 c_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 6064 c_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
6050 | 6065 |
6051 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 6066 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
6052 c_node->current_frame_host()->GetSiteInstance()); | 6067 c_node->current_frame_host()->GetSiteInstance()); |
6053 | 6068 |
6054 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); | 6069 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); |
6055 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 6070 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
6056 | 6071 |
6057 // Target left-click event to child frame. | 6072 // Target left-click event to child frame. |
6058 blink::WebMouseEvent click_event; | 6073 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, |
6059 click_event.type = blink::WebInputEvent::MouseDown; | 6074 blink::WebInputEvent::NoModifiers, |
| 6075 blink::WebInputEvent::TimeStampForTesting); |
6060 click_event.button = blink::WebPointerProperties::Button::Left; | 6076 click_event.button = blink::WebPointerProperties::Button::Left; |
6061 click_event.x = 15; | 6077 click_event.x = 15; |
6062 click_event.y = 15; | 6078 click_event.y = 15; |
6063 click_event.clickCount = 1; | 6079 click_event.clickCount = 1; |
6064 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); | 6080 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
6065 | 6081 |
6066 // Prompt the WebContents to dismiss the popup by clicking elsewhere. | 6082 // Prompt the WebContents to dismiss the popup by clicking elsewhere. |
6067 click_event.x = 1; | 6083 click_event.x = 1; |
6068 click_event.y = 1; | 6084 click_event.y = 1; |
6069 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); | 6085 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7670 // Navigate both subframes to a page with a <select> element. | 7686 // Navigate both subframes to a page with a <select> element. |
7671 NavigateFrameToURL(child1, embedded_test_server()->GetURL( | 7687 NavigateFrameToURL(child1, embedded_test_server()->GetURL( |
7672 "b.com", "/site_isolation/page-with-select.html")); | 7688 "b.com", "/site_isolation/page-with-select.html")); |
7673 NavigateFrameToURL(child2, embedded_test_server()->GetURL( | 7689 NavigateFrameToURL(child2, embedded_test_server()->GetURL( |
7674 "c.com", "/site_isolation/page-with-select.html")); | 7690 "c.com", "/site_isolation/page-with-select.html")); |
7675 | 7691 |
7676 // Open both <select> menus by focusing each item and sending a space key | 7692 // Open both <select> menus by focusing each item and sending a space key |
7677 // at the focused node. This creates a popup widget in both processes. | 7693 // at the focused node. This creates a popup widget in both processes. |
7678 // Wait for and then drop the ViewHostMsg_ShowWidget messages, so that both | 7694 // Wait for and then drop the ViewHostMsg_ShowWidget messages, so that both |
7679 // widgets are left in pending-but-not-shown state. | 7695 // widgets are left in pending-but-not-shown state. |
7680 NativeWebKeyboardEvent event; | 7696 NativeWebKeyboardEvent event(blink::WebKeyboardEvent::Char, |
| 7697 blink::WebInputEvent::NoModifiers, |
| 7698 blink::WebInputEvent::TimeStampForTesting); |
7681 event.text[0] = ' '; | 7699 event.text[0] = ' '; |
7682 event.timeStampSeconds = 100; | |
7683 event.type = blink::WebKeyboardEvent::Char; | |
7684 | 7700 |
7685 scoped_refptr<PendingWidgetMessageFilter> filter1 = | 7701 scoped_refptr<PendingWidgetMessageFilter> filter1 = |
7686 new PendingWidgetMessageFilter(); | 7702 new PendingWidgetMessageFilter(); |
7687 process1->AddFilter(filter1.get()); | 7703 process1->AddFilter(filter1.get()); |
7688 EXPECT_TRUE(ExecuteScript(child1, "focusSelectMenu();")); | 7704 EXPECT_TRUE(ExecuteScript(child1, "focusSelectMenu();")); |
7689 child1->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent( | 7705 child1->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent( |
7690 event); | 7706 event); |
7691 filter1->Wait(); | 7707 filter1->Wait(); |
7692 | 7708 |
7693 scoped_refptr<PendingWidgetMessageFilter> filter2 = | 7709 scoped_refptr<PendingWidgetMessageFilter> filter2 = |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8873 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 8889 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
8874 | 8890 |
8875 RenderWidgetHostInputEventRouter* router = | 8891 RenderWidgetHostInputEventRouter* router = |
8876 static_cast<WebContentsImpl*>(shell()->web_contents()) | 8892 static_cast<WebContentsImpl*>(shell()->web_contents()) |
8877 ->GetInputEventRouter(); | 8893 ->GetInputEventRouter(); |
8878 | 8894 |
8879 // Create listener for input events. | 8895 // Create listener for input events. |
8880 RenderWidgetHostMouseEventMonitor event_monitor( | 8896 RenderWidgetHostMouseEventMonitor event_monitor( |
8881 root->current_frame_host()->GetRenderWidgetHost()); | 8897 root->current_frame_host()->GetRenderWidgetHost()); |
8882 | 8898 |
8883 blink::WebMouseEvent mouse_event; | 8899 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
8884 mouse_event.type = blink::WebInputEvent::MouseDown; | 8900 blink::WebInputEvent::NoModifiers, |
| 8901 blink::WebInputEvent::TimeStampForTesting); |
8885 mouse_event.button = blink::WebPointerProperties::Button::Left; | 8902 mouse_event.button = blink::WebPointerProperties::Button::Left; |
8886 mouse_event.x = 75; | 8903 mouse_event.x = 75; |
8887 mouse_event.y = 75; | 8904 mouse_event.y = 75; |
8888 mouse_event.clickCount = 1; | 8905 mouse_event.clickCount = 1; |
8889 event_monitor.ResetEventReceived(); | 8906 event_monitor.ResetEventReceived(); |
8890 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); | 8907 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); |
8891 | 8908 |
8892 EXPECT_TRUE(event_monitor.EventWasReceived()); | 8909 EXPECT_TRUE(event_monitor.EventWasReceived()); |
8893 gfx::Point mouse_down_coords = | 8910 gfx::Point mouse_down_coords = |
8894 gfx::Point(event_monitor.event().x, event_monitor.event().y); | 8911 gfx::Point(event_monitor.event().x, event_monitor.event().y); |
8895 event_monitor.ResetEventReceived(); | 8912 event_monitor.ResetEventReceived(); |
8896 | 8913 |
8897 mouse_event.type = blink::WebInputEvent::MouseUp; | 8914 mouse_event.setType(blink::WebInputEvent::MouseUp); |
8898 mouse_event.x = 75; | 8915 mouse_event.x = 75; |
8899 mouse_event.y = 75; | 8916 mouse_event.y = 75; |
8900 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); | 8917 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); |
8901 | 8918 |
8902 EXPECT_TRUE(event_monitor.EventWasReceived()); | 8919 EXPECT_TRUE(event_monitor.EventWasReceived()); |
8903 EXPECT_EQ(mouse_down_coords, | 8920 EXPECT_EQ(mouse_down_coords, |
8904 gfx::Point(event_monitor.event().x, event_monitor.event().y)); | 8921 gfx::Point(event_monitor.event().x, event_monitor.event().y)); |
8905 } | 8922 } |
8906 | 8923 |
8907 // This tests that we don't hide the RenderViewHost when reusing the | 8924 // This tests that we don't hide the RenderViewHost when reusing the |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8973 rfh->OnSwappedOut(); | 8990 rfh->OnSwappedOut(); |
8974 | 8991 |
8975 // Wait for the new a.com navigation to finish. | 8992 // Wait for the new a.com navigation to finish. |
8976 back_observer.Wait(); | 8993 back_observer.Wait(); |
8977 | 8994 |
8978 // The RVH for a.com should've been reused, and it should be active. | 8995 // The RVH for a.com should've been reused, and it should be active. |
8979 EXPECT_TRUE(rvh->is_active()); | 8996 EXPECT_TRUE(rvh->is_active()); |
8980 } | 8997 } |
8981 | 8998 |
8982 } // namespace content | 8999 } // namespace content |
OLD | NEW |