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

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

Issue 2229463004: Generate MouseEnter/MouseLeave events between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test breakages from last PS Created 4 years, 3 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 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 main_frame_monitor.ResetEventReceived(); 1319 main_frame_monitor.ResetEventReceived();
1320 child_frame_monitor.ResetEventReceived(); 1320 child_frame_monitor.ResetEventReceived();
1321 router->RouteMouseEvent(root_view, &child_event); 1321 router->RouteMouseEvent(root_view, &child_event);
1322 1322
1323 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1323 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1324 EXPECT_EQ(75, main_frame_monitor.event().x); 1324 EXPECT_EQ(75, main_frame_monitor.event().x);
1325 EXPECT_EQ(75, main_frame_monitor.event().y); 1325 EXPECT_EQ(75, main_frame_monitor.event().y);
1326 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1326 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1327 } 1327 }
1328 1328
1329 // This test verifies that MouseEnter and MouseLeave events fire correctly
1330 // when the mouse cursor moves between processes.
1331 #if defined(OS_ANDROID)
1332 // Browser process hit testing is not implemented on Android.
1333 // https://crbug.com/491334
1334 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \
1335 DISABLED_CrossProcessMouseEnterAndLeaveTest
1336 #else
1337 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \
1338 CrossProcessMouseEnterAndLeaveTest
1339 #endif
1340 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
1341 MAYBE_CrossProcessMouseEnterAndLeaveTest) {
1342 GURL main_url(embedded_test_server()->GetURL(
1343 "a.com", "/cross_site_iframe_factory.html?a(b,c(d))"));
1344 NavigateToURL(shell(), main_url);
1345
1346 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
1347 ->GetFrameTree()
1348 ->root();
1349
1350 EXPECT_EQ(
1351 " Site A ------------ proxies for B C D\n"
1352 " |--Site B ------- proxies for A C D\n"
1353 " +--Site C ------- proxies for A B D\n"
1354 " +--Site D -- proxies for A B C\n"
1355 "Where A = http://a.com/\n"
1356 " B = http://b.com/\n"
1357 " C = http://c.com/\n"
1358 " D = http://d.com/",
1359 DepictFrameTree(root));
1360
1361 FrameTreeNode* b_node = root->child_at(0);
1362 FrameTreeNode* c_node = root->child_at(1);
1363 FrameTreeNode* d_node = c_node->child_at(0);
1364
1365 RenderWidgetHostViewBase* rwhv_a = static_cast<RenderWidgetHostViewBase*>(
1366 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1367 RenderWidgetHostViewBase* rwhv_b = static_cast<RenderWidgetHostViewBase*>(
1368 b_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1369 RenderWidgetHostViewBase* rwhv_d = static_cast<RenderWidgetHostViewBase*>(
1370 d_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1371
1372 // Verifying surfaces are ready in B and D are sufficient, since other
1373 // surfaces contain at least one of them.
1374 SurfaceHitTestReadyNotifier notifier_b(
1375 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_b));
1376 notifier_b.WaitForSurfaceReady();
1377 SurfaceHitTestReadyNotifier notifier_d(
1378 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_d));
1379 notifier_d.WaitForSurfaceReady();
1380
1381 // Create listeners for mouse events. These are used to verify that the
1382 // RenderWidgetHostInputEventRouter is generating MouseLeave, etc for
1383 // the right renderers.
1384 RenderWidgetHostMouseEventMonitor root_frame_monitor(
1385 root->current_frame_host()->GetRenderWidgetHost());
1386 RenderWidgetHostMouseEventMonitor a_frame_monitor(
1387 root->current_frame_host()->GetRenderWidgetHost());
1388 RenderWidgetHostMouseEventMonitor b_frame_monitor(
1389 b_node->current_frame_host()->GetRenderWidgetHost());
1390 RenderWidgetHostMouseEventMonitor c_frame_monitor(
1391 c_node->current_frame_host()->GetRenderWidgetHost());
1392 RenderWidgetHostMouseEventMonitor d_frame_monitor(
1393 d_node->current_frame_host()->GetRenderWidgetHost());
1394
1395 gfx::Point point_in_a_frame(2, 2);
1396 gfx::Point point_in_b_frame(rwhv_b->GetViewBounds().x() + 2,
1397 rwhv_b->GetViewBounds().y() + 2);
1398 gfx::Point point_in_d_frame(rwhv_d->GetViewBounds().x() + 2,
1399 rwhv_d->GetViewBounds().y() + 2);
1400
1401 blink::WebMouseEvent mouse_event;
1402 mouse_event.type = blink::WebInputEvent::MouseMove;
1403 mouse_event.x = point_in_a_frame.x();
1404 mouse_event.y = point_in_a_frame.y();
1405
1406 // Send an initial MouseMove to the root view, which shouldn't affect the
1407 // other renderers.
1408 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event);
1409 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1410 a_frame_monitor.ResetEventReceived();
1411 EXPECT_FALSE(b_frame_monitor.EventWasReceived());
1412 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1413 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1414
1415 // Next send a MouseMove to B frame, which shouldn't affect C or D but
1416 // A should receive a MouseMove event.
1417 mouse_event.x = point_in_b_frame.x();
1418 mouse_event.y = point_in_b_frame.y();
1419 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event);
1420 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1421 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove);
1422 a_frame_monitor.ResetEventReceived();
1423 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1424 b_frame_monitor.ResetEventReceived();
1425 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1426 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1427
1428 // Next send a MouseMove to D frame, which should have side effects in every
1429 // other RenderWidgetHostView.
1430 mouse_event.x = point_in_d_frame.x();
1431 mouse_event.y = point_in_d_frame.y();
1432 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event);
1433 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1434 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove);
1435 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1436 EXPECT_EQ(b_frame_monitor.event().type, blink::WebInputEvent::MouseLeave);
1437 EXPECT_TRUE(c_frame_monitor.EventWasReceived());
1438 EXPECT_EQ(c_frame_monitor.event().type, blink::WebInputEvent::MouseMove);
1439 EXPECT_TRUE(d_frame_monitor.EventWasReceived());
1440 }
1441
1329 // Tests OOPIF rendering by checking that the RWH of the iframe generates 1442 // Tests OOPIF rendering by checking that the RWH of the iframe generates
1330 // OnSwapCompositorFrame message. 1443 // OnSwapCompositorFrame message.
1331 #if defined(OS_ANDROID) 1444 #if defined(OS_ANDROID)
1332 // http://crbug.com/471850 1445 // http://crbug.com/471850
1333 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped 1446 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped
1334 #else 1447 #else
1335 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped 1448 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped
1336 #endif 1449 #endif
1337 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 1450 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
1338 MAYBE_CompositorFrameSwapped) { 1451 MAYBE_CompositorFrameSwapped) {
(...skipping 6656 matching lines...) Expand 10 before | Expand all | Expand 10 after
7995 child_rfh->OnDispatchLoad(); 8108 child_rfh->OnDispatchLoad();
7996 8109
7997 // In the bug, OnDispatchLoad killed the b.com renderer. Ensure that this is 8110 // In the bug, OnDispatchLoad killed the b.com renderer. Ensure that this is
7998 // not the case. Note that the process kill doesn't happen immediately, so 8111 // not the case. Note that the process kill doesn't happen immediately, so
7999 // IsRenderFrameLive() can't be checked here (yet). Instead, check that 8112 // IsRenderFrameLive() can't be checked here (yet). Instead, check that
8000 // JavaScript can still execute in b.com using the popup. 8113 // JavaScript can still execute in b.com using the popup.
8001 EXPECT_TRUE(ExecuteScript(popup_shell->web_contents(), "true")); 8114 EXPECT_TRUE(ExecuteScript(popup_shell->web_contents(), "true"));
8002 } 8115 }
8003 8116
8004 } // namespace content 8117 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698