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

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 Mac crack. 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // Get the view bounds of the child iframe, which should account for the 303 // Get the view bounds of the child iframe, which should account for the
305 // relative offset of its direct parent within the root frame, for use in 304 // relative offset of its direct parent within the root frame, for use in
306 // targeting the input event. 305 // targeting the input event.
307 gfx::Rect bounds = rwhv_child->GetViewBounds(); 306 gfx::Rect bounds = rwhv_child->GetViewBounds();
308 307
309 // Target input event to child frame. 308 // Target input event to child frame.
310 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 309 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
311 blink::WebInputEvent::NoModifiers, 310 blink::WebInputEvent::NoModifiers,
312 blink::WebInputEvent::TimeStampForTesting); 311 blink::WebInputEvent::TimeStampForTesting);
313 child_event.button = blink::WebPointerProperties::Button::Left; 312 child_event.button = blink::WebPointerProperties::Button::Left;
314 child_event.x = 313 child_event.setPositionInWidget(
315 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) / 314 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) /
316 scale_factor) + 315 scale_factor) +
317 3; 316 3,
318 child_event.y =
319 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) / 317 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) /
320 scale_factor) + 318 scale_factor) +
321 3; 319 3);
322 child_event.clickCount = 1; 320 child_event.clickCount = 1;
323 main_frame_monitor.ResetEventReceived(); 321 main_frame_monitor.ResetEventReceived();
324 child_frame_monitor.ResetEventReceived(); 322 child_frame_monitor.ResetEventReceived();
325 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); 323 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo());
326 324
327 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 325 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
328 // The expected result coordinates are (3, 3), but can get slightly 326 // The expected result coordinates are (3, 3), but can get slightly
329 // different results due to rounding error with some device scale factors. 327 // different results due to rounding error with some device scale factors.
330 EXPECT_TRUE(child_frame_monitor.event().x <= 5 && 328 EXPECT_TRUE(child_frame_monitor.event().positionInWidget().x <= 5 &&
331 child_frame_monitor.event().x >= 1) 329 child_frame_monitor.event().positionInWidget().x >= 1)
332 << " actual event.x: " << child_frame_monitor.event().x; 330 << " actual event.positionInWidget().x: "
333 EXPECT_TRUE(child_frame_monitor.event().y <= 5 && 331 << child_frame_monitor.event().positionInWidget().x;
334 child_frame_monitor.event().y >= 1) 332 EXPECT_TRUE(child_frame_monitor.event().positionInWidget().y <= 5 &&
335 << " actual event.y: " << child_frame_monitor.event().y; 333 child_frame_monitor.event().positionInWidget().y >= 1)
334 << " actual event.positionInWidget().y: "
335 << child_frame_monitor.event().positionInWidget().y;
336 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 336 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
337 337
338 child_frame_monitor.ResetEventReceived(); 338 child_frame_monitor.ResetEventReceived();
339 main_frame_monitor.ResetEventReceived(); 339 main_frame_monitor.ResetEventReceived();
340 340
341 // Target input event to main frame. 341 // Target input event to main frame.
342 blink::WebMouseEvent main_event(blink::WebInputEvent::MouseDown, 342 blink::WebMouseEvent main_event(blink::WebInputEvent::MouseDown,
343 blink::WebInputEvent::NoModifiers, 343 blink::WebInputEvent::NoModifiers,
344 blink::WebInputEvent::TimeStampForTesting); 344 blink::WebInputEvent::TimeStampForTesting);
345 main_event.button = blink::WebPointerProperties::Button::Left; 345 main_event.button = blink::WebPointerProperties::Button::Left;
346 main_event.x = 1; 346 main_event.setPositionInWidget(1, 1);
347 main_event.y = 1;
348 main_event.clickCount = 1; 347 main_event.clickCount = 1;
349 // Ladies and gentlemen, THIS is the main_event! 348 // Ladies and gentlemen, THIS is the main_event!
350 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo()); 349 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo());
351 350
352 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 351 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
353 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 352 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
354 EXPECT_EQ(1, main_frame_monitor.event().x); 353 EXPECT_EQ(1, main_frame_monitor.event().positionInWidget().x);
355 EXPECT_EQ(1, main_frame_monitor.event().y); 354 EXPECT_EQ(1, main_frame_monitor.event().positionInWidget().y);
356 } 355 }
357 356
358 class RedirectNotificationObserver : public NotificationObserver { 357 class RedirectNotificationObserver : public NotificationObserver {
359 public: 358 public:
360 // Register to listen for notifications of the given type from either a 359 // Register to listen for notifications of the given type from either a
361 // specific source, or from all sources if |source| is 360 // specific source, or from all sources if |source| is
362 // NotificationService::AllSources(). 361 // NotificationService::AllSources().
363 RedirectNotificationObserver(int notification_type, 362 RedirectNotificationObserver(int notification_type,
364 const NotificationSource& source); 363 const NotificationSource& source);
365 ~RedirectNotificationObserver() override; 364 ~RedirectNotificationObserver() override;
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 scoped_refptr<FrameRectChangedMessageFilter> filter = 1067 scoped_refptr<FrameRectChangedMessageFilter> filter =
1069 new FrameRectChangedMessageFilter(); 1068 new FrameRectChangedMessageFilter();
1070 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); 1069 root->current_frame_host()->GetProcess()->AddFilter(filter.get());
1071 1070
1072 // Scroll the parent frame downward to verify that the child rect gets updated 1071 // Scroll the parent frame downward to verify that the child rect gets updated
1073 // correctly. 1072 // correctly.
1074 blink::WebMouseWheelEvent scroll_event( 1073 blink::WebMouseWheelEvent scroll_event(
1075 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, 1074 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers,
1076 blink::WebInputEvent::TimeStampForTesting); 1075 blink::WebInputEvent::TimeStampForTesting);
1077 1076
1078 scroll_event.x = gfx::ToFlooredInt( 1077 scroll_event.setPositionInWidget(
1079 (bounds.x() - rwhv_root->GetViewBounds().x() - 5) / scale_factor); 1078 gfx::ToFlooredInt((bounds.x() - rwhv_root->GetViewBounds().x() - 5) /
1080 scroll_event.y = gfx::ToFlooredInt( 1079 scale_factor),
1081 (bounds.y() - rwhv_root->GetViewBounds().y() - 5) / scale_factor); 1080 gfx::ToFlooredInt((bounds.y() - rwhv_root->GetViewBounds().y() - 5) /
1081 scale_factor));
1082 scroll_event.deltaX = 0.0f; 1082 scroll_event.deltaX = 0.0f;
1083 scroll_event.deltaY = -30.0f; 1083 scroll_event.deltaY = -30.0f;
1084 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); 1084 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo());
1085 1085
1086 filter->Wait(); 1086 filter->Wait();
1087 1087
1088 // The precise amount of scroll for the first view position update is not 1088 // The precise amount of scroll for the first view position update is not
1089 // deterministic, so this simply verifies that the OOPIF moved from its 1089 // deterministic, so this simply verifies that the OOPIF moved from its
1090 // earlier position. 1090 // earlier position.
1091 gfx::Rect update_rect = filter->last_rect(); 1091 gfx::Rect update_rect = filter->last_rect();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 // Save the original offset as a point of reference. 1156 // Save the original offset as a point of reference.
1157 filter->Wait(); 1157 filter->Wait();
1158 gfx::Rect update_rect = filter->last_rect(); 1158 gfx::Rect update_rect = filter->last_rect();
1159 int initial_y = update_rect.y(); 1159 int initial_y = update_rect.y();
1160 filter->Reset(); 1160 filter->Reset();
1161 1161
1162 // Scroll the parent frame downward. 1162 // Scroll the parent frame downward.
1163 blink::WebMouseWheelEvent scroll_event( 1163 blink::WebMouseWheelEvent scroll_event(
1164 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, 1164 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers,
1165 blink::WebInputEvent::TimeStampForTesting); 1165 blink::WebInputEvent::TimeStampForTesting);
1166 scroll_event.x = 1; 1166 scroll_event.setPositionInWidget(1, 1);
1167 scroll_event.y = 1;
1168 scroll_event.deltaX = 0.0f; 1167 scroll_event.deltaX = 0.0f;
1169 scroll_event.deltaY = -5.0f; 1168 scroll_event.deltaY = -5.0f;
1170 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); 1169 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo());
1171 1170
1172 // Ensure that the view position is propagated to the child properly. 1171 // Ensure that the view position is propagated to the child properly.
1173 filter->Wait(); 1172 filter->Wait();
1174 update_rect = filter->last_rect(); 1173 update_rect = filter->last_rect();
1175 EXPECT_LT(update_rect.y(), initial_y); 1174 EXPECT_LT(update_rect.y(), initial_y);
1176 filter->Reset(); 1175 filter->Reset();
1177 1176
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 // Get the view bounds of the nested iframe, which should account for the 1402 // Get the view bounds of the nested iframe, which should account for the
1404 // relative offset of its direct parent within the root frame, for use in 1403 // relative offset of its direct parent within the root frame, for use in
1405 // targeting the input event. 1404 // targeting the input event.
1406 gfx::Rect bounds = rwhv_nested->GetViewBounds(); 1405 gfx::Rect bounds = rwhv_nested->GetViewBounds();
1407 1406
1408 // Target input event to nested frame. 1407 // Target input event to nested frame.
1409 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown, 1408 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown,
1410 blink::WebInputEvent::NoModifiers, 1409 blink::WebInputEvent::NoModifiers,
1411 blink::WebInputEvent::TimeStampForTesting); 1410 blink::WebInputEvent::TimeStampForTesting);
1412 nested_event.button = blink::WebPointerProperties::Button::Left; 1411 nested_event.button = blink::WebPointerProperties::Button::Left;
1413 nested_event.x = 1412 nested_event.setPositionInWidget(
1414 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) / 1413 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) /
1415 scale_factor) + 1414 scale_factor) +
1416 5; 1415 5,
1417 nested_event.y =
1418 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) / 1416 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) /
1419 scale_factor) + 1417 scale_factor) +
1420 5; 1418 5);
1421 nested_event.clickCount = 1; 1419 nested_event.clickCount = 1;
1422 nested_frame_monitor.ResetEventReceived(); 1420 nested_frame_monitor.ResetEventReceived();
1423 main_frame_monitor.ResetEventReceived(); 1421 main_frame_monitor.ResetEventReceived();
1424 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo()); 1422 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo());
1425 1423
1426 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); 1424 EXPECT_TRUE(nested_frame_monitor.EventWasReceived());
1427 // The expected result coordinates are (5, 5), but can get slightly 1425 // The expected result coordinates are (5, 5), but can get slightly
1428 // different results due to rounding error with some device scale factors. 1426 // different results due to rounding error with some device scale factors.
1429 EXPECT_TRUE(nested_frame_monitor.event().x <= 6 && 1427 EXPECT_TRUE(nested_frame_monitor.event().positionInWidget().x <= 6 &&
1430 nested_frame_monitor.event().x >= 4) 1428 nested_frame_monitor.event().positionInWidget().x >= 4)
1431 << " actual event.x: " << nested_frame_monitor.event().x; 1429 << " actual event.positionInWidget().x: "
1432 EXPECT_TRUE(nested_frame_monitor.event().y <= 6 && 1430 << nested_frame_monitor.event().positionInWidget().x;
1433 nested_frame_monitor.event().y >= 4) 1431 EXPECT_TRUE(nested_frame_monitor.event().positionInWidget().y <= 6 &&
1434 << " actual event.y: " << nested_frame_monitor.event().y; 1432 nested_frame_monitor.event().positionInWidget().y >= 4)
1433 << " actual event.positionInWidget().y: "
1434 << nested_frame_monitor.event().positionInWidget().y;
1435 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1435 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1436 } 1436 }
1437 1437
1438 // This test tests that browser process hittesting ignores frames with 1438 // This test tests that browser process hittesting ignores frames with
1439 // pointer-events: none. 1439 // pointer-events: none.
1440 #if defined(OS_ANDROID) 1440 #if defined(OS_ANDROID)
1441 // Test failing on some Android builders, due to inaccurate coordinates on 1441 // Test failing on some Android builders, due to inaccurate coordinates on
1442 // some devices. See: https://crbug.com/700007. 1442 // some devices. See: https://crbug.com/700007.
1443 #define MAYBE_SurfaceHitTestPointerEventsNone \ 1443 #define MAYBE_SurfaceHitTestPointerEventsNone \
1444 DISABLED_SurfaceHitTestPointerEventsNone 1444 DISABLED_SurfaceHitTestPointerEventsNone
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 1477
1478 SurfaceHitTestReadyNotifier notifier( 1478 SurfaceHitTestReadyNotifier notifier(
1479 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); 1479 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1480 notifier.WaitForSurfaceReady(); 1480 notifier.WaitForSurfaceReady();
1481 1481
1482 // Target input event to child frame. 1482 // Target input event to child frame.
1483 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 1483 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
1484 blink::WebInputEvent::NoModifiers, 1484 blink::WebInputEvent::NoModifiers,
1485 blink::WebInputEvent::TimeStampForTesting); 1485 blink::WebInputEvent::TimeStampForTesting);
1486 child_event.button = blink::WebPointerProperties::Button::Left; 1486 child_event.button = blink::WebPointerProperties::Button::Left;
1487 child_event.x = 75; 1487 child_event.setPositionInWidget(75, 75);
1488 child_event.y = 75;
1489 child_event.clickCount = 1; 1488 child_event.clickCount = 1;
1490 main_frame_monitor.ResetEventReceived(); 1489 main_frame_monitor.ResetEventReceived();
1491 child_frame_monitor.ResetEventReceived(); 1490 child_frame_monitor.ResetEventReceived();
1492 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); 1491 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo());
1493 1492
1494 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1493 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1495 EXPECT_EQ(75, main_frame_monitor.event().x); 1494 EXPECT_EQ(75, main_frame_monitor.event().positionInWidget().x);
1496 EXPECT_EQ(75, main_frame_monitor.event().y); 1495 EXPECT_EQ(75, main_frame_monitor.event().positionInWidget().y);
1497 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1496 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1498 } 1497 }
1499 1498
1500 // This test verifies that MouseEnter and MouseLeave events fire correctly 1499 // This test verifies that MouseEnter and MouseLeave events fire correctly
1501 // when the mouse cursor moves between processes. 1500 // when the mouse cursor moves between processes.
1502 #if defined(OS_ANDROID) 1501 #if defined(OS_ANDROID)
1503 // Test failing on some Android builders, due to inaccurate coordinates on 1502 // Test failing on some Android builders, due to inaccurate coordinates on
1504 // some devices. See: https://crbug.com/700007. 1503 // some devices. See: https://crbug.com/700007.
1505 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \ 1504 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \
1506 DISABLED_CrossProcessMouseEnterAndLeaveTest 1505 DISABLED_CrossProcessMouseEnterAndLeaveTest
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 gfx::Point point_in_b_frame( 1575 gfx::Point point_in_b_frame(
1577 gfx::ToCeiledInt((b_bounds.x() - a_bounds.x()) / scale_factor) + 25, 1576 gfx::ToCeiledInt((b_bounds.x() - a_bounds.x()) / scale_factor) + 25,
1578 gfx::ToCeiledInt((b_bounds.y() - a_bounds.y()) / scale_factor) + 25); 1577 gfx::ToCeiledInt((b_bounds.y() - a_bounds.y()) / scale_factor) + 25);
1579 gfx::Point point_in_d_frame( 1578 gfx::Point point_in_d_frame(
1580 gfx::ToCeiledInt((d_bounds.x() - a_bounds.x()) / scale_factor) + 25, 1579 gfx::ToCeiledInt((d_bounds.x() - a_bounds.x()) / scale_factor) + 25,
1581 gfx::ToCeiledInt((d_bounds.y() - a_bounds.y()) / scale_factor) + 25); 1580 gfx::ToCeiledInt((d_bounds.y() - a_bounds.y()) / scale_factor) + 25);
1582 1581
1583 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove, 1582 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove,
1584 blink::WebInputEvent::NoModifiers, 1583 blink::WebInputEvent::NoModifiers,
1585 blink::WebInputEvent::TimeStampForTesting); 1584 blink::WebInputEvent::TimeStampForTesting);
1586 mouse_event.x = point_in_a_frame.x(); 1585 mouse_event.setPositionInWidget(point_in_a_frame.x(), point_in_a_frame.y());
1587 mouse_event.y = point_in_a_frame.y();
1588 1586
1589 // Send an initial MouseMove to the root view, which shouldn't affect the 1587 // Send an initial MouseMove to the root view, which shouldn't affect the
1590 // other renderers. 1588 // other renderers.
1591 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1589 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1592 ui::LatencyInfo()); 1590 ui::LatencyInfo());
1593 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1591 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1594 a_frame_monitor.ResetEventReceived(); 1592 a_frame_monitor.ResetEventReceived();
1595 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); 1593 EXPECT_FALSE(b_frame_monitor.EventWasReceived());
1596 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1594 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1597 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1595 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1598 1596
1599 // Next send a MouseMove to B frame, which shouldn't affect C or D but 1597 // Next send a MouseMove to B frame, which shouldn't affect C or D but
1600 // A should receive a MouseMove event. 1598 // A should receive a MouseMove event.
1601 mouse_event.x = point_in_b_frame.x(); 1599 mouse_event.setPositionInWidget(point_in_b_frame.x(), point_in_b_frame.y());
1602 mouse_event.y = point_in_b_frame.y();
1603 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1600 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1604 ui::LatencyInfo()); 1601 ui::LatencyInfo());
1605 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1602 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1606 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); 1603 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1607 a_frame_monitor.ResetEventReceived(); 1604 a_frame_monitor.ResetEventReceived();
1608 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1605 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1609 b_frame_monitor.ResetEventReceived(); 1606 b_frame_monitor.ResetEventReceived();
1610 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1607 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1611 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1608 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1612 1609
1613 // Next send a MouseMove to D frame, which should have side effects in every 1610 // Next send a MouseMove to D frame, which should have side effects in every
1614 // other RenderWidgetHostView. 1611 // other RenderWidgetHostView.
1615 mouse_event.x = point_in_d_frame.x(); 1612 mouse_event.setPositionInWidget(point_in_d_frame.x(), point_in_d_frame.y());
1616 mouse_event.y = point_in_d_frame.y();
1617 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1613 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1618 ui::LatencyInfo()); 1614 ui::LatencyInfo());
1619 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1615 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1620 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); 1616 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1621 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1617 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1622 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave); 1618 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave);
1623 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); 1619 EXPECT_TRUE(c_frame_monitor.EventWasReceived());
1624 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); 1620 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1625 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); 1621 EXPECT_TRUE(d_frame_monitor.EventWasReceived());
1626 } 1622 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 int child_frame_target_y = 1678 int child_frame_target_y =
1683 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) / 1679 gfx::ToCeiledInt((bounds.y() - root_view->GetViewBounds().y()) /
1684 scale_factor) + 1680 scale_factor) +
1685 5; 1681 5;
1686 1682
1687 // Target MouseDown to child frame. 1683 // Target MouseDown to child frame.
1688 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 1684 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
1689 blink::WebInputEvent::NoModifiers, 1685 blink::WebInputEvent::NoModifiers,
1690 blink::WebInputEvent::TimeStampForTesting); 1686 blink::WebInputEvent::TimeStampForTesting);
1691 mouse_event.button = blink::WebPointerProperties::Button::Left; 1687 mouse_event.button = blink::WebPointerProperties::Button::Left;
1692 mouse_event.x = child_frame_target_x; 1688 mouse_event.setPositionInWidget(child_frame_target_x, child_frame_target_y);
1693 mouse_event.y = child_frame_target_y;
1694 mouse_event.clickCount = 1; 1689 mouse_event.clickCount = 1;
1695 main_frame_monitor.ResetEventReceived(); 1690 main_frame_monitor.ResetEventReceived();
1696 child_frame_monitor.ResetEventReceived(); 1691 child_frame_monitor.ResetEventReceived();
1697 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1692 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1698 1693
1699 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1694 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1700 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 1695 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
1701 1696
1702 // Target MouseMove to main frame. This should still be routed to the 1697 // Target MouseMove to main frame. This should still be routed to the
1703 // child frame because it is now capturing mouse input. 1698 // child frame because it is now capturing mouse input.
1704 mouse_event.setType(blink::WebInputEvent::MouseMove); 1699 mouse_event.setType(blink::WebInputEvent::MouseMove);
1705 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown); 1700 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown);
1706 mouse_event.x = 1; 1701 mouse_event.setPositionInWidget(1, 1);
1707 mouse_event.y = 1;
1708 // Note that this event is sent twice, with the monitors cleared after 1702 // Note that this event is sent twice, with the monitors cleared after
1709 // the first time, because the first MouseMove to the child frame 1703 // the first time, because the first MouseMove to the child frame
1710 // causes a MouseMove to be sent to the main frame also, which we 1704 // causes a MouseMove to be sent to the main frame also, which we
1711 // need to ignore. 1705 // need to ignore.
1712 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1706 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1713 main_frame_monitor.ResetEventReceived(); 1707 main_frame_monitor.ResetEventReceived();
1714 child_frame_monitor.ResetEventReceived(); 1708 child_frame_monitor.ResetEventReceived();
1715 mouse_event.x = 1; 1709 mouse_event.setPositionInWidget(1, 2);
1716 mouse_event.y = 2;
1717 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1710 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1718 1711
1719 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1712 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1720 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 1713 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
1721 1714
1722 // A MouseUp to the child frame should cancel the mouse capture. 1715 // A MouseUp to the child frame should cancel the mouse capture.
1723 mouse_event.setType(blink::WebInputEvent::MouseUp); 1716 mouse_event.setType(blink::WebInputEvent::MouseUp);
1724 mouse_event.setModifiers(blink::WebInputEvent::NoModifiers); 1717 mouse_event.setModifiers(blink::WebInputEvent::NoModifiers);
1725 mouse_event.x = child_frame_target_x; 1718 mouse_event.setPositionInWidget(child_frame_target_x, child_frame_target_y);
1726 mouse_event.y = child_frame_target_y;
1727 main_frame_monitor.ResetEventReceived(); 1719 main_frame_monitor.ResetEventReceived();
1728 child_frame_monitor.ResetEventReceived(); 1720 child_frame_monitor.ResetEventReceived();
1729 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1721 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1730 1722
1731 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1723 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1732 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 1724 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
1733 1725
1734 // Subsequent MouseMove events targeted to the main frame should be routed 1726 // Subsequent MouseMove events targeted to the main frame should be routed
1735 // to that frame. 1727 // to that frame.
1736 mouse_event.setType(blink::WebInputEvent::MouseMove); 1728 mouse_event.setType(blink::WebInputEvent::MouseMove);
1737 mouse_event.x = 1; 1729 mouse_event.setPositionInWidget(1, 3);
1738 mouse_event.y = 3;
1739 // Sending the MouseMove twice for the same reason as above. 1730 // Sending the MouseMove twice for the same reason as above.
1740 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1731 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1741 main_frame_monitor.ResetEventReceived(); 1732 main_frame_monitor.ResetEventReceived();
1742 child_frame_monitor.ResetEventReceived(); 1733 child_frame_monitor.ResetEventReceived();
1743 mouse_event.x = 1; 1734 mouse_event.setPositionInWidget(1, 4);
1744 mouse_event.y = 4;
1745 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1735 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1746 1736
1747 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1737 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1748 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1738 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1749 1739
1750 // Target MouseDown to the main frame to cause it to capture input. 1740 // Target MouseDown to the main frame to cause it to capture input.
1751 mouse_event.setType(blink::WebInputEvent::MouseDown); 1741 mouse_event.setType(blink::WebInputEvent::MouseDown);
1752 mouse_event.x = 1; 1742 mouse_event.setPositionInWidget(1, 1);
1753 mouse_event.y = 1;
1754 main_frame_monitor.ResetEventReceived(); 1743 main_frame_monitor.ResetEventReceived();
1755 child_frame_monitor.ResetEventReceived(); 1744 child_frame_monitor.ResetEventReceived();
1756 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1745 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1757 1746
1758 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1747 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1759 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1748 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1760 1749
1761 // Sending a MouseMove to the child frame should still result in the main 1750 // Sending a MouseMove to the child frame should still result in the main
1762 // frame receiving the event. 1751 // frame receiving the event.
1763 mouse_event.setType(blink::WebInputEvent::MouseMove); 1752 mouse_event.setType(blink::WebInputEvent::MouseMove);
1764 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown); 1753 mouse_event.setModifiers(blink::WebInputEvent::LeftButtonDown);
1765 mouse_event.x = child_frame_target_x; 1754 mouse_event.setPositionInWidget(child_frame_target_x, child_frame_target_y);
1766 mouse_event.y = child_frame_target_y;
1767 main_frame_monitor.ResetEventReceived(); 1755 main_frame_monitor.ResetEventReceived();
1768 child_frame_monitor.ResetEventReceived(); 1756 child_frame_monitor.ResetEventReceived();
1769 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); 1757 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo());
1770 1758
1771 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1759 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1772 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1760 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1773 } 1761 }
1774 1762
1775 // Tests OOPIF rendering by checking that the RWH of the iframe generates 1763 // Tests OOPIF rendering by checking that the RWH of the iframe generates
1776 // OnSwapCompositorFrame message. 1764 // OnSwapCompositorFrame message.
(...skipping 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after
5435 child_node->current_frame_host()->GetSiteInstance()); 5423 child_node->current_frame_host()->GetSiteInstance());
5436 5424
5437 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); 5425 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter();
5438 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 5426 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
5439 5427
5440 // Send a MouseMove to the subframe. The frame contains text, and moving the 5428 // Send a MouseMove to the subframe. The frame contains text, and moving the
5441 // mouse over it should cause the renderer to send a mouse cursor update. 5429 // mouse over it should cause the renderer to send a mouse cursor update.
5442 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove, 5430 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseMove,
5443 blink::WebInputEvent::NoModifiers, 5431 blink::WebInputEvent::NoModifiers,
5444 blink::WebInputEvent::TimeStampForTesting); 5432 blink::WebInputEvent::TimeStampForTesting);
5445 mouse_event.x = 60; 5433 mouse_event.setPositionInWidget(60, 60);
5446 mouse_event.y = 60;
5447 RenderWidgetHost* rwh_child = 5434 RenderWidgetHost* rwh_child =
5448 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); 5435 root->child_at(0)->current_frame_host()->GetRenderWidgetHost();
5449 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 5436 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
5450 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 5437 root->current_frame_host()->GetRenderWidgetHost()->GetView());
5451 web_contents()->GetInputEventRouter()->RouteMouseEvent( 5438 web_contents()->GetInputEventRouter()->RouteMouseEvent(
5452 root_view, &mouse_event, ui::LatencyInfo()); 5439 root_view, &mouse_event, ui::LatencyInfo());
5453 5440
5454 // CursorMessageFilter::Wait() implicitly tests whether we receive a 5441 // CursorMessageFilter::Wait() implicitly tests whether we receive a
5455 // ViewHostMsg_SetCursor message from the renderer process, because it does 5442 // ViewHostMsg_SetCursor message from the renderer process, because it does
5456 // does not return otherwise. 5443 // does not return otherwise.
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
6233 6220
6234 gfx::Point point( 6221 gfx::Point point(
6235 gfx::ToCeiledInt((bounds.x() - root_bounds.x()) / scale_factor) + 10, 6222 gfx::ToCeiledInt((bounds.x() - root_bounds.x()) / scale_factor) + 10,
6236 gfx::ToCeiledInt((bounds.y() - root_bounds.y()) / scale_factor) + 10); 6223 gfx::ToCeiledInt((bounds.y() - root_bounds.y()) / scale_factor) + 10);
6237 6224
6238 // Target right-click event to child frame. 6225 // Target right-click event to child frame.
6239 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, 6226 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown,
6240 blink::WebInputEvent::NoModifiers, 6227 blink::WebInputEvent::NoModifiers,
6241 blink::WebInputEvent::TimeStampForTesting); 6228 blink::WebInputEvent::TimeStampForTesting);
6242 click_event.button = blink::WebPointerProperties::Button::Right; 6229 click_event.button = blink::WebPointerProperties::Button::Right;
6243 click_event.x = point.x(); 6230 click_event.setPositionInWidget(point.x(), point.y());
6244 click_event.y = point.y();
6245 click_event.clickCount = 1; 6231 click_event.clickCount = 1;
6246 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); 6232 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo());
6247 6233
6248 // We also need a MouseUp event, needed by Windows. 6234 // We also need a MouseUp event, needed by Windows.
6249 click_event.setType(blink::WebInputEvent::MouseUp); 6235 click_event.setType(blink::WebInputEvent::MouseUp);
6250 click_event.x = point.x(); 6236 click_event.setPositionInWidget(point.x(), point.y());
6251 click_event.y = point.y();
6252 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); 6237 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo());
6253 6238
6254 context_menu_delegate.Wait(); 6239 context_menu_delegate.Wait();
6255 6240
6256 ContextMenuParams params = context_menu_delegate.getParams(); 6241 ContextMenuParams params = context_menu_delegate.getParams();
6257 6242
6258 EXPECT_EQ(point.x(), params.x); 6243 EXPECT_EQ(point.x(), params.x);
6259 EXPECT_EQ(point.y(), params.y); 6244 EXPECT_EQ(point.y(), params.y);
6260 } 6245 }
6261 6246
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
6387 child_node->current_frame_host()->GetSiteInstance()); 6372 child_node->current_frame_host()->GetSiteInstance());
6388 6373
6389 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); 6374 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter();
6390 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 6375 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
6391 6376
6392 // Target left-click event to child frame. 6377 // Target left-click event to child frame.
6393 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, 6378 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown,
6394 blink::WebInputEvent::NoModifiers, 6379 blink::WebInputEvent::NoModifiers,
6395 blink::WebInputEvent::TimeStampForTesting); 6380 blink::WebInputEvent::TimeStampForTesting);
6396 click_event.button = blink::WebPointerProperties::Button::Left; 6381 click_event.button = blink::WebPointerProperties::Button::Left;
6397 click_event.x = 15; 6382 click_event.setPositionInWidget(15, 15);
6398 click_event.y = 15;
6399 click_event.clickCount = 1; 6383 click_event.clickCount = 1;
6400 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6384 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo());
6401 6385
6402 // Dismiss the popup. 6386 // Dismiss the popup.
6403 click_event.x = 1; 6387 click_event.setPositionInWidget(1, 1);
6404 click_event.y = 1;
6405 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6388 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo());
6406 6389
6407 filter->Wait(); 6390 filter->Wait();
6408 gfx::Rect popup_rect = filter->last_initial_rect(); 6391 gfx::Rect popup_rect = filter->last_initial_rect();
6409 #if defined(OS_MACOSX) || defined(OS_ANDROID) 6392 #if defined(OS_MACOSX) || defined(OS_ANDROID)
6410 // On Mac and Android we receive the coordinates before they are transformed, 6393 // On Mac and Android we receive the coordinates before they are transformed,
6411 // so they are still relative to the out-of-process iframe origin. 6394 // so they are still relative to the out-of-process iframe origin.
6412 EXPECT_EQ(popup_rect.x(), 9); 6395 EXPECT_EQ(popup_rect.x(), 9);
6413 EXPECT_EQ(popup_rect.y(), 9); 6396 EXPECT_EQ(popup_rect.y(), 9);
6414 #else 6397 #else
6415 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); 6398 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354);
6416 EXPECT_EQ(popup_rect.y() - rwhv_root->GetViewBounds().y(), 94); 6399 EXPECT_EQ(popup_rect.y() - rwhv_root->GetViewBounds().y(), 94);
6417 #endif 6400 #endif
6418 6401
6419 #if defined(OS_LINUX) 6402 #if defined(OS_LINUX)
6420 // Verify click-and-drag selection of popups still works on Linux with 6403 // Verify click-and-drag selection of popups still works on Linux with
6421 // OOPIFs enabled. This is only necessary to test on Aura because Mac and 6404 // OOPIFs enabled. This is only necessary to test on Aura because Mac and
6422 // Android use native widgets. Windows does not support this as UI 6405 // Android use native widgets. Windows does not support this as UI
6423 // convention (it requires separate clicks to open the menu and select an 6406 // convention (it requires separate clicks to open the menu and select an
6424 // option). See https://crbug.com/703191. 6407 // option). See https://crbug.com/703191.
6425 int process_id = child_node->current_frame_host()->GetProcess()->GetID(); 6408 int process_id = child_node->current_frame_host()->GetProcess()->GetID();
6426 filter->Reset(); 6409 filter->Reset();
6427 RenderWidgetHostInputEventRouter* router = 6410 RenderWidgetHostInputEventRouter* router =
6428 static_cast<WebContentsImpl*>(shell()->web_contents()) 6411 static_cast<WebContentsImpl*>(shell()->web_contents())
6429 ->GetInputEventRouter(); 6412 ->GetInputEventRouter();
6430 // Re-open the select element. 6413 // Re-open the select element.
6431 click_event.x = 360; 6414 click_event.setPositionInWidget(360, 90);
6432 click_event.y = 90;
6433 click_event.clickCount = 1; 6415 click_event.clickCount = 1;
6434 router->RouteMouseEvent(rwhv_root, &click_event, ui::LatencyInfo()); 6416 router->RouteMouseEvent(rwhv_root, &click_event, ui::LatencyInfo());
6435 6417
6436 filter->Wait(); 6418 filter->Wait();
6437 6419
6438 RenderWidgetHostView* popup_view = 6420 RenderWidgetHostView* popup_view =
6439 RenderWidgetHost::FromID(process_id, filter->last_routing_id()) 6421 RenderWidgetHost::FromID(process_id, filter->last_routing_id())
6440 ->GetView(); 6422 ->GetView();
6441 6423
6442 RenderWidgetHostMouseEventMonitor popup_monitor( 6424 RenderWidgetHostMouseEventMonitor popup_monitor(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
6504 c_node->current_frame_host()->GetSiteInstance()); 6486 c_node->current_frame_host()->GetSiteInstance());
6505 6487
6506 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); 6488 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter();
6507 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 6489 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
6508 6490
6509 // Target left-click event to child frame. 6491 // Target left-click event to child frame.
6510 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown, 6492 blink::WebMouseEvent click_event(blink::WebInputEvent::MouseDown,
6511 blink::WebInputEvent::NoModifiers, 6493 blink::WebInputEvent::NoModifiers,
6512 blink::WebInputEvent::TimeStampForTesting); 6494 blink::WebInputEvent::TimeStampForTesting);
6513 click_event.button = blink::WebPointerProperties::Button::Left; 6495 click_event.button = blink::WebPointerProperties::Button::Left;
6514 click_event.x = 15; 6496 click_event.setPositionInWidget(15, 15);
6515 click_event.y = 15;
6516 click_event.clickCount = 1; 6497 click_event.clickCount = 1;
6517 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6498 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6518 6499
6519 // Prompt the WebContents to dismiss the popup by clicking elsewhere. 6500 // Prompt the WebContents to dismiss the popup by clicking elsewhere.
6520 click_event.x = 1; 6501 click_event.setPositionInWidget(1, 1);
6521 click_event.y = 1;
6522 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6502 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6523 6503
6524 filter->Wait(); 6504 filter->Wait();
6525 6505
6526 gfx::Rect popup_rect = filter->last_initial_rect(); 6506 gfx::Rect popup_rect = filter->last_initial_rect();
6527 6507
6528 #if defined(OS_MACOSX) 6508 #if defined(OS_MACOSX)
6529 EXPECT_EQ(popup_rect.x(), 9); 6509 EXPECT_EQ(popup_rect.x(), 9);
6530 EXPECT_EQ(popup_rect.y(), 9); 6510 EXPECT_EQ(popup_rect.y(), 9);
6531 #else 6511 #else
(...skipping 22 matching lines...) Expand all
6554 b_node->current_frame_host()->GetView()->GetViewBounds().x() && 6534 b_node->current_frame_host()->GetView()->GetViewBounds().x() &&
6555 last_b_node_bounds_rect.y() == 6535 last_b_node_bounds_rect.y() ==
6556 b_node->current_frame_host()->GetView()->GetViewBounds().y()) { 6536 b_node->current_frame_host()->GetView()->GetViewBounds().y()) {
6557 base::RunLoop run_loop; 6537 base::RunLoop run_loop;
6558 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 6538 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
6559 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); 6539 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
6560 run_loop.Run(); 6540 run_loop.Run();
6561 } 6541 }
6562 6542
6563 click_event.button = blink::WebPointerProperties::Button::Left; 6543 click_event.button = blink::WebPointerProperties::Button::Left;
6564 click_event.x = 15; 6544 click_event.setPositionInWidget(15, 15);
6565 click_event.y = 15;
6566 click_event.clickCount = 1; 6545 click_event.clickCount = 1;
6567 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6546 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6568 6547
6569 click_event.x = 1; 6548 click_event.setPositionInWidget(1, 1);
6570 click_event.y = 1;
6571 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 6549 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
6572 6550
6573 filter->Wait(); 6551 filter->Wait();
6574 6552
6575 popup_rect = filter->last_initial_rect(); 6553 popup_rect = filter->last_initial_rect();
6576 6554
6577 #if defined(OS_MACOSX) 6555 #if defined(OS_MACOSX)
6578 EXPECT_EQ(popup_rect.x(), 9); 6556 EXPECT_EQ(popup_rect.x(), 9);
6579 EXPECT_EQ(popup_rect.y(), 9); 6557 EXPECT_EQ(popup_rect.y(), 9);
6580 #else 6558 #else
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after
9395 ->GetInputEventRouter(); 9373 ->GetInputEventRouter();
9396 9374
9397 // Create listener for input events. 9375 // Create listener for input events.
9398 RenderWidgetHostMouseEventMonitor event_monitor( 9376 RenderWidgetHostMouseEventMonitor event_monitor(
9399 root->current_frame_host()->GetRenderWidgetHost()); 9377 root->current_frame_host()->GetRenderWidgetHost());
9400 9378
9401 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 9379 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
9402 blink::WebInputEvent::NoModifiers, 9380 blink::WebInputEvent::NoModifiers,
9403 blink::WebInputEvent::TimeStampForTesting); 9381 blink::WebInputEvent::TimeStampForTesting);
9404 mouse_event.button = blink::WebPointerProperties::Button::Left; 9382 mouse_event.button = blink::WebPointerProperties::Button::Left;
9405 mouse_event.x = 75; 9383 mouse_event.setPositionInWidget(75, 75);
9406 mouse_event.y = 75;
9407 mouse_event.clickCount = 1; 9384 mouse_event.clickCount = 1;
9408 event_monitor.ResetEventReceived(); 9385 event_monitor.ResetEventReceived();
9409 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); 9386 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
9410 9387
9411 EXPECT_TRUE(event_monitor.EventWasReceived()); 9388 EXPECT_TRUE(event_monitor.EventWasReceived());
9412 gfx::Point mouse_down_coords = 9389 gfx::Point mouse_down_coords =
9413 gfx::Point(event_monitor.event().x, event_monitor.event().y); 9390 gfx::Point(event_monitor.event().positionInWidget().x,
9391 event_monitor.event().positionInWidget().y);
9414 event_monitor.ResetEventReceived(); 9392 event_monitor.ResetEventReceived();
9415 9393
9416 mouse_event.setType(blink::WebInputEvent::MouseUp); 9394 mouse_event.setType(blink::WebInputEvent::MouseUp);
9417 mouse_event.x = 75; 9395 mouse_event.setPositionInWidget(75, 75);
9418 mouse_event.y = 75;
9419 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); 9396 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
9420 9397
9421 EXPECT_TRUE(event_monitor.EventWasReceived()); 9398 EXPECT_TRUE(event_monitor.EventWasReceived());
9422 EXPECT_EQ(mouse_down_coords, 9399 EXPECT_EQ(mouse_down_coords,
9423 gfx::Point(event_monitor.event().x, event_monitor.event().y)); 9400 gfx::Point(event_monitor.event().positionInWidget().x,
9401 event_monitor.event().positionInWidget().y));
9424 } 9402 }
9425 9403
9426 // This tests that we don't hide the RenderViewHost when reusing the 9404 // This tests that we don't hide the RenderViewHost when reusing the
9427 // RenderViewHost for a subframe. See https://crbug.com/638375. 9405 // RenderViewHost for a subframe. See https://crbug.com/638375.
9428 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ReusedRenderViewNotHidden) { 9406 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ReusedRenderViewNotHidden) {
9429 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html")); 9407 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
9430 GURL b_url_a_subframe(embedded_test_server()->GetURL( 9408 GURL b_url_a_subframe(embedded_test_server()->GetURL(
9431 "b.com", "/cross_site_iframe_factory.html?b(a)")); 9409 "b.com", "/cross_site_iframe_factory.html?b(a)"));
9432 9410
9433 EXPECT_TRUE(NavigateToURL(shell(), a_url)); 9411 EXPECT_TRUE(NavigateToURL(shell(), a_url));
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
9995 names.insert(root->children[0]->frame_entry->frame_unique_name()); 9973 names.insert(root->children[0]->frame_entry->frame_unique_name());
9996 } 9974 }
9997 9975
9998 // More than one entry in the set means that the subframe frame navigation 9976 // More than one entry in the set means that the subframe frame navigation
9999 // entries didn't have a consistent unique name. This will break history 9977 // entries didn't have a consistent unique name. This will break history
10000 // navigations =( 9978 // navigations =(
10001 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!"; 9979 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!";
10002 } 9980 }
10003 9981
10004 } // namespace content 9982 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698