| OLD | NEW |
| 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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 987 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 988 bool frame_rect_received_; | 988 bool frame_rect_received_; |
| 989 gfx::Rect last_rect_; | 989 gfx::Rect last_rect_; |
| 990 | 990 |
| 991 DISALLOW_COPY_AND_ASSIGN(FrameRectChangedMessageFilter); | 991 DISALLOW_COPY_AND_ASSIGN(FrameRectChangedMessageFilter); |
| 992 }; | 992 }; |
| 993 | 993 |
| 994 // Test that the view bounds for an out-of-process iframe are set and updated | 994 // Test that the view bounds for an out-of-process iframe are set and updated |
| 995 // correctly, including accounting for local frame offsets in the parent and | 995 // correctly, including accounting for local frame offsets in the parent and |
| 996 // scroll positions. | 996 // scroll positions. |
| 997 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ViewBoundsInNestedFrameTest) { | 997 #if defined(OS_ANDROID) |
| 998 // Test failing on some Android builders, due to inaccurate coordinates on |
| 999 // some devices. See: https://crbug.com/700007. |
| 1000 #define MAYBE_ViewBoundsInNestedFrameTest DISABLED_ViewBoundsInNestedFrameTest |
| 1001 #else |
| 1002 #define MAYBE_ViewBoundsInNestedFrameTest ViewBoundsInNestedFrameTest |
| 1003 #endif |
| 1004 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1005 MAYBE_ViewBoundsInNestedFrameTest) { |
| 998 GURL main_url(embedded_test_server()->GetURL( | 1006 GURL main_url(embedded_test_server()->GetURL( |
| 999 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 1007 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 1000 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1008 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1001 | 1009 |
| 1002 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1010 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1003 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1011 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 1004 ->GetFrameTree() | 1012 ->GetFrameTree() |
| 1005 ->root(); | 1013 ->root(); |
| 1006 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( | 1014 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( |
| 1007 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1015 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 2); | 1303 2); |
| 1296 rwhv_parent->OnScrollEvent(&scroll_event); | 1304 rwhv_parent->OnScrollEvent(&scroll_event); |
| 1297 | 1305 |
| 1298 // Verify that this a mouse wheel event was sent to the child frame renderer. | 1306 // Verify that this a mouse wheel event was sent to the child frame renderer. |
| 1299 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1307 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 1300 EXPECT_EQ(child_frame_monitor.EventType(), blink::WebInputEvent::MouseWheel); | 1308 EXPECT_EQ(child_frame_monitor.EventType(), blink::WebInputEvent::MouseWheel); |
| 1301 } | 1309 } |
| 1302 | 1310 |
| 1303 // Test that mouse events are being routed to the correct RenderWidgetHostView | 1311 // Test that mouse events are being routed to the correct RenderWidgetHostView |
| 1304 // based on coordinates. | 1312 // based on coordinates. |
| 1305 #if defined(THREAD_SANITIZER) | 1313 #if defined(THREAD_SANITIZER) || defined(OS_ANDROID) |
| 1306 // The test times out often on TSAN bot. | 1314 // The test times out often on TSAN bot. |
| 1307 // https://crbug.com/591170. | 1315 // https://crbug.com/591170. |
| 1316 // Test failing on some Android builders, due to inaccurate coordinates on |
| 1317 // some devices. See: https://crbug.com/700007. |
| 1308 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest | 1318 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest |
| 1309 #else | 1319 #else |
| 1310 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest | 1320 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest |
| 1311 #endif | 1321 #endif |
| 1312 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) { | 1322 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) { |
| 1313 SurfaceHitTestTestHelper(shell(), embedded_test_server()); | 1323 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
| 1314 } | 1324 } |
| 1315 | 1325 |
| 1316 // Same test as above, but runs in high-dpi mode. | 1326 // Same test as above, but runs in high-dpi mode. |
| 1317 #if defined(OS_ANDROID) || defined(OS_WIN) | 1327 #if defined(OS_ANDROID) || defined(OS_WIN) |
| 1318 // High DPI browser tests are not needed on Android, and confuse some of the | 1328 // High DPI browser tests are not needed on Android, and confuse some of the |
| 1319 // coordinate calculations. Android uses fixed device scale factor. | 1329 // coordinate calculations. Android uses fixed device scale factor. |
| 1320 // Windows is disabled because of https://crbug.com/545547. | 1330 // Windows is disabled because of https://crbug.com/545547. |
| 1321 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest | 1331 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest |
| 1322 #else | 1332 #else |
| 1323 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest | 1333 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest |
| 1324 #endif | 1334 #endif |
| 1325 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, | 1335 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
| 1326 MAYBE_HighDPISurfaceHitTestTest) { | 1336 MAYBE_HighDPISurfaceHitTestTest) { |
| 1327 SurfaceHitTestTestHelper(shell(), embedded_test_server()); | 1337 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
| 1328 } | 1338 } |
| 1329 | 1339 |
| 1330 // Test that mouse events are being routed to the correct RenderWidgetHostView | 1340 // Test that mouse events are being routed to the correct RenderWidgetHostView |
| 1331 // when there are nested out-of-process iframes. | 1341 // when there are nested out-of-process iframes. |
| 1332 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NestedSurfaceHitTestTest) { | 1342 #if defined(OS_ANDROID) |
| 1343 // Test failing on some Android builders, due to inaccurate coordinates on |
| 1344 // some devices. See: https://crbug.com/700007. |
| 1345 #define MAYBE_NestedSurfaceHitTestTest DISABLED_NestedSurfaceHitTestTest |
| 1346 #else |
| 1347 #define MAYBE_NestedSurfaceHitTestTest NestedSurfaceHitTestTest |
| 1348 #endif |
| 1349 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1350 MAYBE_NestedSurfaceHitTestTest) { |
| 1333 GURL main_url(embedded_test_server()->GetURL( | 1351 GURL main_url(embedded_test_server()->GetURL( |
| 1334 "/frame_tree/page_with_positioned_nested_frames.html")); | 1352 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 1335 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1353 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1336 | 1354 |
| 1337 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1355 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1338 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 1356 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1339 ASSERT_EQ(1U, root->child_count()); | 1357 ASSERT_EQ(1U, root->child_count()); |
| 1340 | 1358 |
| 1341 FrameTreeNode* parent_iframe_node = root->child_at(0); | 1359 FrameTreeNode* parent_iframe_node = root->child_at(0); |
| 1342 GURL site_url(embedded_test_server()->GetURL( | 1360 GURL site_url(embedded_test_server()->GetURL( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); | 1479 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); |
| 1462 | 1480 |
| 1463 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1481 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1464 EXPECT_EQ(75, main_frame_monitor.event().x); | 1482 EXPECT_EQ(75, main_frame_monitor.event().x); |
| 1465 EXPECT_EQ(75, main_frame_monitor.event().y); | 1483 EXPECT_EQ(75, main_frame_monitor.event().y); |
| 1466 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1484 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1467 } | 1485 } |
| 1468 | 1486 |
| 1469 // This test verifies that MouseEnter and MouseLeave events fire correctly | 1487 // This test verifies that MouseEnter and MouseLeave events fire correctly |
| 1470 // when the mouse cursor moves between processes. | 1488 // when the mouse cursor moves between processes. |
| 1489 #if defined(OS_ANDROID) |
| 1490 // Test failing on some Android builders, due to inaccurate coordinates on |
| 1491 // some devices. See: https://crbug.com/700007. |
| 1492 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \ |
| 1493 DISABLED_CrossProcessMouseEnterAndLeaveTest |
| 1494 #else |
| 1495 #define MAYBE_CrossProcessMouseEnterAndLeaveTest \ |
| 1496 CrossProcessMouseEnterAndLeaveTest |
| 1497 #endif |
| 1471 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1498 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1472 CrossProcessMouseEnterAndLeaveTest) { | 1499 MAYBE_CrossProcessMouseEnterAndLeaveTest) { |
| 1473 GURL main_url(embedded_test_server()->GetURL( | 1500 GURL main_url(embedded_test_server()->GetURL( |
| 1474 "a.com", "/cross_site_iframe_factory.html?a(b,c(d))")); | 1501 "a.com", "/cross_site_iframe_factory.html?a(b,c(d))")); |
| 1475 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1502 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1476 | 1503 |
| 1477 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1504 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 1478 ->GetFrameTree() | 1505 ->GetFrameTree() |
| 1479 ->root(); | 1506 ->root(); |
| 1480 | 1507 |
| 1481 EXPECT_EQ( | 1508 EXPECT_EQ( |
| 1482 " Site A ------------ proxies for B C D\n" | 1509 " Site A ------------ proxies for B C D\n" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); | 1608 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); |
| 1582 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave); | 1609 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave); |
| 1583 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); | 1610 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); |
| 1584 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); | 1611 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove); |
| 1585 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); | 1612 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); |
| 1586 } | 1613 } |
| 1587 | 1614 |
| 1588 // Verify that mouse capture works on a RenderWidgetHostView level, so that | 1615 // Verify that mouse capture works on a RenderWidgetHostView level, so that |
| 1589 // dragging scroll bars and selecting text continues even when the mouse | 1616 // dragging scroll bars and selecting text continues even when the mouse |
| 1590 // cursor crosses over cross-process frame boundaries. | 1617 // cursor crosses over cross-process frame boundaries. |
| 1591 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossProcessMouseCapture) { | 1618 #if defined(OS_ANDROID) |
| 1619 // Test failing on some Android builders, due to inaccurate coordinates on |
| 1620 // some devices. See: https://crbug.com/700007. |
| 1621 #define MAYBE_CrossProcessMouseCapture DISABLED_CrossProcessMouseCapture |
| 1622 #else |
| 1623 #define MAYBE_CrossProcessMouseCapture CrossProcessMouseCapture |
| 1624 #endif |
| 1625 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1626 MAYBE_CrossProcessMouseCapture) { |
| 1592 GURL main_url(embedded_test_server()->GetURL( | 1627 GURL main_url(embedded_test_server()->GetURL( |
| 1593 "/frame_tree/page_with_positioned_frame.html")); | 1628 "/frame_tree/page_with_positioned_frame.html")); |
| 1594 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1629 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1595 | 1630 |
| 1596 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1631 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1597 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 1632 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1598 ASSERT_EQ(1U, root->child_count()); | 1633 ASSERT_EQ(1U, root->child_count()); |
| 1599 | 1634 |
| 1600 FrameTreeNode* child_node = root->child_at(0); | 1635 FrameTreeNode* child_node = root->child_at(0); |
| 1601 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 1636 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| (...skipping 8014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9616 | 9651 |
| 9617 // Try the same navigation, but use the browser-initiated path. | 9652 // Try the same navigation, but use the browser-initiated path. |
| 9618 NavigateFrameToURL(root->child_at(0), frame_url); | 9653 NavigateFrameToURL(root->child_at(0), frame_url); |
| 9619 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host()); | 9654 EXPECT_FALSE(root->child_at(0)->render_manager()->pending_frame_host()); |
| 9620 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url); | 9655 EXPECT_EQ(root->child_at(0)->current_url(), redirected_url); |
| 9621 EXPECT_EQ(b_site_instance, | 9656 EXPECT_EQ(b_site_instance, |
| 9622 root->child_at(0)->current_frame_host()->GetSiteInstance()); | 9657 root->child_at(0)->current_frame_host()->GetSiteInstance()); |
| 9623 } | 9658 } |
| 9624 | 9659 |
| 9625 } // namespace content | 9660 } // namespace content |
| OLD | NEW |