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

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: Rebase Created 5 years, 11 months 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
« no previous file with comments | « content/browser/site_per_process_browsertest.h ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d905c9f063ec91d1e3eaa55f379958f6f04567d1..26b882d68b201bf964851eb4d35efabf226ec43d 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -216,30 +216,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()));
- if (!ExecuteScript(window->web_contents(), script))
- return false;
- load_observer.Wait();
-
- return true;
-}
-
void SitePerProcessBrowserTest::SetUpCommandLine(
base::CommandLine* command_line) {
command_line->AppendSwitch(switches::kSitePerProcess);
@@ -378,7 +354,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());
@@ -515,9 +491,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 =
@@ -591,8 +566,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());
@@ -603,8 +578,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());
}
@@ -614,8 +589,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());
@@ -626,8 +601,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());
@@ -644,8 +619,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);
@@ -662,8 +637,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());
}
@@ -678,8 +653,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);
@@ -726,7 +701,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();
@@ -741,8 +717,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());
}
@@ -754,7 +730,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);
@@ -768,7 +745,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);
« no previous file with comments | « content/browser/site_per_process_browsertest.h ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698