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

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

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

Powered by Google App Engine
This is Rietveld 408576698