| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // There should be now two RenderWidgetHosts, one for each process | 278 // There should be now two RenderWidgetHosts, one for each process |
| 279 // rendering a frame. | 279 // rendering a frame. |
| 280 std::set<RenderWidgetHostView*> views_set = | 280 std::set<RenderWidgetHostView*> views_set = |
| 281 static_cast<WebContentsImpl*>(shell()->web_contents()) | 281 static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 282 ->GetRenderWidgetHostViewsInTree(); | 282 ->GetRenderWidgetHostViewsInTree(); |
| 283 EXPECT_EQ(2U, views_set.size()); | 283 EXPECT_EQ(2U, views_set.size()); |
| 284 } | 284 } |
| 285 proxy_to_parent = child->render_manager()->GetProxyToParent(); | 285 proxy_to_parent = child->render_manager()->GetProxyToParent(); |
| 286 EXPECT_TRUE(proxy_to_parent); | 286 EXPECT_TRUE(proxy_to_parent); |
| 287 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 287 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
| 288 EXPECT_EQ( | 288 // The out-of-process iframe should have its own RenderWidgetHost, |
| 289 // independent of any RenderViewHost. |
| 290 EXPECT_NE( |
| 289 rvh->GetView(), | 291 rvh->GetView(), |
| 290 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); | 292 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); |
| 293 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); |
| 291 | 294 |
| 292 // Load another cross-site page into the same iframe. | 295 // Load another cross-site page into the same iframe. |
| 293 url = embedded_test_server()->GetURL("bar.com", "/title3.html"); | 296 url = embedded_test_server()->GetURL("bar.com", "/title3.html"); |
| 294 NavigateFrameToURL(root->child_at(0), url); | 297 NavigateFrameToURL(root->child_at(0), url); |
| 295 EXPECT_TRUE(observer.navigation_succeeded()); | 298 EXPECT_TRUE(observer.navigation_succeeded()); |
| 296 EXPECT_EQ(url, observer.navigation_url()); | 299 EXPECT_EQ(url, observer.navigation_url()); |
| 297 | 300 |
| 298 // Check again that a new process is created and is different from the | 301 // Check again that a new process is created and is different from the |
| 299 // top level one and the previous one. | 302 // top level one and the previous one. |
| 300 ASSERT_EQ(2U, root->child_count()); | 303 ASSERT_EQ(2U, root->child_count()); |
| 301 child = root->child_at(0); | 304 child = root->child_at(0); |
| 302 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), | 305 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), |
| 303 child->current_frame_host()->render_view_host()); | 306 child->current_frame_host()->render_view_host()); |
| 304 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); | 307 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); |
| 305 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 308 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 306 child->current_frame_host()->GetSiteInstance()); | 309 child->current_frame_host()->GetSiteInstance()); |
| 307 EXPECT_NE(site_instance, | 310 EXPECT_NE(site_instance, |
| 308 child->current_frame_host()->GetSiteInstance()); | 311 child->current_frame_host()->GetSiteInstance()); |
| 309 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), | 312 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), |
| 310 child->current_frame_host()->GetProcess()); | 313 child->current_frame_host()->GetProcess()); |
| 311 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); | 314 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); |
| 312 { | 315 { |
| 313 std::set<RenderWidgetHostView*> views_set = | 316 std::set<RenderWidgetHostView*> views_set = |
| 314 static_cast<WebContentsImpl*>(shell()->web_contents()) | 317 static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 315 ->GetRenderWidgetHostViewsInTree(); | 318 ->GetRenderWidgetHostViewsInTree(); |
| 316 EXPECT_EQ(2U, views_set.size()); | 319 EXPECT_EQ(2U, views_set.size()); |
| 317 } | 320 } |
| 318 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); | 321 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); |
| 319 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 322 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
| 320 EXPECT_EQ( | 323 EXPECT_NE( |
| 321 child->current_frame_host()->render_view_host()->GetView(), | 324 child->current_frame_host()->render_view_host()->GetView(), |
| 322 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); | 325 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); |
| 326 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); |
| 323 } | 327 } |
| 324 | 328 |
| 325 // Disabled for flaky crashing: crbug.com/446575 | 329 // Disabled for flaky crashing: crbug.com/446575 |
| 326 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 330 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 327 DISABLED_NavigateRemoteFrame) { | 331 DISABLED_NavigateRemoteFrame) { |
| 328 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 332 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 329 NavigateToURL(shell(), main_url); | 333 NavigateToURL(shell(), main_url); |
| 330 | 334 |
| 331 // It is safe to obtain the root frame tree node here, as it doesn't change. | 335 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 332 FrameTreeNode* root = | 336 FrameTreeNode* root = |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 params.frame_tree_node_id = child->frame_tree_node_id(); | 1086 params.frame_tree_node_id = child->frame_tree_node_id(); |
| 1083 child->navigator()->GetController()->LoadURLWithParams(params); | 1087 child->navigator()->GetController()->LoadURLWithParams(params); |
| 1084 nav_observer.Wait(); | 1088 nav_observer.Wait(); |
| 1085 | 1089 |
| 1086 // Verify that the navigation succeeded and the expected URL was loaded. | 1090 // Verify that the navigation succeeded and the expected URL was loaded. |
| 1087 EXPECT_TRUE(observer.navigation_succeeded()); | 1091 EXPECT_TRUE(observer.navigation_succeeded()); |
| 1088 EXPECT_EQ(url, observer.navigation_url()); | 1092 EXPECT_EQ(url, observer.navigation_url()); |
| 1089 } | 1093 } |
| 1090 | 1094 |
| 1091 } // namespace content | 1095 } // namespace content |
| OLD | NEW |