Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 // Helper function to generate a click on the given RenderWidgetHost. The 164 // Helper function to generate a click on the given RenderWidgetHost. The
165 // mouse event is forwarded directly to the RenderWidgetHost without any 165 // mouse event is forwarded directly to the RenderWidgetHost without any
166 // hit-testing. 166 // hit-testing.
167 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { 167 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) {
168 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 168 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
169 blink::WebInputEvent::NoModifiers, 169 blink::WebInputEvent::NoModifiers,
170 blink::WebInputEvent::TimeStampForTesting); 170 blink::WebInputEvent::TimeStampForTesting);
171 mouse_event.button = blink::WebPointerProperties::Button::Left; 171 mouse_event.button = blink::WebPointerProperties::Button::Left;
172 mouse_event.x = x; 172 mouse_event.setPositionInWidget(x, y);
173 mouse_event.y = y;
174 rwh->ForwardMouseEvent(mouse_event); 173 rwh->ForwardMouseEvent(mouse_event);
175 } 174 }
176 175
177 // Retrieve document.origin for the frame |ftn|. 176 // Retrieve document.origin for the frame |ftn|.
178 std::string GetDocumentOrigin(FrameTreeNode* ftn) { 177 std::string GetDocumentOrigin(FrameTreeNode* ftn) {
179 std::string origin; 178 std::string origin;
180 EXPECT_TRUE(ExecuteScriptAndExtractString( 179 EXPECT_TRUE(ExecuteScriptAndExtractString(
181 ftn, "domAutomationController.send(document.origin)", &origin)); 180 ftn, "domAutomationController.send(document.origin)", &origin));
182 return origin; 181 return origin;
183 } 182 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // Get the view bounds of the child iframe, which should account for the 301 // Get the view bounds of the child iframe, which should account for the
303 // relative offset of its direct parent within the root frame, for use in 302 // relative offset of its direct parent within the root frame, for use in
304 // targeting the input event. 303 // targeting the input event.
305 gfx::Rect bounds = rwhv_child->GetViewBounds(); 304 gfx::Rect bounds = rwhv_child->GetViewBounds();
306 305
307 // Target input event to child frame. 306 // Target input event to child frame.
308 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 307 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
309 blink::WebInputEvent::NoModifiers, 308 blink::WebInputEvent::NoModifiers,
310 blink::WebInputEvent::TimeStampForTesting); 309 blink::WebInputEvent::TimeStampForTesting);
311 child_event.button = blink::WebPointerProperties::Button::Left; 310 child_event.button = blink::WebPointerProperties::Button::Left;
312 child_event.x = 311 child_event.setPositionInWidget(
313 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) / 312 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) /
314 scale_factor) + 313 scale_factor) +
315 3; 314 3,
316 child_event.y =
317 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) / 315 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) /
318 scale_factor) + 316 scale_factor) +
319 3; 317 3);
320 child_event.clickCount = 1; 318 child_event.clickCount = 1;
321 main_frame_monitor.ResetEventReceived(); 319 main_frame_monitor.ResetEventReceived();
322 child_frame_monitor.ResetEventReceived(); 320 child_frame_monitor.ResetEventReceived();
323 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); 321 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo());
324 322
325 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 323 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
326 // The expected result coordinates are (3, 3), but can get slightly 324 // The expected result coordinates are (3, 3), but can get slightly
327 // different results due to rounding error with some device scale factors. 325 // different results due to rounding error with some device scale factors.
328 EXPECT_TRUE(child_frame_monitor.event().x <= 5 && 326 EXPECT_TRUE(child_frame_monitor.event().positionInWidget().x <= 5 &&
329 child_frame_monitor.event().x >= 1) 327 child_frame_monitor.event().positionInWidget().x >= 1)
330 << " actual event.x: " << child_frame_monitor.event().x; 328 << " actual event.positionInWidget().x: "
331 EXPECT_TRUE(child_frame_monitor.event().y <= 5 && 329 << child_frame_monitor.event().positionInWidget().x;
332 child_frame_monitor.event().y >= 1) 330 EXPECT_TRUE(child_frame_monitor.event().positionInWidget().y <= 5 &&
333 << " actual event.y: " << child_frame_monitor.event().y; 331 child_frame_monitor.event().positionInWidget().y >= 1)
332 << " actual event.positionInWidget().y: "
333 << child_frame_monitor.event().positionInWidget().y;
334 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 334 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
335 335
336 child_frame_monitor.ResetEventReceived(); 336 child_frame_monitor.ResetEventReceived();
337 main_frame_monitor.ResetEventReceived(); 337 main_frame_monitor.ResetEventReceived();
338 338
339 // Target input event to main frame. 339 // Target input event to main frame.
340 blink::WebMouseEvent main_event(blink::WebInputEvent::MouseDown, 340 blink::WebMouseEvent main_event(blink::WebInputEvent::MouseDown,
341 blink::WebInputEvent::NoModifiers, 341 blink::WebInputEvent::NoModifiers,
342 blink::WebInputEvent::TimeStampForTesting); 342 blink::WebInputEvent::TimeStampForTesting);
343 main_event.button = blink::WebPointerProperties::Button::Left; 343 main_event.button = blink::WebPointerProperties::Button::Left;
344 main_event.x = 1; 344 main_event.setPositionInWidget(1, 1);
345 main_event.y = 1;
346 main_event.clickCount = 1; 345 main_event.clickCount = 1;
347 // Ladies and gentlemen, THIS is the main_event! 346 // Ladies and gentlemen, THIS is the main_event!
348 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo()); 347 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo());
349 348
350 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 349 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
351 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 350 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
352 EXPECT_EQ(1, main_frame_monitor.event().x); 351 EXPECT_EQ(1, main_frame_monitor.event().positionInWidget().x);
353 EXPECT_EQ(1, main_frame_monitor.event().y); 352 EXPECT_EQ(1, main_frame_monitor.event().positionInWidget().y);
354 } 353 }
355 354
356 class RedirectNotificationObserver : public NotificationObserver { 355 class RedirectNotificationObserver : public NotificationObserver {
357 public: 356 public:
358 // Register to listen for notifications of the given type from either a 357 // Register to listen for notifications of the given type from either a
359 // specific source, or from all sources if |source| is 358 // specific source, or from all sources if |source| is
360 // NotificationService::AllSources(). 359 // NotificationService::AllSources().
361 RedirectNotificationObserver(int notification_type, 360 RedirectNotificationObserver(int notification_type,
362 const NotificationSource& source); 361 const NotificationSource& source);
363 ~RedirectNotificationObserver() override; 362 ~RedirectNotificationObserver() override;
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 scoped_refptr<FrameRectChangedMessageFilter> filter = 1063 scoped_refptr<FrameRectChangedMessageFilter> filter =
1065 new FrameRectChangedMessageFilter(); 1064 new FrameRectChangedMessageFilter();
1066 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); 1065 root->current_frame_host()->GetProcess()->AddFilter(filter.get());
1067 1066
1068 // Scroll the parent frame downward to verify that the child rect gets updated 1067 // Scroll the parent frame downward to verify that the child rect gets updated
1069 // correctly. 1068 // correctly.
1070 blink::WebMouseWheelEvent scroll_event( 1069 blink::WebMouseWheelEvent scroll_event(
1071 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, 1070 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers,
1072 blink::WebInputEvent::TimeStampForTesting); 1071 blink::WebInputEvent::TimeStampForTesting);
1073 1072
1074 scroll_event.x = gfx::ToFlooredInt( 1073 scroll_event.setPositionInWidget(
1075 (bounds.x() - rwhv_root->GetViewBounds().x() - 5) / scale_factor); 1074 gfx::ToFlooredInt((bounds.x() - rwhv_root->GetViewBounds().x() - 5) /
1076 scroll_event.y = gfx::ToFlooredInt( 1075 scale_factor),
1077 (bounds.y() - rwhv_root->GetViewBounds().y() - 5) / scale_factor); 1076 gfx::ToFlooredInt((bounds.y() - rwhv_root->GetViewBounds().y() - 5) /
1077 scale_factor));
1078 scroll_event.deltaX = 0.0f; 1078 scroll_event.deltaX = 0.0f;
1079 scroll_event.deltaY = -30.0f; 1079 scroll_event.deltaY = -30.0f;
1080 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); 1080 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo());
1081 1081
1082 filter->Wait(); 1082 filter->Wait();
1083 1083
1084 // The precise amount of scroll for the first view position update is not 1084 // The precise amount of scroll for the first view position update is not
1085 // deterministic, so this simply verifies that the OOPIF moved from its 1085 // deterministic, so this simply verifies that the OOPIF moved from its
1086 // earlier position. 1086 // earlier position.
1087 gfx::Rect update_rect = filter->last_rect(); 1087 gfx::Rect update_rect = filter->last_rect();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 // Save the original offset as a point of reference. 1150 // Save the original offset as a point of reference.
1151 filter->Wait(); 1151 filter->Wait();
1152 gfx::Rect update_rect = filter->last_rect(); 1152 gfx::Rect update_rect = filter->last_rect();
1153 int initial_y = update_rect.y(); 1153 int initial_y = update_rect.y();
1154 filter->Reset(); 1154 filter->Reset();
1155 1155
1156 // Scroll the parent frame downward. 1156 // Scroll the parent frame downward.
1157 blink::WebMouseWheelEvent scroll_event( 1157 blink::WebMouseWheelEvent scroll_event(
1158 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, 1158 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers,
1159 blink::WebInputEvent::TimeStampForTesting); 1159 blink::WebInputEvent::TimeStampForTesting);
1160 scroll_event.x = 1; 1160 scroll_event.setPositionInWidget(1, 1);
1161 scroll_event.y = 1;
1162 scroll_event.deltaX = 0.0f; 1161 scroll_event.deltaX = 0.0f;
1163 scroll_event.deltaY = -5.0f; 1162 scroll_event.deltaY = -5.0f;
1164 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); 1163 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo());
1165 1164
1166 // Ensure that the view position is propagated to the child properly. 1165 // Ensure that the view position is propagated to the child properly.
1167 filter->Wait(); 1166 filter->Wait();
1168 update_rect = filter->last_rect(); 1167 update_rect = filter->last_rect();
1169 EXPECT_LT(update_rect.y(), initial_y); 1168 EXPECT_LT(update_rect.y(), initial_y);
1170 filter->Reset(); 1169 filter->Reset();
1171 1170
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 // Get the view bounds of the nested iframe, which should account for the 1389 // Get the view bounds of the nested iframe, which should account for the
1391 // relative offset of its direct parent within the root frame, for use in 1390 // relative offset of its direct parent within the root frame, for use in
1392 // targeting the input event. 1391 // targeting the input event.
1393 gfx::Rect bounds = rwhv_nested->GetViewBounds(); 1392 gfx::Rect bounds = rwhv_nested->GetViewBounds();
1394 1393
1395 // Target input event to nested frame. 1394 // Target input event to nested frame.
1396 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown, 1395 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown,
1397 blink::WebInputEvent::NoModifiers, 1396 blink::WebInputEvent::NoModifiers,
1398 blink::WebInputEvent::TimeStampForTesting); 1397 blink::WebInputEvent::TimeStampForTesting);
1399 nested_event.button = blink::WebPointerProperties::Button::Left; 1398 nested_event.button = blink::WebPointerProperties::Button::Left;
1400 nested_event.x = 1399 nested_event.setPositionInWidget(
1401 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) / 1400 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) /
1402 scale_factor) + 1401 scale_factor) +
1403 5; 1402 5,
1404 nested_event.y =
1405 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) / 1403 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) /
1406 scale_factor) + 1404 scale_factor) +
1407 5; 1405 5);
1408 nested_event.clickCount = 1; 1406 nested_event.clickCount = 1;
1409 nested_frame_monitor.ResetEventReceived(); 1407 nested_frame_monitor.ResetEventReceived();
1410 main_frame_monitor.ResetEventReceived(); 1408 main_frame_monitor.ResetEventReceived();
1411 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo()); 1409 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo());
1412 1410
1413 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); 1411 EXPECT_TRUE(nested_frame_monitor.EventWasReceived());
1414 // The expected result coordinates are (5, 5), but can get slightly 1412 // The expected result coordinates are (5, 5), but can get slightly
1415 // different results due to rounding error with some device scale factors. 1413 // different results due to rounding error with some device scale factors.
1416 EXPECT_TRUE(nested_frame_monitor.event().x <= 6 && 1414 EXPECT_TRUE(nested_frame_monitor.event().positionInWidget().x <= 6 &&
1417 nested_frame_monitor.event().x >= 4) 1415 nested_frame_monitor.event().positionInWidget().x >= 4)
1418 << " actual event.x: " << nested_frame_monitor.event().x; 1416 << " actual event.positionInWidget().x: "
1419 EXPECT_TRUE(nested_frame_monitor.event().y <= 6 && 1417 << nested_frame_monitor.event().positionInWidget().x;
1420 nested_frame_monitor.event().y >= 4) 1418 EXPECT_TRUE(nested_frame_monitor.event().positionInWidget().y <= 6 &&
1421 << " actual event.y: " << nested_frame_monitor.event().y; 1419 nested_frame_monitor.event().positionInWidget().y >= 4)
1420 << " actual event.positionInWidget().y: "
1421 << nested_frame_monitor.event().positionInWidget().y;
1422 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1422 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1423 } 1423 }
1424 1424
1425 // This test tests that browser process hittesting ignores frames with 1425 // This test tests that browser process hittesting ignores frames with
1426 // pointer-events: none. 1426 // pointer-events: none.
1427 #if defined(OS_ANDROID) 1427 #if defined(OS_ANDROID)
1428 // Test failing on some Android builders, due to inaccurate coordinates on 1428 // Test failing on some Android builders, due to inaccurate coordinates on
1429 // some devices. See: https://crbug.com/700007. 1429 // some devices. See: https://crbug.com/700007.
1430 #define MAYBE_SurfaceHitTestPointerEventsNone \ 1430 #define MAYBE_SurfaceHitTestPointerEventsNone \
1431 DISABLED_SurfaceHitTestPointerEventsNone 1431 DISABLED_SurfaceHitTestPointerEventsNone
(...skipping 28 matching lines...) Expand all
1460 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 1460 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
1461 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1461 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1462 1462
1463 WaitForChildFrameSurfaceReady(child_node->current_frame_host()); 1463 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
1464 1464
1465 // Target input event to child frame. 1465 // Target input event to child frame.
1466 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 1466 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
1467 blink::WebInputEvent::NoModifiers, 1467 blink::WebInputEvent::NoModifiers,
1468 blink::WebInputEvent::TimeStampForTesting); 1468 blink::WebInputEvent::TimeStampForTesting);
1469 child_event.button = blink::WebPointerProperties::Button::Left; 1469 child_event.button = blink::WebPointerProperties::Button::Left;
1470 child_event.x = 75; 1470 child_event.setPositionInWidget(75, 75);
1471 child_event.y = 75;
1472 child_event.clickCount = 1; 1471 child_event.clickCount = 1;
1473 main_frame_monitor.ResetEventReceived(); 1472 main_frame_monitor.ResetEventReceived();
1474 child_frame_monitor.ResetEventReceived(); 1473 child_frame_monitor.ResetEventReceived();
1475 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); 1474 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo());
1476 1475
1477 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1476 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1478 EXPECT_EQ(75, main_frame_monitor.event().x); 1477 EXPECT_EQ(75, main_frame_monitor.event().positionInWidget().x);
1479 EXPECT_EQ(75, main_frame_monitor.event().y); 1478 EXPECT_EQ(75, main_frame_monitor.event().positionInWidget().y);
1480 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1479 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1481 } 1480 }
1482 1481
1483 // This test verifies that MouseEnter and MouseLeave events fire correctly 1482 // This test verifies that MouseEnter and MouseLeave events fire correctly
1484 // when the mouse cursor moves between processes. 1483 // when the mouse cursor moves between processes.
1485 #if defined(OS_ANDROID) 1484 #if defined(OS_ANDROID)
1486 // Test failing on some Android builders, due to inaccurate coordinates on 1485 // Test failing on some Android builders, due to inaccurate coordinates on
1487 // some devices. See: https://crbug.com/700007. 1486 // some devices. See: https://crbug.com/700007.
1488 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \ 1487 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \
1489 DISABLED_CrossProcessMouseEnterAndLeaveTest 1488 DISABLED_CrossProcessMouseEnterAndLeaveTest
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 gfx::Point point_in_b_frame( 1554 gfx::Point point_in_b_frame(
1556 gfx::ToCeiledInt((b_bounds.x() - a_bounds.x()) / scale_factor) + 25, 1555 gfx::ToCeiledInt((b_bounds.x() - a_bounds.x()) / scale_factor) + 25,
1557 gfx::ToCeiledInt((b_bounds.y() - a_bounds.y()) / scale_factor) + 25); 1556 gfx::ToCeiledInt((b_bounds.y() - a_bounds.y()) / scale_factor) + 25);
1558 gfx::Point point_in_d_frame( 1557 gfx::Point point_in_d_frame(
1559 gfx::ToCeiledInt((d_bounds.x() - a_bounds.x()) / scale_factor) + 25, 1558 gfx::ToCeiledInt((d_bounds.x() - a_bounds.x()) / scale_factor) + 25,
1560 gfx::ToCeiledInt((d_bounds.y() - a_bounds.y()) / scale_factor) + 25); 1559 gfx::ToCeiledInt((d_bounds.y() - a_bounds.y()) / scale_factor) + 25);
1561 1560
1562 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove, 1561 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove,
1563 blink::WebInputEvent::NoModifiers, 1562 blink::WebInputEvent::NoModifiers,
1564 blink::WebInputEvent::TimeStampForTesting); 1563 blink::WebInputEvent::TimeStampForTesting);
1565 mouse_event.x = point_in_a_frame.x(); 1564 mouse_event.setPositionInWidget(point_in_a_frame.x(), point_in_a_frame.y());
1566 mouse_event.y = point_in_a_frame.y();
1567 1565
1568 // Send an initial MouseMove to the root view, which shouldn't affect the 1566 // Send an initial MouseMove to the root view, which shouldn't affect the
1569 // other renderers. 1567 // other renderers.
1570 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1568 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1571 ui::LatencyInfo()); 1569 ui::LatencyInfo());
1572 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1570 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1573 a_frame_monitor.ResetEventReceived(); 1571 a_frame_monitor.ResetEventReceived();
1574 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); 1572 EXPECT_FALSE(b_frame_monitor.EventWasReceived());
1575 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1573 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1576 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1574 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1577 1575
1578 // Next send a MouseMove to B frame, which shouldn't affect C or D but 1576 // Next send a MouseMove to B frame, which shouldn't affect C or D but
1579 // A should receive a MouseMove event. 1577 // A should receive a MouseMove event.
1580 mouse_event.x = point_in_b_frame.x(); 1578 mouse_event.setPositionInWidget(point_in_b_frame.x(), point_in_b_frame.y());
1581 mouse_event.y = point_in_b_frame.y();
1582 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1579 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1583 ui::LatencyInfo()); 1580 ui::LatencyInfo());
1584 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1581 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1585 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); 1582 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1586 a_frame_monitor.ResetEventReceived(); 1583 a_frame_monitor.ResetEventReceived();
1587 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1584 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1588 b_frame_monitor.ResetEventReceived(); 1585 b_frame_monitor.ResetEventReceived();
1589 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1586 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1590 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1587 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1591 1588
1592 // Next send a MouseMove to D frame, which should have side effects in every 1589 // Next send a MouseMove to D frame, which should have side effects in every
1593 // other RenderWidgetHostView. 1590 // other RenderWidgetHostView.
1594 mouse_event.x = point_in_d_frame.x(); 1591 mouse_event.setPositionInWidget(point_in_d_frame.x(), point_in_d_frame.y());
1595 mouse_event.y = point_in_d_frame.y();
1596 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1592 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1597 ui::LatencyInfo()); 1593 ui::LatencyInfo());
1598 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1594 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1599 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); 1595 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1600 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1596 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1601 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave); 1597 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave);
1602 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); 1598 EXPECT_TRUE(c_frame_monitor.EventWasReceived());
1603 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); 1599 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1604 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); 1600 EXPECT_TRUE(d_frame_monitor.EventWasReceived());
1605 } 1601 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 int child_frame_target_y = 1655 int child_frame_target_y =
1660 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) / 1656 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) /
1661 scale_factor) + 1657 scale_factor) +
1662 5; 1658 5;
1663 1659
1664 // Target MouseDown to child frame. 1660 // Target MouseDown to child frame.
1665 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 1661 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
1666 blink::WebInputEvent::NoModifiers, 1662 blink::WebInputEvent::NoModifiers,
1667 blink::WebInputEvent::TimeStampForTesting); 1663 blink::WebInputEvent::TimeStampForTesting);
1668 mouse_event.button = blink::WebPointerProperties::Button::Left; 1664 mouse_event.button = blink::WebPointerProperties::Button::Left;
1669 mouse_event.x = child_frame_target_x; 1665 mouse_event.setPositionInWidget(child_frame_target_x, child_frame_target_y);
1670 mouse_event.y = child_frame_target_y;
1671 mouse_event.clickCount = 1; 1666 mouse_event.clickCount = 1;
1672 main_frame_monitor.ResetEventReceived(); 1667 main_frame_monitor.ResetEventReceived();
1673 child_frame_monitor.ResetEventReceived(); 1668 child_frame_monitor.ResetEventReceived();
1674 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1669 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1675 1670
1676 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1671 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1677 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 1672 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
1678 1673
1679 // Target MouseMove to main frame. This should still be routed to the 1674 // Target MouseMove to main frame. This should still be routed to the
1680 // child frame because it is now capturing mouse input. 1675 // child frame because it is now capturing mouse input.
1681 mouse_event.setType(blink::WebInputEvent::MouseMove); 1676 mouse_event.setType(blink::WebInputEvent::MouseMove);
1682 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown); 1677 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown);
1683 mouse_event.x = 1; 1678 mouse_event.setPositionInWidget(1, 1);
1684 mouse_event.y = 1;
1685 // Note that this event is sent twice, with the monitors cleared after 1679 // Note that this event is sent twice, with the monitors cleared after
1686 // the first time, because the first MouseMove to the child frame 1680 // the first time, because the first MouseMove to the child frame
1687 // causes a MouseMove to be sent to the main frame also, which we 1681 // causes a MouseMove to be sent to the main frame also, which we
1688 // need to ignore. 1682 // need to ignore.
1689 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1683 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1690 main_frame_monitor.ResetEventReceived(); 1684 main_frame_monitor.ResetEventReceived();
1691 child_frame_monitor.ResetEventReceived(); 1685 child_frame_monitor.ResetEventReceived();
1692 mouse_event.x = 1; 1686 mouse_event.setPositionInWidget(1, 2);
1693 mouse_event.y = 2;
1694 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1687 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1695 1688
1696 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1689 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1697 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 1690 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
1698 1691
1699 // A MouseUp to the child frame should cancel the mouse capture. 1692 // A MouseUp to the child frame should cancel the mouse capture.
1700 mouse_event.setType(blink::WebInputEvent::MouseUp); 1693 mouse_event.setType(blink::WebInputEvent::MouseUp);
1701 mouse_event.setModifiers(blink::WebInputEvent::NoModifiers); 1694 mouse_event.setModifiers(blink::WebInputEvent::NoModifiers);
1702 mouse_event.x = child_frame_target_x; 1695 mouse_event.setPositionInWidget(child_frame_target_x, child_frame_target_y);
1703 mouse_event.y = child_frame_target_y;
1704 main_frame_monitor.ResetEventReceived(); 1696 main_frame_monitor.ResetEventReceived();
1705 child_frame_monitor.ResetEventReceived(); 1697 child_frame_monitor.ResetEventReceived();
1706 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1698 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1707 1699
1708 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1700 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1709 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 1701 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
1710 1702
1711 // Subsequent MouseMove events targeted to the main frame should be routed 1703 // Subsequent MouseMove events targeted to the main frame should be routed
1712 // to that frame. 1704 // to that frame.
1713 mouse_event.setType(blink::WebInputEvent::MouseMove); 1705 mouse_event.setType(blink::WebInputEvent::MouseMove);
1714 mouse_event.x = 1; 1706 mouse_event.setPositionInWidget(1, 3);
1715 mouse_event.y = 3;
1716 // Sending the MouseMove twice for the same reason as above. 1707 // Sending the MouseMove twice for the same reason as above.
1717 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1708 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1718 main_frame_monitor.ResetEventReceived(); 1709 main_frame_monitor.ResetEventReceived();
1719 child_frame_monitor.ResetEventReceived(); 1710 child_frame_monitor.ResetEventReceived();
1720 mouse_event.x = 1; 1711 mouse_event.setPositionInWidget(1, 4);
1721 mouse_event.y = 4;
1722 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1712 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1723 1713
1724 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1714 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1725 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1715 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1726 1716
1727 // Target MouseDown to the main frame to cause it to capture input. 1717 // Target MouseDown to the main frame to cause it to capture input.
1728 mouse_event.setType(blink::WebInputEvent::MouseDown); 1718 mouse_event.setType(blink::WebInputEvent::MouseDown);
1729 mouse_event.x = 1; 1719 mouse_event.setPositionInWidget(1, 1);
1730 mouse_event.y = 1;
1731 main_frame_monitor.ResetEventReceived(); 1720 main_frame_monitor.ResetEventReceived();
1732 child_frame_monitor.ResetEventReceived(); 1721 child_frame_monitor.ResetEventReceived();
1733 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1722 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1734 1723
1735 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1724 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1736 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1725 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1737 1726
1738 // Sending a MouseMove to the child frame should still result in the main 1727 // Sending a MouseMove to the child frame should still result in the main
1739 // frame receiving the event. 1728 // frame receiving the event.
1740 mouse_event.setType(blink::WebInputEvent::MouseMove); 1729 mouse_event.setType(blink::WebInputEvent::MouseMove);
1741 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown); 1730 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown);
1742 mouse_event.x = child_frame_target_x; 1731 mouse_event.setPositionInWidget(child_frame_target_x, child_frame_target_y);
1743 mouse_event.y = child_frame_target_y;
1744 main_frame_monitor.ResetEventReceived(); 1732 main_frame_monitor.ResetEventReceived();
1745 child_frame_monitor.ResetEventReceived(); 1733 child_frame_monitor.ResetEventReceived();
1746 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1734 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1747 1735
1748 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1736 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1749 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1737 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1750 } 1738 }
1751 1739
1752 // Tests OOPIF rendering by checking that the RWH of the iframe generates 1740 // Tests OOPIF rendering by checking that the RWH of the iframe generates
1753 // OnSwapCompositorFrame message. 1741 // OnSwapCompositorFrame message.
(...skipping 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after
5412 child_node->current_frame_host()->GetSiteInstance()); 5400 child_node->current_frame_host()->GetSiteInstance());
5413 5401
5414 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); 5402 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter();
5415 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 5403 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
5416 5404
5417 // Send a MouseMove to the subframe. The frame contains text, and moving the 5405 // Send a MouseMove to the subframe. The frame contains text, and moving the
5418 // mouse over it should cause the renderer to send a mouse cursor update. 5406 // mouse over it should cause the renderer to send a mouse cursor update.
5419 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove, 5407 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove,
5420 blink::WebInputEvent::NoModifiers, 5408 blink::WebInputEvent::NoModifiers,
5421 blink::WebInputEvent::TimeStampForTesting); 5409 blink::WebInputEvent::TimeStampForTesting);
5422 mouse_event.x = 60; 5410 mouse_event.setPositionInWidget(60, 60);
5423 mouse_event.y = 60;
5424 RenderWidgetHost* rwh_child = 5411 RenderWidgetHost* rwh_child =
5425 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); 5412 root->child_at(0)->current_frame_host()->GetRenderWidgetHost();
5426 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 5413 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
5427 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 5414 root->current_frame_host()->GetRenderWidgetHost()->GetView());
5428 web_contents()->GetInputEventRouter()->RouteMouseEvent( 5415 web_contents()->GetInputEventRouter()->RouteMouseEvent(
5429 root_view, &mouse_event, ui::LatencyInfo()); 5416 root_view, &mouse_event, ui::LatencyInfo());
5430 5417
5431 // CursorMessageFilter::Wait() implicitly tests whether we receive a 5418 // CursorMessageFilter::Wait() implicitly tests whether we receive a
5432 // ViewHostMsg_SetCursor message from the renderer process, because it does 5419 // ViewHostMsg_SetCursor message from the renderer process, because it does
5433 // does not return otherwise. 5420 // does not return otherwise.
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6194 6181
6195 gfx::Point point( 6182 gfx::Point point(
6196 gfx::ToCeiledInt((bounds.x() - root_bounds.x()) / scale_factor) + 10, 6183 gfx::ToCeiledInt((bounds.x() - root_bounds.x()) / scale_factor) + 10,
6197 gfx::ToCeiledInt((bounds.y() - root_bounds.y()) / scale_factor) + 10); 6184 gfx::ToCeiledInt((bounds.y() - root_bounds.y()) / scale_factor) + 10);
6198 6185
6199 // Target right-click event to child frame. 6186 // Target right-click event to child frame.
6200 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, 6187 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown,
6201 blink::WebInputEvent::NoModifiers, 6188 blink::WebInputEvent::NoModifiers,
6202 blink::WebInputEvent::TimeStampForTesting); 6189 blink::WebInputEvent::TimeStampForTesting);
6203 click_event.button = blink::WebPointerProperties::Button::Right; 6190 click_event.button = blink::WebPointerProperties::Button::Right;
6204 click_event.x = point.x(); 6191 click_event.setPositionInWidget(point.x(), point.y());
6205 click_event.y = point.y();
6206 click_event.clickCount = 1; 6192 click_event.clickCount = 1;
6207 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); 6193 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo());
6208 6194
6209 // We also need a MouseUp event, needed by Windows. 6195 // We also need a MouseUp event, needed by Windows.
6210 click_event.setType(blink::WebInputEvent::MouseUp); 6196 click_event.setType(blink::WebInputEvent::MouseUp);
6211 click_event.x = point.x(); 6197 click_event.setPositionInWidget(point.x(), point.y());
6212 click_event.y = point.y();
6213 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); 6198 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo());
6214 6199
6215 context_menu_delegate.Wait(); 6200 context_menu_delegate.Wait();
6216 6201
6217 ContextMenuParams params = context_menu_delegate.getParams(); 6202 ContextMenuParams params = context_menu_delegate.getParams();
6218 6203
6219 EXPECT_EQ(point.x(), params.x); 6204 EXPECT_EQ(point.x(), params.x);
6220 EXPECT_EQ(point.y(), params.y); 6205 EXPECT_EQ(point.y(), params.y);
6221 } 6206 }
6222 6207
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
6348 child_node->current_frame_host()->GetSiteInstance()); 6333 child_node->current_frame_host()->GetSiteInstance());
6349 6334
6350 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); 6335 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter();
6351 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 6336 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
6352 6337
6353 // Target left-click event to child frame. 6338 // Target left-click event to child frame.
6354 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, 6339 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown,
6355 blink::WebInputEvent::NoModifiers, 6340 blink::WebInputEvent::NoModifiers,
6356 blink::WebInputEvent::TimeStampForTesting); 6341 blink::WebInputEvent::TimeStampForTesting);
6357 click_event.button = blink::WebPointerProperties::Button::Left; 6342 click_event.button = blink::WebPointerProperties::Button::Left;
6358 click_event.x = 15; 6343 click_event.setPositionInWidget(15, 15);
6359 click_event.y = 15;
6360 click_event.clickCount = 1; 6344 click_event.clickCount = 1;
6361 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6345 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo());
6362 6346
6363 // Dismiss the popup. 6347 // Dismiss the popup.
6364 click_event.x = 1; 6348 click_event.setPositionInWidget(1, 1);
6365 click_event.y = 1;
6366 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6349 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo());
6367 6350
6368 filter->Wait(); 6351 filter->Wait();
6369 gfx::Rect popup_rect = filter->last_initial_rect(); 6352 gfx::Rect popup_rect = filter->last_initial_rect();
6370 #if defined(OS_MACOSX) || defined(OS_ANDROID) 6353 #if defined(OS_MACOSX) || defined(OS_ANDROID)
6371 // On Mac and Android we receive the coordinates before they are transformed, 6354 // On Mac and Android we receive the coordinates before they are transformed,
6372 // so they are still relative to the out-of-process iframe origin. 6355 // so they are still relative to the out-of-process iframe origin.
6373 EXPECT_EQ(popup_rect.x(), 9); 6356 EXPECT_EQ(popup_rect.x(), 9);
6374 EXPECT_EQ(popup_rect.y(), 9); 6357 EXPECT_EQ(popup_rect.y(), 9);
6375 #else 6358 #else
6376 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); 6359 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354);
6377 EXPECT_EQ(popup_rect.y() - rwhv_root->GetViewBounds().y(), 94); 6360 EXPECT_EQ(popup_rect.y() - rwhv_root->GetViewBounds().y(), 94);
6378 #endif 6361 #endif
6379 6362
6380 #if defined(OS_LINUX) 6363 #if defined(OS_LINUX)
6381 // Verify click-and-drag selection of popups still works on Linux with 6364 // Verify click-and-drag selection of popups still works on Linux with
6382 // OOPIFs enabled. This is only necessary to test on Aura because Mac and 6365 // OOPIFs enabled. This is only necessary to test on Aura because Mac and
6383 // Android use native widgets. Windows does not support this as UI 6366 // Android use native widgets. Windows does not support this as UI
6384 // convention (it requires separate clicks to open the menu and select an 6367 // convention (it requires separate clicks to open the menu and select an
6385 // option). See https://crbug.com/703191. 6368 // option). See https://crbug.com/703191.
6386 int process_id = child_node->current_frame_host()->GetProcess()->GetID(); 6369 int process_id = child_node->current_frame_host()->GetProcess()->GetID();
6387 filter->Reset(); 6370 filter->Reset();
6388 RenderWidgetHostInputEventRouter* router = 6371 RenderWidgetHostInputEventRouter* router =
6389 static_cast<WebContentsImpl*>(shell()->web_contents()) 6372 static_cast<WebContentsImpl*>(shell()->web_contents())
6390 ->GetInputEventRouter(); 6373 ->GetInputEventRouter();
6391 // Re-open the select element. 6374 // Re-open the select element.
6392 click_event.x = 360; 6375 click_event.setPositionInWidget(360, 90);
6393 click_event.y = 90;
6394 click_event.clickCount = 1; 6376 click_event.clickCount = 1;
6395 router->RouteMouseEvent(rwhv_root, &click_event, ui::LatencyInfo()); 6377 router->RouteMouseEvent(rwhv_root, &click_event, ui::LatencyInfo());
6396 6378
6397 filter->Wait(); 6379 filter->Wait();
6398 6380
6399 RenderWidgetHostView* popup_view = 6381 RenderWidgetHostView* popup_view =
6400 RenderWidgetHost::FromID(process_id, filter->last_routing_id()) 6382 RenderWidgetHost::FromID(process_id, filter->last_routing_id())
6401 ->GetView(); 6383 ->GetView();
6402 6384
6403 RenderWidgetHostMouseEventMonitor popup_monitor( 6385 RenderWidgetHostMouseEventMonitor popup_monitor(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
6465 c_node->current_frame_host()->GetSiteInstance()); 6447 c_node->current_frame_host()->GetSiteInstance());
6466 6448
6467 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); 6449 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter();
6468 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 6450 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
6469 6451
6470 // Target left-click event to child frame. 6452 // Target left-click event to child frame.
6471 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, 6453 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown,
6472 blink::WebInputEvent::NoModifiers, 6454 blink::WebInputEvent::NoModifiers,
6473 blink::WebInputEvent::TimeStampForTesting); 6455 blink::WebInputEvent::TimeStampForTesting);
6474 click_event.button = blink::WebPointerProperties::Button::Left; 6456 click_event.button = blink::WebPointerProperties::Button::Left;
6475 click_event.x = 15; 6457 click_event.setPositionInWidget(15, 15);
6476 click_event.y = 15;
6477 click_event.clickCount = 1; 6458 click_event.clickCount = 1;
6478 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6459 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6479 6460
6480 // Prompt the WebContents to dismiss the popup by clicking elsewhere. 6461 // Prompt the WebContents to dismiss the popup by clicking elsewhere.
6481 click_event.x = 1; 6462 click_event.setPositionInWidget(1, 1);
6482 click_event.y = 1;
6483 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6463 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6484 6464
6485 filter->Wait(); 6465 filter->Wait();
6486 6466
6487 gfx::Rect popup_rect = filter->last_initial_rect(); 6467 gfx::Rect popup_rect = filter->last_initial_rect();
6488 6468
6489 #if defined(OS_MACOSX) 6469 #if defined(OS_MACOSX)
6490 EXPECT_EQ(popup_rect.x(), 9); 6470 EXPECT_EQ(popup_rect.x(), 9);
6491 EXPECT_EQ(popup_rect.y(), 9); 6471 EXPECT_EQ(popup_rect.y(), 9);
6492 #else 6472 #else
(...skipping 22 matching lines...) Expand all
6515 b_node->current_frame_host()->GetView()->GetViewBounds().x() && 6495 b_node->current_frame_host()->GetView()->GetViewBounds().x() &&
6516 last_b_node_bounds_rect.y() == 6496 last_b_node_bounds_rect.y() ==
6517 b_node->current_frame_host()->GetView()->GetViewBounds().y()) { 6497 b_node->current_frame_host()->GetView()->GetViewBounds().y()) {
6518 base::RunLoop run_loop; 6498 base::RunLoop run_loop;
6519 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 6499 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
6520 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); 6500 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
6521 run_loop.Run(); 6501 run_loop.Run();
6522 } 6502 }
6523 6503
6524 click_event.button = blink::WebPointerProperties::Button::Left; 6504 click_event.button = blink::WebPointerProperties::Button::Left;
6525 click_event.x = 15; 6505 click_event.setPositionInWidget(15, 15);
6526 click_event.y = 15;
6527 click_event.clickCount = 1; 6506 click_event.clickCount = 1;
6528 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6507 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6529 6508
6530 click_event.x = 1; 6509 click_event.setPositionInWidget(1, 1);
6531 click_event.y = 1;
6532 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6510 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6533 6511
6534 filter->Wait(); 6512 filter->Wait();
6535 6513
6536 popup_rect = filter->last_initial_rect(); 6514 popup_rect = filter->last_initial_rect();
6537 6515
6538 #if defined(OS_MACOSX) 6516 #if defined(OS_MACOSX)
6539 EXPECT_EQ(popup_rect.x(), 9); 6517 EXPECT_EQ(popup_rect.x(), 9);
6540 EXPECT_EQ(popup_rect.y(), 9); 6518 EXPECT_EQ(popup_rect.y(), 9);
6541 #else 6519 #else
(...skipping 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after
9354 ->GetInputEventRouter(); 9332 ->GetInputEventRouter();
9355 9333
9356 // Create listener for input events. 9334 // Create listener for input events.
9357 RenderWidgetHostMouseEventMonitor event_monitor( 9335 RenderWidgetHostMouseEventMonitor event_monitor(
9358 root->current_frame_host()->GetRenderWidgetHost()); 9336 root->current_frame_host()->GetRenderWidgetHost());
9359 9337
9360 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 9338 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
9361 blink::WebInputEvent::NoModifiers, 9339 blink::WebInputEvent::NoModifiers,
9362 blink::WebInputEvent::TimeStampForTesting); 9340 blink::WebInputEvent::TimeStampForTesting);
9363 mouse_event.button = blink::WebPointerProperties::Button::Left; 9341 mouse_event.button = blink::WebPointerProperties::Button::Left;
9364 mouse_event.x = 75; 9342 mouse_event.setPositionInWidget(75, 75);
9365 mouse_event.y = 75;
9366 mouse_event.clickCount = 1; 9343 mouse_event.clickCount = 1;
9367 event_monitor.ResetEventReceived(); 9344 event_monitor.ResetEventReceived();
9368 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); 9345 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
9369 9346
9370 EXPECT_TRUE(event_monitor.EventWasReceived()); 9347 EXPECT_TRUE(event_monitor.EventWasReceived());
9371 gfx::Point mouse_down_coords = 9348 gfx::Point mouse_down_coords =
9372 gfx::Point(event_monitor.event().x, event_monitor.event().y); 9349 gfx::Point(event_monitor.event().positionInWidget().x,
9350 event_monitor.event().positionInWidget().y);
9373 event_monitor.ResetEventReceived(); 9351 event_monitor.ResetEventReceived();
9374 9352
9375 mouse_event.setType(blink::WebInputEvent::MouseUp); 9353 mouse_event.setType(blink::WebInputEvent::MouseUp);
9376 mouse_event.x = 75; 9354 mouse_event.setPositionInWidget(75, 75);
9377 mouse_event.y = 75;
9378 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); 9355 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
9379 9356
9380 EXPECT_TRUE(event_monitor.EventWasReceived()); 9357 EXPECT_TRUE(event_monitor.EventWasReceived());
9381 EXPECT_EQ(mouse_down_coords, 9358 EXPECT_EQ(mouse_down_coords,
9382 gfx::Point(event_monitor.event().x, event_monitor.event().y)); 9359 gfx::Point(event_monitor.event().positionInWidget().x,
9360 event_monitor.event().positionInWidget().y));
9383 } 9361 }
9384 9362
9385 // Verify that a remote-to-local navigation in a crashed subframe works. See 9363 // Verify that a remote-to-local navigation in a crashed subframe works. See
9386 // https://crbug.com/487872. 9364 // https://crbug.com/487872.
9387 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 9365 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
9388 RemoteToLocalNavigationInCrashedSubframe) { 9366 RemoteToLocalNavigationInCrashedSubframe) {
9389 GURL main_url(embedded_test_server()->GetURL( 9367 GURL main_url(embedded_test_server()->GetURL(
9390 "a.com", "/cross_site_iframe_factory.html?a(b)")); 9368 "a.com", "/cross_site_iframe_factory.html?a(b)"));
9391 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 9369 EXPECT_TRUE(NavigateToURL(shell(), main_url));
9392 9370
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
9879 names.insert(root->children[0]->frame_entry->frame_unique_name()); 9857 names.insert(root->children[0]->frame_entry->frame_unique_name());
9880 } 9858 }
9881 9859
9882 // More than one entry in the set means that the subframe frame navigation 9860 // More than one entry in the set means that the subframe frame navigation
9883 // entries didn't have a consistent unique name. This will break history 9861 // entries didn't have a consistent unique name. This will break history
9884 // navigations =( 9862 // navigations =(
9885 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!"; 9863 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!";
9886 } 9864 }
9887 9865
9888 } // namespace content 9866 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698