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

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

Issue 2786223002: Fix flakiness in DragAndDropBrowserTests (Closed)
Patch Set: Review comments addressed 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 RenderWidgetHostInputEventRouter* router = 289 RenderWidgetHostInputEventRouter* router =
290 static_cast<WebContentsImpl*>(shell->web_contents()) 290 static_cast<WebContentsImpl*>(shell->web_contents())
291 ->GetInputEventRouter(); 291 ->GetInputEventRouter();
292 292
293 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 293 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
294 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 294 root->current_frame_host()->GetRenderWidgetHost()->GetView());
295 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 295 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
296 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 296 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
297 297
298 SurfaceHitTestReadyNotifier notifier( 298 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
299 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
300 notifier.WaitForSurfaceReady();
301 299
302 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell); 300 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell);
303 301
304 // Get the view bounds of the child iframe, which should account for the 302 // 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 303 // relative offset of its direct parent within the root frame, for use in
306 // targeting the input event. 304 // targeting the input event.
307 gfx::Rect bounds = rwhv_child->GetViewBounds(); 305 gfx::Rect bounds = rwhv_child->GetViewBounds();
308 306
309 // Target input event to child frame. 307 // Target input event to child frame.
310 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 308 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 " B = http://baz.com/", 1031 " B = http://baz.com/",
1034 DepictFrameTree(root)); 1032 DepictFrameTree(root));
1035 1033
1036 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0); 1034 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0);
1037 RenderWidgetHostViewBase* rwhv_nested = 1035 RenderWidgetHostViewBase* rwhv_nested =
1038 static_cast<RenderWidgetHostViewBase*>( 1036 static_cast<RenderWidgetHostViewBase*>(
1039 nested_iframe_node->current_frame_host() 1037 nested_iframe_node->current_frame_host()
1040 ->GetRenderWidgetHost() 1038 ->GetRenderWidgetHost()
1041 ->GetView()); 1039 ->GetView());
1042 1040
1043 SurfaceHitTestReadyNotifier notifier( 1041 WaitForChildFrameSurfaceReady(nested_iframe_node->current_frame_host());
1044 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
1045 notifier.WaitForSurfaceReady();
1046 1042
1047 #if defined(OS_ANDROID) 1043 #if defined(OS_ANDROID)
1048 // Android browser tests have some differences that affect the results. One 1044 // Android browser tests have some differences that affect the results. One
1049 // is viewport dimensions, the other is that it handles scale factor 1045 // is viewport dimensions, the other is that it handles scale factor
1050 // differently. 1046 // differently.
1051 int expected_x = 487; 1047 int expected_x = 487;
1052 #else 1048 #else
1053 int expected_x = 397; 1049 int expected_x = 397;
1054 #endif 1050 #endif
1055 int expected_y = 112; 1051 int expected_y = 112;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 parent_iframe_node->current_frame_host() 1138 parent_iframe_node->current_frame_host()
1143 ->GetRenderWidgetHost() 1139 ->GetRenderWidgetHost()
1144 ->GetView()); 1140 ->GetView());
1145 1141
1146 RenderWidgetHostViewBase* rwhv_nested = 1142 RenderWidgetHostViewBase* rwhv_nested =
1147 static_cast<RenderWidgetHostViewBase*>( 1143 static_cast<RenderWidgetHostViewBase*>(
1148 nested_iframe_node->current_frame_host() 1144 nested_iframe_node->current_frame_host()
1149 ->GetRenderWidgetHost() 1145 ->GetRenderWidgetHost()
1150 ->GetView()); 1146 ->GetView());
1151 1147
1152 SurfaceHitTestReadyNotifier notifier( 1148 WaitForChildFrameSurfaceReady(nested_iframe_node->current_frame_host());
1153 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
1154 notifier.WaitForSurfaceReady();
1155 1149
1156 // Save the original offset as a point of reference. 1150 // Save the original offset as a point of reference.
1157 filter->Wait(); 1151 filter->Wait();
1158 gfx::Rect update_rect = filter->last_rect(); 1152 gfx::Rect update_rect = filter->last_rect();
1159 int initial_y = update_rect.y(); 1153 int initial_y = update_rect.y();
1160 filter->Reset(); 1154 filter->Reset();
1161 1155
1162 // Scroll the parent frame downward. 1156 // Scroll the parent frame downward.
1163 blink::WebMouseWheelEvent scroll_event( 1157 blink::WebMouseWheelEvent scroll_event(
1164 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, 1158 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 FrameTreeNode* child_node = root->child_at(0); 1276 FrameTreeNode* child_node = root->child_at(0);
1283 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); 1277 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html"));
1284 EXPECT_EQ(site_url, child_node->current_url()); 1278 EXPECT_EQ(site_url, child_node->current_url());
1285 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), 1279 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
1286 child_node->current_frame_host()->GetSiteInstance()); 1280 child_node->current_frame_host()->GetSiteInstance());
1287 1281
1288 RenderWidgetHostViewAura* rwhv_parent = 1282 RenderWidgetHostViewAura* rwhv_parent =
1289 static_cast<RenderWidgetHostViewAura*>( 1283 static_cast<RenderWidgetHostViewAura*>(
1290 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1284 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1291 1285
1292 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 1286 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
1293 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1294
1295 SurfaceHitTestReadyNotifier notifier(
1296 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1297 notifier.WaitForSurfaceReady();
1298 1287
1299 // Create listener for input events. 1288 // Create listener for input events.
1300 TestInputEventObserver child_frame_monitor( 1289 TestInputEventObserver child_frame_monitor(
1301 child_node->current_frame_host()->GetRenderWidgetHost()); 1290 child_node->current_frame_host()->GetRenderWidgetHost());
1302 1291
1303 // Send a ui::ScrollEvent that will hit test to the child frame. 1292 // Send a ui::ScrollEvent that will hit test to the child frame.
1304 ui::ScrollEvent scroll_event(ui::ET_SCROLL, gfx::Point(75, 75), 1293 ui::ScrollEvent scroll_event(ui::ET_SCROLL, gfx::Point(75, 75),
1305 ui::EventTimeForNow(), ui::EF_NONE, 1294 ui::EventTimeForNow(), ui::EF_NONE,
1306 0, 10, // Offsets 1295 0, 10, // Offsets
1307 0, 10, // Offset ordinals 1296 0, 10, // Offset ordinals
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 web_contents()->GetInputEventRouter(); 1376 web_contents()->GetInputEventRouter();
1388 1377
1389 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 1378 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
1390 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1379 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1391 RenderWidgetHostViewBase* rwhv_nested = 1380 RenderWidgetHostViewBase* rwhv_nested =
1392 static_cast<RenderWidgetHostViewBase*>( 1381 static_cast<RenderWidgetHostViewBase*>(
1393 nested_iframe_node->current_frame_host() 1382 nested_iframe_node->current_frame_host()
1394 ->GetRenderWidgetHost() 1383 ->GetRenderWidgetHost()
1395 ->GetView()); 1384 ->GetView());
1396 1385
1397 SurfaceHitTestReadyNotifier notifier( 1386 WaitForChildFrameSurfaceReady(nested_iframe_node->current_frame_host());
1398 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
1399 notifier.WaitForSurfaceReady();
1400 1387
1401 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell()); 1388 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell());
1402 1389
1403 // Get the view bounds of the nested iframe, which should account for the 1390 // 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 1391 // relative offset of its direct parent within the root frame, for use in
1405 // targeting the input event. 1392 // targeting the input event.
1406 gfx::Rect bounds = rwhv_nested->GetViewBounds(); 1393 gfx::Rect bounds = rwhv_nested->GetViewBounds();
1407 1394
1408 // Target input event to nested frame. 1395 // Target input event to nested frame.
1409 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown, 1396 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 RenderWidgetHostMouseEventMonitor main_frame_monitor( 1452 RenderWidgetHostMouseEventMonitor main_frame_monitor(
1466 root->current_frame_host()->GetRenderWidgetHost()); 1453 root->current_frame_host()->GetRenderWidgetHost());
1467 RenderWidgetHostMouseEventMonitor child_frame_monitor( 1454 RenderWidgetHostMouseEventMonitor child_frame_monitor(
1468 child_node->current_frame_host()->GetRenderWidgetHost()); 1455 child_node->current_frame_host()->GetRenderWidgetHost());
1469 1456
1470 RenderWidgetHostInputEventRouter* router = 1457 RenderWidgetHostInputEventRouter* router =
1471 web_contents()->GetInputEventRouter(); 1458 web_contents()->GetInputEventRouter();
1472 1459
1473 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 1460 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
1474 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1461 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1475 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
1476 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1477 1462
1478 SurfaceHitTestReadyNotifier notifier( 1463 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
1479 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1480 notifier.WaitForSurfaceReady();
1481 1464
1482 // Target input event to child frame. 1465 // Target input event to child frame.
1483 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 1466 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
1484 blink::WebInputEvent::NoModifiers, 1467 blink::WebInputEvent::NoModifiers,
1485 blink::WebInputEvent::TimeStampForTesting); 1468 blink::WebInputEvent::TimeStampForTesting);
1486 child_event.button = blink::WebPointerProperties::Button::Left; 1469 child_event.button = blink::WebPointerProperties::Button::Left;
1487 child_event.x = 75; 1470 child_event.x = 75;
1488 child_event.y = 75; 1471 child_event.y = 75;
1489 child_event.clickCount = 1; 1472 child_event.clickCount = 1;
1490 main_frame_monitor.ResetEventReceived(); 1473 main_frame_monitor.ResetEventReceived();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 1518
1536 RenderWidgetHostViewBase* rwhv_a = static_cast<RenderWidgetHostViewBase*>( 1519 RenderWidgetHostViewBase* rwhv_a = static_cast<RenderWidgetHostViewBase*>(
1537 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1520 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1538 RenderWidgetHostViewBase* rwhv_b = static_cast<RenderWidgetHostViewBase*>( 1521 RenderWidgetHostViewBase* rwhv_b = static_cast<RenderWidgetHostViewBase*>(
1539 b_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 1522 b_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1540 RenderWidgetHostViewBase* rwhv_d = static_cast<RenderWidgetHostViewBase*>( 1523 RenderWidgetHostViewBase* rwhv_d = static_cast<RenderWidgetHostViewBase*>(
1541 d_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 1524 d_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1542 1525
1543 // Verifying surfaces are ready in B and D are sufficient, since other 1526 // Verifying surfaces are ready in B and D are sufficient, since other
1544 // surfaces contain at least one of them. 1527 // surfaces contain at least one of them.
1545 SurfaceHitTestReadyNotifier notifier_b( 1528 WaitForChildFrameSurfaceReady(b_node->current_frame_host());
1546 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_b)); 1529 WaitForChildFrameSurfaceReady(d_node->current_frame_host());
1547 notifier_b.WaitForSurfaceReady();
1548 SurfaceHitTestReadyNotifier notifier_d(
1549 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_d));
1550 notifier_d.WaitForSurfaceReady();
1551 1530
1552 // Create listeners for mouse events. These are used to verify that the 1531 // Create listeners for mouse events. These are used to verify that the
1553 // RenderWidgetHostInputEventRouter is generating MouseLeave, etc for 1532 // RenderWidgetHostInputEventRouter is generating MouseLeave, etc for
1554 // the right renderers. 1533 // the right renderers.
1555 RenderWidgetHostMouseEventMonitor root_frame_monitor( 1534 RenderWidgetHostMouseEventMonitor root_frame_monitor(
1556 root->current_frame_host()->GetRenderWidgetHost()); 1535 root->current_frame_host()->GetRenderWidgetHost());
1557 RenderWidgetHostMouseEventMonitor a_frame_monitor( 1536 RenderWidgetHostMouseEventMonitor a_frame_monitor(
1558 root->current_frame_host()->GetRenderWidgetHost()); 1537 root->current_frame_host()->GetRenderWidgetHost());
1559 RenderWidgetHostMouseEventMonitor b_frame_monitor( 1538 RenderWidgetHostMouseEventMonitor b_frame_monitor(
1560 b_node->current_frame_host()->GetRenderWidgetHost()); 1539 b_node->current_frame_host()->GetRenderWidgetHost());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 child_node->current_frame_host()->GetRenderWidgetHost()); 1637 child_node->current_frame_host()->GetRenderWidgetHost());
1659 1638
1660 RenderWidgetHostInputEventRouter* router = 1639 RenderWidgetHostInputEventRouter* router =
1661 web_contents()->GetInputEventRouter(); 1640 web_contents()->GetInputEventRouter();
1662 1641
1663 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 1642 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
1664 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1643 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1665 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 1644 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
1666 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 1645 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1667 1646
1668 SurfaceHitTestReadyNotifier notifier( 1647 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
1669 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1670 notifier.WaitForSurfaceReady();
1671 1648
1672 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell()); 1649 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell());
1673 1650
1674 // Get the view bounds of the child iframe, which should account for the 1651 // Get the view bounds of the child iframe, which should account for the
1675 // relative offset of its direct parent within the root frame, for use in 1652 // relative offset of its direct parent within the root frame, for use in
1676 // targeting the input event. 1653 // targeting the input event.
1677 gfx::Rect bounds = rwhv_child->GetViewBounds(); 1654 gfx::Rect bounds = rwhv_child->GetViewBounds();
1678 int child_frame_target_x = 1655 int child_frame_target_x =
1679 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) / 1656 gfx::ToCeiledInt((bounds.x() - root_view->GetViewBounds().x()) /
1680 scale_factor) + 1657 scale_factor) +
(...skipping 3910 matching lines...) Expand 10 before | Expand all | Expand 10 after
5591 ASSERT_EQ(1U, root->child_count()); 5568 ASSERT_EQ(1U, root->child_count());
5592 5569
5593 GURL frame_url(embedded_test_server()->GetURL( 5570 GURL frame_url(embedded_test_server()->GetURL(
5594 "b.com", "/page_with_scrollable_div.html")); 5571 "b.com", "/page_with_scrollable_div.html"));
5595 NavigateFrameToURL(root->child_at(0), frame_url); 5572 NavigateFrameToURL(root->child_at(0), frame_url);
5596 5573
5597 // Synchronize with the child and parent renderers to guarantee that the 5574 // Synchronize with the child and parent renderers to guarantee that the
5598 // surface information required for event hit testing is ready. 5575 // surface information required for event hit testing is ready.
5599 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( 5576 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>(
5600 root->child_at(0)->current_frame_host()->GetView()); 5577 root->child_at(0)->current_frame_host()->GetView());
5601 SurfaceHitTestReadyNotifier notifier( 5578 WaitForChildFrameSurfaceReady(root->child_at(0)->current_frame_host());
5602 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
5603 notifier.WaitForSurfaceReady();
5604 5579
5605 content::RenderFrameHostImpl* child = root->child_at(0)->current_frame_host(); 5580 content::RenderFrameHostImpl* child = root->child_at(0)->current_frame_host();
5606 SetupWheelAndScrollHandlers(child); 5581 SetupWheelAndScrollHandlers(child);
5607 5582
5608 gfx::Rect bounds = child_rwhv->GetViewBounds(); 5583 gfx::Rect bounds = child_rwhv->GetViewBounds();
5609 gfx::Point pos(bounds.x() + 10, bounds.y() + 10); 5584 gfx::Point pos(bounds.x() + 10, bounds.y() + 10);
5610 5585
5611 RunTest(pos); 5586 RunTest(pos);
5612 } 5587 }
5613 5588
(...skipping 25 matching lines...) Expand all
5639 WebContentsImpl* contents = web_contents(); 5614 WebContentsImpl* contents = web_contents();
5640 FrameTreeNode* root = contents->GetFrameTree()->root(); 5615 FrameTreeNode* root = contents->GetFrameTree()->root();
5641 ASSERT_EQ(1U, root->child_count()); 5616 ASSERT_EQ(1U, root->child_count());
5642 5617
5643 GURL frame_url( 5618 GURL frame_url(
5644 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html")); 5619 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html"));
5645 NavigateFrameToURL(root->child_at(0), frame_url); 5620 NavigateFrameToURL(root->child_at(0), frame_url);
5646 5621
5647 // Synchronize with the child and parent renderers to guarantee that the 5622 // Synchronize with the child and parent renderers to guarantee that the
5648 // surface information required for event hit testing is ready. 5623 // surface information required for event hit testing is ready.
5649 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( 5624 WaitForChildFrameSurfaceReady(root->child_at(0)->current_frame_host());
5650 root->child_at(0)->current_frame_host()->GetView());
5651 SurfaceHitTestReadyNotifier notifier(
5652 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
5653 notifier.WaitForSurfaceReady();
5654 5625
5655 // There's no intrinsic reason the following values can't be equal, but they 5626 // There's no intrinsic reason the following values can't be equal, but they
5656 // aren't at present, and if they become the same this test will need to be 5627 // aren't at present, and if they become the same this test will need to be
5657 // updated to accommodate. 5628 // updated to accommodate.
5658 EXPECT_NE(TOUCH_ACTION_AUTO, TOUCH_ACTION_NONE); 5629 EXPECT_NE(TOUCH_ACTION_AUTO, TOUCH_ACTION_NONE);
5659 5630
5660 // Verify the child's input router is initially set for TOUCH_ACTION_AUTO. The 5631 // Verify the child's input router is initially set for TOUCH_ACTION_AUTO. The
5661 // TouchStart event will trigger TOUCH_ACTION_NONE being sent back to the 5632 // TouchStart event will trigger TOUCH_ACTION_NONE being sent back to the
5662 // browser. 5633 // browser.
5663 RenderWidgetHostImpl* child_render_widget_host = 5634 RenderWidgetHostImpl* child_render_widget_host =
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
5803 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); 5774 FrameTreeNode* root = web_contents()->GetFrameTree()->root();
5804 ASSERT_EQ(1U, root->child_count()); 5775 ASSERT_EQ(1U, root->child_count());
5805 5776
5806 GURL frame_url( 5777 GURL frame_url(
5807 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 5778 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
5808 NavigateFrameToURL(root->child_at(0), frame_url); 5779 NavigateFrameToURL(root->child_at(0), frame_url);
5809 auto* child_frame_host = root->child_at(0)->current_frame_host(); 5780 auto* child_frame_host = root->child_at(0)->current_frame_host();
5810 5781
5811 // Synchronize with the child and parent renderers to guarantee that the 5782 // Synchronize with the child and parent renderers to guarantee that the
5812 // surface information required for event hit testing is ready. 5783 // surface information required for event hit testing is ready.
5813 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( 5784 WaitForChildFrameSurfaceReady(child_frame_host);
5814 child_frame_host->GetView());
5815 SurfaceHitTestReadyNotifier notifier(
5816 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
5817 notifier.WaitForSurfaceReady();
5818 5785
5819 // There have been no GestureTaps sent yet. 5786 // There have been no GestureTaps sent yet.
5820 { 5787 {
5821 std::string result; 5788 std::string result;
5822 EXPECT_TRUE(ExecuteScriptAndExtractString( 5789 EXPECT_TRUE(ExecuteScriptAndExtractString(
5823 child_frame_host, 5790 child_frame_host,
5824 "window.domAutomationController.send(getClickStatus());", &result)); 5791 "window.domAutomationController.send(getClickStatus());", &result));
5825 EXPECT_EQ("0 clicks received", result); 5792 EXPECT_EQ("0 clicks received", result);
5826 } 5793 }
5827 5794
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
6006 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 5973 EXPECT_TRUE(NavigateToURL(shell(), main_url));
6007 5974
6008 WebContentsImpl* contents = web_contents(); 5975 WebContentsImpl* contents = web_contents();
6009 FrameTreeNode* root = contents->GetFrameTree()->root(); 5976 FrameTreeNode* root = contents->GetFrameTree()->root();
6010 ASSERT_EQ(1U, root->child_count()); 5977 ASSERT_EQ(1U, root->child_count());
6011 5978
6012 GURL frame_url( 5979 GURL frame_url(
6013 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 5980 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
6014 NavigateFrameToURL(root->child_at(0), frame_url); 5981 NavigateFrameToURL(root->child_at(0), frame_url);
6015 auto* child_frame_host = root->child_at(0)->current_frame_host(); 5982 auto* child_frame_host = root->child_at(0)->current_frame_host();
5983 auto* rwhv_child =
5984 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView());
6016 5985
6017 // Synchronize with the child and parent renderers to guarantee that the 5986 // Synchronize with the child and parent renderers to guarantee that the
6018 // surface information required for event hit testing is ready. 5987 // surface information required for event hit testing is ready.
6019 auto* rwhv_child = 5988 WaitForChildFrameSurfaceReady(child_frame_host);
6020 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView());
6021 SurfaceHitTestReadyNotifier notifier(
6022 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
6023 notifier.WaitForSurfaceReady();
6024 5989
6025 // All touches & gestures are sent to the main frame's view, and should be 5990 // All touches & gestures are sent to the main frame's view, and should be
6026 // routed appropriately from there. 5991 // routed appropriately from there.
6027 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>( 5992 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>(
6028 contents->GetRenderWidgetHostView()); 5993 contents->GetRenderWidgetHostView());
6029 5994
6030 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); 5995 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter();
6031 EXPECT_TRUE(router->touchscreen_gesture_target_queue_.empty()); 5996 EXPECT_TRUE(router->touchscreen_gesture_target_queue_.empty());
6032 EXPECT_EQ(nullptr, router->touchscreen_gesture_target_.target); 5997 EXPECT_EQ(nullptr, router->touchscreen_gesture_target_.target);
6033 5998
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6093 6058
6094 GURL frame_url( 6059 GURL frame_url(
6095 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 6060 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
6096 NavigateFrameToURL(root->child_at(0), frame_url); 6061 NavigateFrameToURL(root->child_at(0), frame_url);
6097 auto* child_frame_host = root->child_at(0)->current_frame_host(); 6062 auto* child_frame_host = root->child_at(0)->current_frame_host();
6098 6063
6099 // Synchronize with the child and parent renderers to guarantee that the 6064 // Synchronize with the child and parent renderers to guarantee that the
6100 // surface information required for event hit testing is ready. 6065 // surface information required for event hit testing is ready.
6101 auto* rwhv_child = 6066 auto* rwhv_child =
6102 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); 6067 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView());
6103 SurfaceHitTestReadyNotifier notifier( 6068 WaitForChildFrameSurfaceReady(child_frame_host);
6104 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
6105 notifier.WaitForSurfaceReady();
6106 6069
6107 // All touches & gestures are sent to the main frame's view, and should be 6070 // All touches & gestures are sent to the main frame's view, and should be
6108 // routed appropriately from there. 6071 // routed appropriately from there.
6109 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>( 6072 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>(
6110 contents->GetRenderWidgetHostView()); 6073 contents->GetRenderWidgetHostView());
6111 6074
6112 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); 6075 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter();
6113 EXPECT_EQ(nullptr, router->touchpad_gesture_target_.target); 6076 EXPECT_EQ(nullptr, router->touchpad_gesture_target_.target);
6114 6077
6115 gfx::Point main_frame_point(25, 25); 6078 gfx::Point main_frame_point(25, 25);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
6207 child_node->current_frame_host()->GetSiteInstance()); 6170 child_node->current_frame_host()->GetSiteInstance());
6208 6171
6209 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 6172 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
6210 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 6173 root->current_frame_host()->GetRenderWidgetHost()->GetView());
6211 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 6174 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
6212 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 6175 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
6213 6176
6214 // Ensure that the child process renderer is ready to have input events 6177 // Ensure that the child process renderer is ready to have input events
6215 // routed to it. This happens when the browser process has received 6178 // routed to it. This happens when the browser process has received
6216 // updated compositor surfaces from both renderer processes. 6179 // updated compositor surfaces from both renderer processes.
6217 SurfaceHitTestReadyNotifier notifier( 6180 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
6218 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
6219 notifier.WaitForSurfaceReady();
6220 6181
6221 // A WebContentsDelegate to listen for the ShowContextMenu message. 6182 // A WebContentsDelegate to listen for the ShowContextMenu message.
6222 ContextMenuObserverDelegate context_menu_delegate; 6183 ContextMenuObserverDelegate context_menu_delegate;
6223 shell->web_contents()->SetDelegate(&context_menu_delegate); 6184 shell->web_contents()->SetDelegate(&context_menu_delegate);
6224 6185
6225 RenderWidgetHostInputEventRouter* router = 6186 RenderWidgetHostInputEventRouter* router =
6226 static_cast<WebContentsImpl*>(shell->web_contents()) 6187 static_cast<WebContentsImpl*>(shell->web_contents())
6227 ->GetInputEventRouter(); 6188 ->GetInputEventRouter();
6228 6189
6229 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell); 6190 float scale_factor = GetAdjustmentScaleFactorForAndroid(shell);
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after
8486 ->GetFrameTree() 8447 ->GetFrameTree()
8487 ->root(); 8448 ->root();
8488 FrameTreeNode* child_node = root_node->child_at(0); 8449 FrameTreeNode* child_node = root_node->child_at(0);
8489 8450
8490 rwhv_child_ = static_cast<RenderWidgetHostViewBase*>( 8451 rwhv_child_ = static_cast<RenderWidgetHostViewBase*>(
8491 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 8452 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
8492 8453
8493 rwhva_root_ = static_cast<RenderWidgetHostViewAura*>( 8454 rwhva_root_ = static_cast<RenderWidgetHostViewAura*>(
8494 shell()->web_contents()->GetRenderWidgetHostView()); 8455 shell()->web_contents()->GetRenderWidgetHostView());
8495 8456
8496 SurfaceHitTestReadyNotifier notifier( 8457 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
8497 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child_));
8498 notifier.WaitForSurfaceReady();
8499 8458
8500 rwhi_child_ = child_node->current_frame_host()->GetRenderWidgetHost(); 8459 rwhi_child_ = child_node->current_frame_host()->GetRenderWidgetHost();
8501 rwhi_root_ = root_node->current_frame_host()->GetRenderWidgetHost(); 8460 rwhi_root_ = root_node->current_frame_host()->GetRenderWidgetHost();
8502 } 8461 }
8503 8462
8504 protected: 8463 protected:
8505 RenderWidgetHostViewBase* rwhv_child_; 8464 RenderWidgetHostViewBase* rwhv_child_;
8506 RenderWidgetHostViewAura* rwhva_root_; 8465 RenderWidgetHostViewAura* rwhva_root_;
8507 RenderWidgetHostImpl* rwhi_child_; 8466 RenderWidgetHostImpl* rwhi_child_;
8508 RenderWidgetHostImpl* rwhi_root_; 8467 RenderWidgetHostImpl* rwhi_root_;
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
9995 names.insert(root->children[0]->frame_entry->frame_unique_name()); 9954 names.insert(root->children[0]->frame_entry->frame_unique_name());
9996 } 9955 }
9997 9956
9998 // More than one entry in the set means that the subframe frame navigation 9957 // 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 9958 // entries didn't have a consistent unique name. This will break history
10000 // navigations =( 9959 // navigations =(
10001 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!"; 9960 EXPECT_THAT(names, SizeIs(1)) << "Mismatched names for subframe!";
10002 } 9961 }
10003 9962
10004 } // namespace content 9963 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/touch_accessibility_aura_browsertest.cc ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698