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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // There should be now two RenderWidgetHosts, one for each process | 302 // There should be now two RenderWidgetHosts, one for each process |
303 // rendering a frame. | 303 // rendering a frame. |
304 std::set<RenderWidgetHostView*> views_set = | 304 std::set<RenderWidgetHostView*> views_set = |
305 static_cast<WebContentsImpl*>(shell()->web_contents()) | 305 static_cast<WebContentsImpl*>(shell()->web_contents()) |
306 ->GetRenderWidgetHostViewsInTree(); | 306 ->GetRenderWidgetHostViewsInTree(); |
307 EXPECT_EQ(2U, views_set.size()); | 307 EXPECT_EQ(2U, views_set.size()); |
308 } | 308 } |
309 proxy_to_parent = child->render_manager()->GetProxyToParent(); | 309 proxy_to_parent = child->render_manager()->GetProxyToParent(); |
310 EXPECT_TRUE(proxy_to_parent); | 310 EXPECT_TRUE(proxy_to_parent); |
311 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 311 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
312 EXPECT_EQ( | 312 // The out-of-process iframe should have its own RenderWidgetHost, |
| 313 // independent of any RenderViewHost. |
| 314 EXPECT_NE( |
313 rvh->GetView(), | 315 rvh->GetView(), |
314 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); | 316 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); |
| 317 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); |
315 | 318 |
316 // Load another cross-site page into the same iframe. | 319 // Load another cross-site page into the same iframe. |
317 url = embedded_test_server()->GetURL("bar.com", "/title3.html"); | 320 url = embedded_test_server()->GetURL("bar.com", "/title3.html"); |
318 NavigateFrameToURL(root->child_at(0), url); | 321 NavigateFrameToURL(root->child_at(0), url); |
319 EXPECT_TRUE(observer.navigation_succeeded()); | 322 EXPECT_TRUE(observer.navigation_succeeded()); |
320 EXPECT_EQ(url, observer.navigation_url()); | 323 EXPECT_EQ(url, observer.navigation_url()); |
321 | 324 |
322 // Check again that a new process is created and is different from the | 325 // Check again that a new process is created and is different from the |
323 // top level one and the previous one. | 326 // top level one and the previous one. |
324 ASSERT_EQ(2U, root->child_count()); | 327 ASSERT_EQ(2U, root->child_count()); |
325 child = root->child_at(0); | 328 child = root->child_at(0); |
326 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), | 329 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), |
327 child->current_frame_host()->render_view_host()); | 330 child->current_frame_host()->render_view_host()); |
328 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); | 331 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); |
329 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 332 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
330 child->current_frame_host()->GetSiteInstance()); | 333 child->current_frame_host()->GetSiteInstance()); |
331 EXPECT_NE(site_instance, | 334 EXPECT_NE(site_instance, |
332 child->current_frame_host()->GetSiteInstance()); | 335 child->current_frame_host()->GetSiteInstance()); |
333 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), | 336 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), |
334 child->current_frame_host()->GetProcess()); | 337 child->current_frame_host()->GetProcess()); |
335 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); | 338 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); |
336 { | 339 { |
337 std::set<RenderWidgetHostView*> views_set = | 340 std::set<RenderWidgetHostView*> views_set = |
338 static_cast<WebContentsImpl*>(shell()->web_contents()) | 341 static_cast<WebContentsImpl*>(shell()->web_contents()) |
339 ->GetRenderWidgetHostViewsInTree(); | 342 ->GetRenderWidgetHostViewsInTree(); |
340 EXPECT_EQ(2U, views_set.size()); | 343 EXPECT_EQ(2U, views_set.size()); |
341 } | 344 } |
342 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); | 345 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); |
343 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 346 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
344 EXPECT_EQ( | 347 EXPECT_NE( |
345 child->current_frame_host()->render_view_host()->GetView(), | 348 child->current_frame_host()->render_view_host()->GetView(), |
346 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); | 349 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); |
| 350 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); |
347 } | 351 } |
348 | 352 |
349 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) { | 353 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) { |
350 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 354 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
351 NavigateToURL(shell(), main_url); | 355 NavigateToURL(shell(), main_url); |
352 | 356 |
353 // It is safe to obtain the root frame tree node here, as it doesn't change. | 357 // It is safe to obtain the root frame tree node here, as it doesn't change. |
354 FrameTreeNode* root = | 358 FrameTreeNode* root = |
355 static_cast<WebContentsImpl*>(shell()->web_contents())-> | 359 static_cast<WebContentsImpl*>(shell()->web_contents())-> |
356 GetFrameTree()->root(); | 360 GetFrameTree()->root(); |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 params.frame_tree_node_id = child->frame_tree_node_id(); | 1106 params.frame_tree_node_id = child->frame_tree_node_id(); |
1103 child->navigator()->GetController()->LoadURLWithParams(params); | 1107 child->navigator()->GetController()->LoadURLWithParams(params); |
1104 nav_observer.Wait(); | 1108 nav_observer.Wait(); |
1105 | 1109 |
1106 // Verify that the navigation succeeded and the expected URL was loaded. | 1110 // Verify that the navigation succeeded and the expected URL was loaded. |
1107 EXPECT_TRUE(observer.navigation_succeeded()); | 1111 EXPECT_TRUE(observer.navigation_succeeded()); |
1108 EXPECT_EQ(url, observer.navigation_url()); | 1112 EXPECT_EQ(url, observer.navigation_url()); |
1109 } | 1113 } |
1110 | 1114 |
1111 } // namespace content | 1115 } // namespace content |
OLD | NEW |