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