Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1142)

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 789273006: Make ContentSettingsObserver security checks work with OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 cc7e1fa3948a836a8c42f627173aa4f04ed8ba6c..17806733a91340127f68b4009efbf47f4d02f591 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -214,28 +214,6 @@ void SitePerProcessBrowserTest::StartFrameAtDataURL() {
ASSERT_TRUE(ExecuteScript(shell()->web_contents(), data_url_script));
}
-bool SitePerProcessBrowserTest::NavigateIframeToURL(Shell* window,
- const GURL& url,
- std::string iframe_id) {
- // TODO(creis): This should wait for LOAD_STOP, but cross-site subframe
- // navigations generate extra DidStartLoading and DidStopLoading messages.
- // Until we replace swappedout:// with frame proxies, we need to listen for
- // something else. For now, we trigger NEW_SUBFRAME navigations and listen
- // for commit.
- std::string script = base::StringPrintf(
- "setTimeout(\""
- "var iframes = document.getElementById('%s');iframes.src='%s';"
- "\",0)",
- iframe_id.c_str(), url.spec().c_str());
- WindowedNotificationObserver load_observer(
- NOTIFICATION_NAV_ENTRY_COMMITTED,
- Source<NavigationController>(
- &window->web_contents()->GetController()));
- bool result = ExecuteScript(window->web_contents(), script);
- load_observer.Wait();
- return result;
-}
-
void SitePerProcessBrowserTest::SetUpCommandLine(CommandLine* command_line) {
command_line->AppendSwitch(switches::kSitePerProcess);
};
@@ -373,7 +351,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) {
// Emulate the main frame changing the src of the iframe such that it
// navigates cross-site.
url = embedded_test_server()->GetURL("bar.com", "/title3.html");
- NavigateIframeToURL(shell(), url, "test");
+ NavigateIframeToURL(shell()->web_contents(), "test", url);
EXPECT_TRUE(observer.navigation_succeeded());
EXPECT_EQ(url, observer.navigation_url());
@@ -409,9 +387,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrashSubframe) {
// Load cross-site page into iframe.
EXPECT_TRUE(NavigateIframeToURL(
- shell(),
- embedded_test_server()->GetURL("/cross-site/foo.com/title2.html"),
- "test"));
+ shell()->web_contents(), "test",
+ embedded_test_server()->GetURL("/cross-site/foo.com/title2.html")));
// Check the subframe process.
FrameTreeNode* root =
@@ -485,8 +462,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// Should be blocked.
GURL client_redirect_https_url(https_server.GetURL(
"client-redirect?files/title1.html"));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- client_redirect_https_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ client_redirect_https_url));
// DidFailProvisionalLoad when navigating to client_redirect_https_url.
EXPECT_EQ(observer.navigation_url(), client_redirect_https_url);
EXPECT_FALSE(observer.navigation_succeeded());
@@ -497,8 +474,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// which redirects to same-site page.
GURL server_redirect_http_url(https_server.GetURL(
"server-redirect?" + http_url.spec()));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- server_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ server_redirect_http_url));
EXPECT_EQ(observer.navigation_url(), http_url);
EXPECT_TRUE(observer.navigation_succeeded());
}
@@ -508,8 +485,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// which redirects to cross-site page.
GURL server_redirect_http_url(https_server.GetURL(
"server-redirect?files/title1.html"));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- server_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ server_redirect_http_url));
// DidFailProvisionalLoad when navigating to https_url.
EXPECT_EQ(observer.navigation_url(), https_url);
EXPECT_FALSE(observer.navigation_succeeded());
@@ -520,8 +497,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// which redirects to cross-site page.
GURL server_redirect_http_url(test_server()->GetURL(
"server-redirect?" + https_url.spec()));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- server_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ server_redirect_http_url));
EXPECT_EQ(observer.navigation_url(), https_url);
EXPECT_FALSE(observer.navigation_succeeded());
@@ -538,8 +515,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
Source<NavigationController>(
&shell()->web_contents()->GetController()));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- client_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ client_redirect_http_url));
// Same-site Client-Redirect Page should be loaded successfully.
EXPECT_EQ(observer.navigation_url(), client_redirect_http_url);
@@ -556,8 +533,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// which redirects to same-site page.
GURL server_redirect_http_url(test_server()->GetURL(
"server-redirect?files/title1.html"));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- server_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ server_redirect_http_url));
EXPECT_EQ(observer.navigation_url(), http_url);
EXPECT_TRUE(observer.navigation_succeeded());
}
@@ -572,8 +549,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
Source<NavigationController>(
&shell()->web_contents()->GetController()));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- client_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ client_redirect_http_url));
// Same-site Client-Redirect Page should be loaded successfully.
EXPECT_EQ(observer.navigation_url(), client_redirect_http_url);
@@ -620,7 +597,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
Source<NavigationController>(
&shell()->web_contents()->GetController()));
- EXPECT_TRUE(NavigateIframeToURL(shell(), client_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ client_redirect_http_url));
// DidFailProvisionalLoad when navigating to client_redirect_https_url.
load_observer2.Wait();
@@ -635,8 +613,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
"server-redirect?" + http_url.spec()));
GURL server_redirect_http_url(test_server()->GetURL(
"server-redirect?" + server_redirect_https_url.spec()));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
- server_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ server_redirect_http_url));
EXPECT_EQ(observer.navigation_url(), http_url);
EXPECT_TRUE(observer.navigation_succeeded());
}
@@ -648,7 +626,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
"server-redirect?" + https_url.spec()));
GURL server_redirect_http_url(test_server()->GetURL(
"server-redirect?" + server_redirect_https_url.spec()));
- EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ server_redirect_http_url));
// DidFailProvisionalLoad when navigating to https_url.
EXPECT_EQ(observer.navigation_url(), https_url);
@@ -662,7 +641,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
"client-redirect?" + http_url.spec()));
GURL server_redirect_http_url(test_server()->GetURL(
"server-redirect?" + client_redirect_http_url.spec()));
- EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test"));
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "test",
+ server_redirect_http_url));
// DidFailProvisionalLoad when navigating to client_redirect_http_url.
EXPECT_EQ(observer.navigation_url(), client_redirect_http_url);

Powered by Google App Engine
This is Rietveld 408576698