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

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: 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..c7a042494610ea98bb3b62c476c253706ff808e7 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(), url, "test");
EXPECT_TRUE(observer.navigation_succeeded());
EXPECT_EQ(url, observer.navigation_url());
@@ -409,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrashSubframe) {
// Load cross-site page into iframe.
EXPECT_TRUE(NavigateIframeToURL(
- shell(),
+ shell()->web_contents(),
embedded_test_server()->GetURL("/cross-site/foo.com/title2.html"),
"test"));
@@ -485,7 +463,7 @@ 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(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
client_redirect_https_url, "test"));
// DidFailProvisionalLoad when navigating to client_redirect_https_url.
EXPECT_EQ(observer.navigation_url(), client_redirect_https_url);
@@ -497,7 +475,7 @@ 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(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
server_redirect_http_url, "test"));
EXPECT_EQ(observer.navigation_url(), http_url);
EXPECT_TRUE(observer.navigation_succeeded());
@@ -508,7 +486,7 @@ 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(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
server_redirect_http_url, "test"));
// DidFailProvisionalLoad when navigating to https_url.
EXPECT_EQ(observer.navigation_url(), https_url);
@@ -520,7 +498,7 @@ 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(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
server_redirect_http_url, "test"));
EXPECT_EQ(observer.navigation_url(), https_url);
@@ -538,7 +516,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
Source<NavigationController>(
&shell()->web_contents()->GetController()));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
client_redirect_http_url, "test"));
// Same-site Client-Redirect Page should be loaded successfully.
@@ -556,7 +534,7 @@ 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(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
server_redirect_http_url, "test"));
EXPECT_EQ(observer.navigation_url(), http_url);
EXPECT_TRUE(observer.navigation_succeeded());
@@ -572,7 +550,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
Source<NavigationController>(
&shell()->web_contents()->GetController()));
- EXPECT_TRUE(NavigateIframeToURL(shell(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
client_redirect_http_url, "test"));
// Same-site Client-Redirect Page should be loaded successfully.
@@ -620,7 +598,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(),
+ client_redirect_http_url, "test"));
// DidFailProvisionalLoad when navigating to client_redirect_https_url.
load_observer2.Wait();
@@ -635,7 +614,7 @@ 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(),
+ EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(),
server_redirect_http_url, "test"));
EXPECT_EQ(observer.navigation_url(), http_url);
EXPECT_TRUE(observer.navigation_succeeded());
@@ -648,7 +627,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(),
+ server_redirect_http_url, "test"));
// DidFailProvisionalLoad when navigating to https_url.
EXPECT_EQ(observer.navigation_url(), https_url);
@@ -662,7 +642,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(),
+ server_redirect_http_url, "test"));
// 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