Index: content/browser/site_per_process_browsertest.cc |
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc |
index 9a47b4b12f7173c4df1a8e334e3ee7b731c1d09f..b1d6856f8531d6a2da3e598301094e033021ba63 100644 |
--- a/content/browser/site_per_process_browsertest.cc |
+++ b/content/browser/site_per_process_browsertest.cc |
@@ -203,13 +203,16 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); |
NavigateToURL(shell(), main_url); |
- StartFrameAtDataURL(); |
Charlie Reis
2014/04/24 20:37:50
Interesting. This isn't required anymore? Is tha
nasko
2014/04/24 22:31:12
It isn't needed since we don't listen for NavEntry
|
+ // It is safe to obtain the root frame tree node here, as it doesn't change. |
+ FrameTreeNode* root = |
+ static_cast<WebContentsImpl*>(shell()->web_contents())-> |
+ GetFrameTree()->root(); |
SitePerProcessWebContentsObserver observer(shell()->web_contents()); |
// Load same-site page into iframe. |
GURL http_url(test_server()->GetURL("files/title1.html")); |
- EXPECT_TRUE(NavigateIframeToURL(shell(), http_url, "test")); |
+ NavigateFrameToURL(root->child_at(0)->current_frame_host(), http_url); |
EXPECT_EQ(http_url, observer.navigation_url()); |
EXPECT_TRUE(observer.navigation_succeeded()); |
@@ -221,22 +224,45 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
GURL cross_site_url(test_server()->GetURL("files/title2.html")); |
replace_host.SetHostStr(foo_com); |
cross_site_url = cross_site_url.ReplaceComponents(replace_host); |
- EXPECT_TRUE(NavigateIframeToURL(shell(), cross_site_url, "test")); |
+ NavigateFrameToURL(root->child_at(0)->current_frame_host(), cross_site_url); |
EXPECT_EQ(cross_site_url, observer.navigation_url()); |
EXPECT_TRUE(observer.navigation_succeeded()); |
// Ensure that we have created a new process for the subframe. |
- FrameTreeNode* root = |
- static_cast<WebContentsImpl*>(shell()->web_contents())-> |
- GetFrameTree()->root(); |
ASSERT_EQ(1U, root->child_count()); |
FrameTreeNode* child = root->child_at(0); |
+ SiteInstance* site_instance = |
+ child->current_frame_host()->render_view_host()->GetSiteInstance(); |
Charlie Reis
2014/04/24 20:37:50
nit: Wrong indent. Also, RenderFrameHostImpl has
nasko
2014/04/24 22:31:12
Done.
|
+ RenderViewHost* rvh = child->current_frame_host()->render_view_host(); |
+ RenderProcessHost* rph = child->current_frame_host()->GetProcess(); |
+ EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh); |
+ EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
+ EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph); |
+ |
+ // Load another cross-site page into the same iframe. |
+ cross_site_url = test_server()->GetURL("files/title3.html"); |
+ std::string bar_com("bar.com"); |
+ replace_host.SetHostStr(bar_com); |
+ cross_site_url = cross_site_url.ReplaceComponents(replace_host); |
+ NavigateFrameToURL(root->child_at(0)->current_frame_host(), cross_site_url); |
+ EXPECT_EQ(cross_site_url, observer.navigation_url()); |
+ EXPECT_TRUE(observer.navigation_succeeded()); |
+ |
+ // Check again that a new process is created and is different from the |
+ // top level one and the previous one. |
+ ASSERT_EQ(1U, root->child_count()); |
+ child = root->child_at(0); |
EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), |
child->current_frame_host()->render_view_host()); |
+ EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); |
EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
child->current_frame_host()->render_view_host()->GetSiteInstance()); |
+ EXPECT_NE(site_instance, |
+ child->current_frame_host()->render_view_host()->GetSiteInstance()); |
Charlie Reis
2014/04/24 20:37:50
nit: Drop render_view_host()
nasko
2014/04/24 22:31:12
Done.
|
EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), |
child->current_frame_host()->GetProcess()); |
+ EXPECT_NE(rph, child->current_frame_host()->GetProcess()); |
+ |
} |
// Crash a subframe and ensures its children are cleared from the FrameTree. |