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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/frame_host/cross_process_frame_connector.h" | 10 #include "content/browser/frame_host/cross_process_frame_connector.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 EXPECT_EQ(2U, views_set.size()); | 274 EXPECT_EQ(2U, views_set.size()); |
275 } | 275 } |
276 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); | 276 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); |
277 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 277 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
278 EXPECT_NE( | 278 EXPECT_NE( |
279 child->current_frame_host()->render_view_host()->GetView(), | 279 child->current_frame_host()->render_view_host()->GetView(), |
280 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); | 280 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); |
281 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); | 281 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); |
282 } | 282 } |
283 | 283 |
| 284 // Ensure that OOPIFs are deleted after navigating to a new main frame. |
| 285 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { |
| 286 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 287 NavigateToURL(shell(), main_url); |
| 288 |
| 289 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 290 FrameTreeNode* root = |
| 291 static_cast<WebContentsImpl*>(shell()->web_contents())-> |
| 292 GetFrameTree()->root(); |
| 293 |
| 294 TestNavigationObserver observer(shell()->web_contents()); |
| 295 |
| 296 // Load cross-site page into iframe. |
| 297 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 298 NavigateFrameToURL(root->child_at(0), url); |
| 299 // Verify that the navigation succeeded and the expected URL was loaded. |
| 300 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 301 EXPECT_EQ(url, observer.last_navigation_url()); |
| 302 |
| 303 // Ensure that we have created a new process for the subframe. |
| 304 FrameTreeNode* child = root->child_at(0); |
| 305 ASSERT_EQ(2U, root->child_count()); |
| 306 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
| 307 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
| 308 |
| 309 // Load a new same-site page in the top-level frame. |
| 310 GURL new_url(embedded_test_server()->GetURL("/title1.html")); |
| 311 NavigateToURL(shell(), new_url); |
| 312 |
| 313 // Ensure that the subframe is gone. |
| 314 ASSERT_EQ(0U, root->child_count()); |
| 315 } |
| 316 |
284 // Disabled for flaky crashing: crbug.com/446575 | 317 // Disabled for flaky crashing: crbug.com/446575 |
285 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 318 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
286 NavigateRemoteFrame) { | 319 NavigateRemoteFrame) { |
287 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 320 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
288 NavigateToURL(shell(), main_url); | 321 NavigateToURL(shell(), main_url); |
289 | 322 |
290 // It is safe to obtain the root frame tree node here, as it doesn't change. | 323 // It is safe to obtain the root frame tree node here, as it doesn't change. |
291 FrameTreeNode* root = | 324 FrameTreeNode* root = |
292 static_cast<WebContentsImpl*>(shell()->web_contents())-> | 325 static_cast<WebContentsImpl*>(shell()->web_contents())-> |
293 GetFrameTree()->root(); | 326 GetFrameTree()->root(); |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 1684 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
1652 TestNavigationObserver observer(shell()->web_contents()); | 1685 TestNavigationObserver observer(shell()->web_contents()); |
1653 NavigateFrameToURL(root->child_at(0), foo_url); | 1686 NavigateFrameToURL(root->child_at(0), foo_url); |
1654 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1687 EXPECT_TRUE(observer.last_navigation_succeeded()); |
1655 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 1688 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
1656 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); | 1689 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); |
1657 } | 1690 } |
1658 } | 1691 } |
1659 | 1692 |
1660 } // namespace content | 1693 } // namespace content |
OLD | NEW |