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

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

Issue 2686683004: ABANDONED CL: WaitForChildFrameSurfaceReady to avoid flaky test hangs. (Closed)
Patch Set: Created 3 years, 10 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 root->current_frame_host()->GetRenderWidgetHost()); 250 root->current_frame_host()->GetRenderWidgetHost());
251 RenderWidgetHostMouseEventMonitor child_frame_monitor( 251 RenderWidgetHostMouseEventMonitor child_frame_monitor(
252 child_node->current_frame_host()->GetRenderWidgetHost()); 252 child_node->current_frame_host()->GetRenderWidgetHost());
253 253
254 RenderWidgetHostInputEventRouter* router = 254 RenderWidgetHostInputEventRouter* router =
255 static_cast<WebContentsImpl*>(shell->web_contents()) 255 static_cast<WebContentsImpl*>(shell->web_contents())
256 ->GetInputEventRouter(); 256 ->GetInputEventRouter();
257 257
258 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 258 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
259 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 259 root->current_frame_host()->GetRenderWidgetHost()->GetView());
260 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 260 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
261 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
262
263 SurfaceHitTestReadyNotifier notifier(
264 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
265 notifier.WaitForSurfaceReady();
266 261
267 // Target input event to child frame. 262 // Target input event to child frame.
268 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 263 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
269 blink::WebInputEvent::NoModifiers, 264 blink::WebInputEvent::NoModifiers,
270 blink::WebInputEvent::TimeStampForTesting); 265 blink::WebInputEvent::TimeStampForTesting);
271 child_event.button = blink::WebPointerProperties::Button::Left; 266 child_event.button = blink::WebPointerProperties::Button::Left;
272 child_event.x = 75; 267 child_event.x = 75;
273 child_event.y = 75; 268 child_event.y = 75;
274 child_event.clickCount = 1; 269 child_event.clickCount = 1;
275 main_frame_monitor.ResetEventReceived(); 270 main_frame_monitor.ResetEventReceived();
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 " B = http://baz.com/", 984 " B = http://baz.com/",
990 DepictFrameTree(root)); 985 DepictFrameTree(root));
991 986
992 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0); 987 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0);
993 RenderWidgetHostViewBase* rwhv_nested = 988 RenderWidgetHostViewBase* rwhv_nested =
994 static_cast<RenderWidgetHostViewBase*>( 989 static_cast<RenderWidgetHostViewBase*>(
995 nested_iframe_node->current_frame_host() 990 nested_iframe_node->current_frame_host()
996 ->GetRenderWidgetHost() 991 ->GetRenderWidgetHost()
997 ->GetView()); 992 ->GetView());
998 993
999 SurfaceHitTestReadyNotifier notifier( 994 WaitForChildFrameSurfaceReady(nested_iframe_node->current_frame_host());
1000 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
1001 notifier.WaitForSurfaceReady();
1002 995
1003 // Verify the view bounds of the nested iframe, which should account for the 996 // Verify the view bounds of the nested iframe, which should account for the
1004 // relative offset of its direct parent within the root frame. 997 // relative offset of its direct parent within the root frame.
1005 gfx::Rect bounds = rwhv_nested->GetViewBounds(); 998 gfx::Rect bounds = rwhv_nested->GetViewBounds();
1006 EXPECT_EQ(bounds.x() - rwhv_root->GetViewBounds().x(), 397); 999 EXPECT_EQ(bounds.x() - rwhv_root->GetViewBounds().x(), 397);
1007 EXPECT_EQ(bounds.y() - rwhv_root->GetViewBounds().y(), 112); 1000 EXPECT_EQ(bounds.y() - rwhv_root->GetViewBounds().y(), 112);
1008 1001
1009 scoped_refptr<FrameRectChangedMessageFilter> filter = 1002 scoped_refptr<FrameRectChangedMessageFilter> filter =
1010 new FrameRectChangedMessageFilter(); 1003 new FrameRectChangedMessageFilter();
1011 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); 1004 root->current_frame_host()->GetProcess()->AddFilter(filter.get());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 parent_iframe_node->current_frame_host() 1075 parent_iframe_node->current_frame_host()
1083 ->GetRenderWidgetHost() 1076 ->GetRenderWidgetHost()
1084 ->GetView()); 1077 ->GetView());
1085 1078
1086 RenderWidgetHostViewBase* rwhv_nested = 1079 RenderWidgetHostViewBase* rwhv_nested =
1087 static_cast<RenderWidgetHostViewBase*>( 1080 static_cast<RenderWidgetHostViewBase*>(
1088 nested_iframe_node->current_frame_host() 1081 nested_iframe_node->current_frame_host()
1089 ->GetRenderWidgetHost() 1082 ->GetRenderWidgetHost()
1090 ->GetView()); 1083 ->GetView());
1091 1084
1092 SurfaceHitTestReadyNotifier notifier( 1085 WaitForChildFrameSurfaceReady(nested_iframe_node->current_frame_host());
1093 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
1094 notifier.WaitForSurfaceReady();
1095 1086
1096 // Save the original offset as a point of reference. 1087 // Save the original offset as a point of reference.
1097 filter->Wait(); 1088 filter->Wait();
1098 gfx::Rect update_rect = filter->last_rect(); 1089 gfx::Rect update_rect = filter->last_rect();
1099 int initial_y = update_rect.y(); 1090 int initial_y = update_rect.y();
1100 filter->Reset(); 1091 filter->Reset();
1101 1092
1102 // Scroll the parent frame downward. 1093 // Scroll the parent frame downward.
1103 blink::WebMouseWheelEvent scroll_event( 1094 blink::WebMouseWheelEvent scroll_event(
1104 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers, 1095 blink::WebInputEvent::MouseWheel, blink::WebInputEvent::NoModifiers,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 FrameTreeNode* child_node = root->child_at(0); 1213 FrameTreeNode* child_node = root->child_at(0);
1223 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); 1214 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html"));
1224 EXPECT_EQ(site_url, child_node->current_url()); 1215 EXPECT_EQ(site_url, child_node->current_url());
1225 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), 1216 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
1226 child_node->current_frame_host()->GetSiteInstance()); 1217 child_node->current_frame_host()->GetSiteInstance());
1227 1218
1228 RenderWidgetHostViewAura* rwhv_parent = 1219 RenderWidgetHostViewAura* rwhv_parent =
1229 static_cast<RenderWidgetHostViewAura*>( 1220 static_cast<RenderWidgetHostViewAura*>(
1230 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1221 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1231 1222
1232 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 1223 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
1233 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1234
1235 SurfaceHitTestReadyNotifier notifier(
1236 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1237 notifier.WaitForSurfaceReady();
1238 1224
1239 // Create listener for input events. 1225 // Create listener for input events.
1240 TestInputEventObserver child_frame_monitor( 1226 TestInputEventObserver child_frame_monitor(
1241 child_node->current_frame_host()->GetRenderWidgetHost()); 1227 child_node->current_frame_host()->GetRenderWidgetHost());
1242 1228
1243 // Send a ui::ScrollEvent that will hit test to the child frame. 1229 // Send a ui::ScrollEvent that will hit test to the child frame.
1244 ui::ScrollEvent scroll_event(ui::ET_SCROLL, gfx::Point(75, 75), 1230 ui::ScrollEvent scroll_event(ui::ET_SCROLL, gfx::Point(75, 75),
1245 ui::EventTimeForNow(), ui::EF_NONE, 1231 ui::EventTimeForNow(), ui::EF_NONE,
1246 0, 10, // Offsets 1232 0, 10, // Offsets
1247 0, 10, // Offset ordinals 1233 0, 10, // Offset ordinals
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 RenderWidgetHostMouseEventMonitor main_frame_monitor( 1307 RenderWidgetHostMouseEventMonitor main_frame_monitor(
1322 root->current_frame_host()->GetRenderWidgetHost()); 1308 root->current_frame_host()->GetRenderWidgetHost());
1323 RenderWidgetHostMouseEventMonitor nested_frame_monitor( 1309 RenderWidgetHostMouseEventMonitor nested_frame_monitor(
1324 nested_iframe_node->current_frame_host()->GetRenderWidgetHost()); 1310 nested_iframe_node->current_frame_host()->GetRenderWidgetHost());
1325 1311
1326 RenderWidgetHostInputEventRouter* router = 1312 RenderWidgetHostInputEventRouter* router =
1327 web_contents()->GetInputEventRouter(); 1313 web_contents()->GetInputEventRouter();
1328 1314
1329 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 1315 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
1330 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1316 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1331 RenderWidgetHostViewBase* rwhv_nested =
1332 static_cast<RenderWidgetHostViewBase*>(
1333 nested_iframe_node->current_frame_host()
1334 ->GetRenderWidgetHost()
1335 ->GetView());
1336 1317
1337 SurfaceHitTestReadyNotifier notifier( 1318 WaitForChildFrameSurfaceReady(nested_iframe_node->current_frame_host());
1338 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
1339 notifier.WaitForSurfaceReady();
1340 1319
1341 // Target input event to nested frame. 1320 // Target input event to nested frame.
1342 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown, 1321 blink::WebMouseEvent nested_event(blink::WebInputEvent::MouseDown,
1343 blink::WebInputEvent::NoModifiers, 1322 blink::WebInputEvent::NoModifiers,
1344 blink::WebInputEvent::TimeStampForTesting); 1323 blink::WebInputEvent::TimeStampForTesting);
1345 nested_event.button = blink::WebPointerProperties::Button::Left; 1324 nested_event.button = blink::WebPointerProperties::Button::Left;
1346 nested_event.x = 125; 1325 nested_event.x = 125;
1347 nested_event.y = 125; 1326 nested_event.y = 125;
1348 nested_event.clickCount = 1; 1327 nested_event.clickCount = 1;
1349 nested_frame_monitor.ResetEventReceived(); 1328 nested_frame_monitor.ResetEventReceived();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 RenderWidgetHostMouseEventMonitor main_frame_monitor( 1365 RenderWidgetHostMouseEventMonitor main_frame_monitor(
1387 root->current_frame_host()->GetRenderWidgetHost()); 1366 root->current_frame_host()->GetRenderWidgetHost());
1388 RenderWidgetHostMouseEventMonitor child_frame_monitor( 1367 RenderWidgetHostMouseEventMonitor child_frame_monitor(
1389 child_node->current_frame_host()->GetRenderWidgetHost()); 1368 child_node->current_frame_host()->GetRenderWidgetHost());
1390 1369
1391 RenderWidgetHostInputEventRouter* router = 1370 RenderWidgetHostInputEventRouter* router =
1392 web_contents()->GetInputEventRouter(); 1371 web_contents()->GetInputEventRouter();
1393 1372
1394 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 1373 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
1395 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1374 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1396 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
1397 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1398 1375
1399 SurfaceHitTestReadyNotifier notifier( 1376 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
1400 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1401 notifier.WaitForSurfaceReady();
1402 1377
1403 // Target input event to child frame. 1378 // Target input event to child frame.
1404 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown, 1379 blink::WebMouseEvent child_event(blink::WebInputEvent::MouseDown,
1405 blink::WebInputEvent::NoModifiers, 1380 blink::WebInputEvent::NoModifiers,
1406 blink::WebInputEvent::TimeStampForTesting); 1381 blink::WebInputEvent::TimeStampForTesting);
1407 child_event.button = blink::WebPointerProperties::Button::Left; 1382 child_event.button = blink::WebPointerProperties::Button::Left;
1408 child_event.x = 75; 1383 child_event.x = 75;
1409 child_event.y = 75; 1384 child_event.y = 75;
1410 child_event.clickCount = 1; 1385 child_event.clickCount = 1;
1411 main_frame_monitor.ResetEventReceived(); 1386 main_frame_monitor.ResetEventReceived();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 " C = http://c.com/\n" 1424 " C = http://c.com/\n"
1450 " D = http://d.com/", 1425 " D = http://d.com/",
1451 DepictFrameTree(root)); 1426 DepictFrameTree(root));
1452 1427
1453 FrameTreeNode* b_node = root->child_at(0); 1428 FrameTreeNode* b_node = root->child_at(0);
1454 FrameTreeNode* c_node = root->child_at(1); 1429 FrameTreeNode* c_node = root->child_at(1);
1455 FrameTreeNode* d_node = c_node->child_at(0); 1430 FrameTreeNode* d_node = c_node->child_at(0);
1456 1431
1457 RenderWidgetHostViewBase* rwhv_a = static_cast<RenderWidgetHostViewBase*>( 1432 RenderWidgetHostViewBase* rwhv_a = static_cast<RenderWidgetHostViewBase*>(
1458 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1433 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1459 RenderWidgetHostViewBase* rwhv_b = static_cast<RenderWidgetHostViewBase*>(
1460 b_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1461 RenderWidgetHostViewBase* rwhv_d = static_cast<RenderWidgetHostViewBase*>(
1462 d_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1463 1434
1464 // Verifying surfaces are ready in B and D are sufficient, since other 1435 // Verifying surfaces are ready in B and D are sufficient, since other
1465 // surfaces contain at least one of them. 1436 // surfaces contain at least one of them.
1466 SurfaceHitTestReadyNotifier notifier_b( 1437 WaitForChildFrameSurfaceReady(b_node->current_frame_host());
1467 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_b)); 1438 WaitForChildFrameSurfaceReady(d_node->current_frame_host());
1468 notifier_b.WaitForSurfaceReady();
1469 SurfaceHitTestReadyNotifier notifier_d(
1470 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_d));
1471 notifier_d.WaitForSurfaceReady();
1472 1439
1473 // Create listeners for mouse events. These are used to verify that the 1440 // Create listeners for mouse events. These are used to verify that the
1474 // RenderWidgetHostInputEventRouter is generating MouseLeave, etc for 1441 // RenderWidgetHostInputEventRouter is generating MouseLeave, etc for
1475 // the right renderers. 1442 // the right renderers.
1476 RenderWidgetHostMouseEventMonitor root_frame_monitor( 1443 RenderWidgetHostMouseEventMonitor root_frame_monitor(
1477 root->current_frame_host()->GetRenderWidgetHost()); 1444 root->current_frame_host()->GetRenderWidgetHost());
1478 RenderWidgetHostMouseEventMonitor a_frame_monitor( 1445 RenderWidgetHostMouseEventMonitor a_frame_monitor(
1479 root->current_frame_host()->GetRenderWidgetHost()); 1446 root->current_frame_host()->GetRenderWidgetHost());
1480 RenderWidgetHostMouseEventMonitor b_frame_monitor( 1447 RenderWidgetHostMouseEventMonitor b_frame_monitor(
1481 b_node->current_frame_host()->GetRenderWidgetHost()); 1448 b_node->current_frame_host()->GetRenderWidgetHost());
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 RenderWidgetHostMouseEventMonitor main_frame_monitor( 1530 RenderWidgetHostMouseEventMonitor main_frame_monitor(
1564 root->current_frame_host()->GetRenderWidgetHost()); 1531 root->current_frame_host()->GetRenderWidgetHost());
1565 RenderWidgetHostMouseEventMonitor child_frame_monitor( 1532 RenderWidgetHostMouseEventMonitor child_frame_monitor(
1566 child_node->current_frame_host()->GetRenderWidgetHost()); 1533 child_node->current_frame_host()->GetRenderWidgetHost());
1567 1534
1568 RenderWidgetHostInputEventRouter* router = 1535 RenderWidgetHostInputEventRouter* router =
1569 web_contents()->GetInputEventRouter(); 1536 web_contents()->GetInputEventRouter();
1570 1537
1571 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 1538 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
1572 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 1539 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1573 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
1574 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1575 1540
1576 SurfaceHitTestReadyNotifier notifier( 1541 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
1577 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1578 notifier.WaitForSurfaceReady();
1579 1542
1580 // Target MouseDown to child frame. 1543 // Target MouseDown to child frame.
1581 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, 1544 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown,
1582 blink::WebInputEvent::NoModifiers, 1545 blink::WebInputEvent::NoModifiers,
1583 blink::WebInputEvent::TimeStampForTesting); 1546 blink::WebInputEvent::TimeStampForTesting);
1584 mouse_event.button = blink::WebPointerProperties::Button::Left; 1547 mouse_event.button = blink::WebPointerProperties::Button::Left;
1585 mouse_event.x = 75; 1548 mouse_event.x = 75;
1586 mouse_event.y = 75; 1549 mouse_event.y = 75;
1587 mouse_event.clickCount = 1; 1550 mouse_event.clickCount = 1;
1588 main_frame_monitor.ResetEventReceived(); 1551 main_frame_monitor.ResetEventReceived();
(...skipping 3795 matching lines...) Expand 10 before | Expand all | Expand 10 after
5384 WebContentsImpl* contents = web_contents(); 5347 WebContentsImpl* contents = web_contents();
5385 FrameTreeNode* root = contents->GetFrameTree()->root(); 5348 FrameTreeNode* root = contents->GetFrameTree()->root();
5386 ASSERT_EQ(1U, root->child_count()); 5349 ASSERT_EQ(1U, root->child_count());
5387 5350
5388 GURL frame_url( 5351 GURL frame_url(
5389 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html")); 5352 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html"));
5390 NavigateFrameToURL(root->child_at(0), frame_url); 5353 NavigateFrameToURL(root->child_at(0), frame_url);
5391 5354
5392 // Synchronize with the child and parent renderers to guarantee that the 5355 // Synchronize with the child and parent renderers to guarantee that the
5393 // surface information required for event hit testing is ready. 5356 // surface information required for event hit testing is ready.
5394 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( 5357 WaitForChildFrameSurfaceReady(root->child_at(0)->current_frame_host());
5395 root->child_at(0)->current_frame_host()->GetView());
5396 SurfaceHitTestReadyNotifier notifier(
5397 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
5398 notifier.WaitForSurfaceReady();
5399 5358
5400 // There's no intrinsic reason the following values can't be equal, but they 5359 // There's no intrinsic reason the following values can't be equal, but they
5401 // aren't at present, and if they become the same this test will need to be 5360 // aren't at present, and if they become the same this test will need to be
5402 // updated to accommodate. 5361 // updated to accommodate.
5403 EXPECT_NE(TOUCH_ACTION_AUTO, TOUCH_ACTION_NONE); 5362 EXPECT_NE(TOUCH_ACTION_AUTO, TOUCH_ACTION_NONE);
5404 5363
5405 // Verify the child's input router is initially set for TOUCH_ACTION_AUTO. The 5364 // Verify the child's input router is initially set for TOUCH_ACTION_AUTO. The
5406 // TouchStart event will trigger TOUCH_ACTION_NONE being sent back to the 5365 // TouchStart event will trigger TOUCH_ACTION_NONE being sent back to the
5407 // browser. 5366 // browser.
5408 RenderWidgetHostImpl* child_render_widget_host = 5367 RenderWidgetHostImpl* child_render_widget_host =
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
5538 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); 5497 FrameTreeNode* root = web_contents()->GetFrameTree()->root();
5539 ASSERT_EQ(1U, root->child_count()); 5498 ASSERT_EQ(1U, root->child_count());
5540 5499
5541 GURL frame_url( 5500 GURL frame_url(
5542 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 5501 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
5543 NavigateFrameToURL(root->child_at(0), frame_url); 5502 NavigateFrameToURL(root->child_at(0), frame_url);
5544 auto* child_frame_host = root->child_at(0)->current_frame_host(); 5503 auto* child_frame_host = root->child_at(0)->current_frame_host();
5545 5504
5546 // Synchronize with the child and parent renderers to guarantee that the 5505 // Synchronize with the child and parent renderers to guarantee that the
5547 // surface information required for event hit testing is ready. 5506 // surface information required for event hit testing is ready.
5548 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( 5507 WaitForChildFrameSurfaceReady(child_frame_host);
5549 child_frame_host->GetView());
5550 SurfaceHitTestReadyNotifier notifier(
5551 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
5552 notifier.WaitForSurfaceReady();
5553 5508
5554 // There have been no GestureTaps sent yet. 5509 // There have been no GestureTaps sent yet.
5555 { 5510 {
5556 std::string result; 5511 std::string result;
5557 EXPECT_TRUE(ExecuteScriptAndExtractString( 5512 EXPECT_TRUE(ExecuteScriptAndExtractString(
5558 child_frame_host, 5513 child_frame_host,
5559 "window.domAutomationController.send(getClickStatus());", &result)); 5514 "window.domAutomationController.send(getClickStatus());", &result));
5560 EXPECT_EQ("0 clicks received", result); 5515 EXPECT_EQ("0 clicks received", result);
5561 } 5516 }
5562 5517
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
5738 5693
5739 GURL frame_url( 5694 GURL frame_url(
5740 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 5695 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
5741 NavigateFrameToURL(root->child_at(0), frame_url); 5696 NavigateFrameToURL(root->child_at(0), frame_url);
5742 auto* child_frame_host = root->child_at(0)->current_frame_host(); 5697 auto* child_frame_host = root->child_at(0)->current_frame_host();
5743 5698
5744 // Synchronize with the child and parent renderers to guarantee that the 5699 // Synchronize with the child and parent renderers to guarantee that the
5745 // surface information required for event hit testing is ready. 5700 // surface information required for event hit testing is ready.
5746 auto* rwhv_child = 5701 auto* rwhv_child =
5747 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); 5702 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView());
5748 SurfaceHitTestReadyNotifier notifier( 5703 WaitForChildFrameSurfaceReady(child_frame_host);
5749 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
5750 notifier.WaitForSurfaceReady();
5751 5704
5752 // All touches & gestures are sent to the main frame's view, and should be 5705 // All touches & gestures are sent to the main frame's view, and should be
5753 // routed appropriately from there. 5706 // routed appropriately from there.
5754 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>( 5707 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>(
5755 contents->GetRenderWidgetHostView()); 5708 contents->GetRenderWidgetHostView());
5756 5709
5757 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); 5710 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter();
5758 EXPECT_TRUE(router->touchscreen_gesture_target_queue_.empty()); 5711 EXPECT_TRUE(router->touchscreen_gesture_target_queue_.empty());
5759 EXPECT_EQ(nullptr, router->touchscreen_gesture_target_.target); 5712 EXPECT_EQ(nullptr, router->touchscreen_gesture_target_.target);
5760 5713
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
5820 5773
5821 GURL frame_url( 5774 GURL frame_url(
5822 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 5775 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
5823 NavigateFrameToURL(root->child_at(0), frame_url); 5776 NavigateFrameToURL(root->child_at(0), frame_url);
5824 auto* child_frame_host = root->child_at(0)->current_frame_host(); 5777 auto* child_frame_host = root->child_at(0)->current_frame_host();
5825 5778
5826 // Synchronize with the child and parent renderers to guarantee that the 5779 // Synchronize with the child and parent renderers to guarantee that the
5827 // surface information required for event hit testing is ready. 5780 // surface information required for event hit testing is ready.
5828 auto* rwhv_child = 5781 auto* rwhv_child =
5829 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); 5782 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView());
5830 SurfaceHitTestReadyNotifier notifier( 5783 WaitForChildFrameSurfaceReady(child_frame_host);
5831 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
5832 notifier.WaitForSurfaceReady();
5833 5784
5834 // All touches & gestures are sent to the main frame's view, and should be 5785 // All touches & gestures are sent to the main frame's view, and should be
5835 // routed appropriately from there. 5786 // routed appropriately from there.
5836 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>( 5787 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>(
5837 contents->GetRenderWidgetHostView()); 5788 contents->GetRenderWidgetHostView());
5838 5789
5839 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); 5790 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter();
5840 EXPECT_EQ(nullptr, router->touchpad_gesture_target_.target); 5791 EXPECT_EQ(nullptr, router->touchpad_gesture_target_.target);
5841 5792
5842 gfx::Point main_frame_point(25, 25); 5793 gfx::Point main_frame_point(25, 25);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
5928 ASSERT_EQ(1U, root->child_count()); 5879 ASSERT_EQ(1U, root->child_count());
5929 5880
5930 FrameTreeNode* child_node = root->child_at(0); 5881 FrameTreeNode* child_node = root->child_at(0);
5931 GURL site_url(embedded_test_server->GetURL("baz.com", "/title1.html")); 5882 GURL site_url(embedded_test_server->GetURL("baz.com", "/title1.html"));
5932 EXPECT_EQ(site_url, child_node->current_url()); 5883 EXPECT_EQ(site_url, child_node->current_url());
5933 EXPECT_NE(shell->web_contents()->GetSiteInstance(), 5884 EXPECT_NE(shell->web_contents()->GetSiteInstance(),
5934 child_node->current_frame_host()->GetSiteInstance()); 5885 child_node->current_frame_host()->GetSiteInstance());
5935 5886
5936 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 5887 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
5937 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 5888 root->current_frame_host()->GetRenderWidgetHost()->GetView());
5938 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
5939 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
5940 5889
5941 // Ensure that the child process renderer is ready to have input events 5890 // Ensure that the child process renderer is ready to have input events
5942 // routed to it. This happens when the browser process has received 5891 // routed to it. This happens when the browser process has received
5943 // updated compositor surfaces from both renderer processes. 5892 // updated compositor surfaces from both renderer processes.
5944 SurfaceHitTestReadyNotifier notifier( 5893 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
5945 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
5946 notifier.WaitForSurfaceReady();
5947 5894
5948 // A WebContentsDelegate to listen for the ShowContextMenu message. 5895 // A WebContentsDelegate to listen for the ShowContextMenu message.
5949 ContextMenuObserverDelegate context_menu_delegate; 5896 ContextMenuObserverDelegate context_menu_delegate;
5950 shell->web_contents()->SetDelegate(&context_menu_delegate); 5897 shell->web_contents()->SetDelegate(&context_menu_delegate);
5951 5898
5952 RenderWidgetHostInputEventRouter* router = 5899 RenderWidgetHostInputEventRouter* router =
5953 static_cast<WebContentsImpl*>(shell->web_contents()) 5900 static_cast<WebContentsImpl*>(shell->web_contents())
5954 ->GetInputEventRouter(); 5901 ->GetInputEventRouter();
5955 5902
5956 gfx::Point point(75, 75); 5903 gfx::Point point(75, 75);
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
8100 ->GetFrameTree() 8047 ->GetFrameTree()
8101 ->root(); 8048 ->root();
8102 FrameTreeNode* child_node = root_node->child_at(0); 8049 FrameTreeNode* child_node = root_node->child_at(0);
8103 8050
8104 rwhv_child_ = static_cast<RenderWidgetHostViewBase*>( 8051 rwhv_child_ = static_cast<RenderWidgetHostViewBase*>(
8105 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 8052 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
8106 8053
8107 rwhva_root_ = static_cast<RenderWidgetHostViewAura*>( 8054 rwhva_root_ = static_cast<RenderWidgetHostViewAura*>(
8108 shell()->web_contents()->GetRenderWidgetHostView()); 8055 shell()->web_contents()->GetRenderWidgetHostView());
8109 8056
8110 SurfaceHitTestReadyNotifier notifier( 8057 WaitForChildFrameSurfaceReady(child_node->current_frame_host());
8111 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child_));
8112 notifier.WaitForSurfaceReady();
8113 8058
8114 rwhi_child_ = child_node->current_frame_host()->GetRenderWidgetHost(); 8059 rwhi_child_ = child_node->current_frame_host()->GetRenderWidgetHost();
8115 rwhi_root_ = root_node->current_frame_host()->GetRenderWidgetHost(); 8060 rwhi_root_ = root_node->current_frame_host()->GetRenderWidgetHost();
8116 } 8061 }
8117 8062
8118 protected: 8063 protected:
8119 RenderWidgetHostViewBase* rwhv_child_; 8064 RenderWidgetHostViewBase* rwhv_child_;
8120 RenderWidgetHostViewAura* rwhva_root_; 8065 RenderWidgetHostViewAura* rwhva_root_;
8121 RenderWidgetHostImpl* rwhi_child_; 8066 RenderWidgetHostImpl* rwhi_child_;
8122 RenderWidgetHostImpl* rwhi_root_; 8067 RenderWidgetHostImpl* rwhi_root_;
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
9333 "subframes_with_resources.html?urls=%s,%s&" 9278 "subframes_with_resources.html?urls=%s,%s&"
9334 "numSubresources=3", 9279 "numSubresources=3",
9335 path0.c_str(), path1.c_str()))); 9280 path0.c_str(), path1.c_str())));
9336 EXPECT_TRUE(NavigateToURL(shell(), url)); 9281 EXPECT_TRUE(NavigateToURL(shell(), url));
9337 bool result; 9282 bool result;
9338 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), "createFrames()", &result)); 9283 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), "createFrames()", &result));
9339 EXPECT_TRUE(result); 9284 EXPECT_TRUE(result);
9340 } 9285 }
9341 9286
9342 } // namespace content 9287 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/input_router_impl.cc ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698