summaryrefslogtreecommitdiffstats
path: root/content/browser/site_per_process_browsertest.cc
diff options
context:
space:
mode:
authorcreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-27 21:56:22 +0000
committercreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-27 21:56:22 +0000
commita1b99266e14abd60f07582836a13640957b8b265 (patch)
tree9a2851a7f3d591d4de6e353d51671afb970ee276 /content/browser/site_per_process_browsertest.cc
parent6d74e6f100fb8d87b245654ded0843a78f429818 (diff)
downloadchromium_src-a1b99266e14abd60f07582836a13640957b8b265.zip
chromium_src-a1b99266e14abd60f07582836a13640957b8b265.tar.gz
chromium_src-a1b99266e14abd60f07582836a13640957b8b265.tar.bz2
Support cross-process navigations in a single subframe RenderFrameHost.
This relies on a hack of detecting when a NavigationEntry is for a subframe RenderFrameHost, even though the navigation occurs in a top-level RenderViewHost. It supports cases with at most one frame, and is only enabled when --site-per-process is used. BUG=314791 TEST=New process is created for a cross-site iframe with --site-per-process. Review URL: https://codereview.chromium.org/118443008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242639 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/site_per_process_browsertest.cc')
-rw-r--r--content/browser/site_per_process_browsertest.cc56
1 files changed, 38 insertions, 18 deletions
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index cca1df0..781b97b 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -31,9 +31,20 @@ class SitePerProcessWebContentsObserver: public WebContentsObserver {
public:
explicit SitePerProcessWebContentsObserver(WebContents* web_contents)
: WebContentsObserver(web_contents),
- navigation_succeeded_(true) {}
+ navigation_succeeded_(false) {}
virtual ~SitePerProcessWebContentsObserver() {}
+ virtual void DidStartProvisionalLoadForFrame(
+ int64 frame_id,
+ int64 parent_frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ bool is_error_page,
+ bool is_iframe_srcdoc,
+ RenderViewHost* render_view_host) OVERRIDE {
+ navigation_succeeded_ = false;
+ }
+
virtual void DidFailProvisionalLoad(
int64 frame_id,
const base::string16& frame_unique_name,
@@ -184,9 +195,8 @@ class SitePerProcessBrowserTest : public ContentBrowserTest {
}
};
-// TODO(nasko): Disable this test until out-of-process iframes is ready and the
-// security checks are back in place.
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) {
+// Ensure that we can complete a cross-process subframe navigation.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) {
ASSERT_TRUE(test_server()->Start());
net::SpawnedTestServer https_server(
net::SpawnedTestServer::TYPE_HTTPS,
@@ -198,21 +208,31 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) {
NavigateToURL(shell(), main_url);
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"));
- EXPECT_EQ(observer.navigation_url(), http_url);
- EXPECT_TRUE(observer.navigation_succeeded());
- }
- {
- // Load cross-site page into Iframe.
- GURL https_url(https_server.GetURL("files/title1.html"));
- EXPECT_TRUE(NavigateIframeToURL(shell(), https_url, "test"));
- EXPECT_EQ(observer.navigation_url(), https_url);
- EXPECT_FALSE(observer.navigation_succeeded());
- }
+ // Load same-site page into iframe.
+ GURL http_url(test_server()->GetURL("files/title1.html"));
+ EXPECT_TRUE(NavigateIframeToURL(shell(), http_url, "test"));
+ EXPECT_EQ(observer.navigation_url(), http_url);
+ EXPECT_TRUE(observer.navigation_succeeded());
+
+ // Load cross-site page into iframe.
+ GURL https_url(https_server.GetURL("files/title1.html"));
+ EXPECT_TRUE(NavigateIframeToURL(shell(), https_url, "test"));
+ EXPECT_EQ(observer.navigation_url(), https_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);
+ EXPECT_NE(shell()->web_contents()->GetRenderViewHost(),
+ child->current_frame_host()->render_view_host());
+ EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
+ child->current_frame_host()->render_view_host()->GetSiteInstance());
+ EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(),
+ child->current_frame_host()->GetProcess());
}
// TODO(nasko): Disable this test until out-of-process iframes is ready and the