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

Unified Diff: content/browser/frame_host/navigation_handle_impl_browsertest.cc

Issue 2884123002: PlzNavigate: blocked browser-initiated navigations should transfer processes sometimes (Closed)
Patch Set: Phrasing. Created 3 years, 7 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 | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_handle_impl_browsertest.cc
diff --git a/content/browser/frame_host/navigation_handle_impl_browsertest.cc b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
index 892d64c073d6de341f216bc194deb716b3b60e3b..6f8d0334d29c5052a9d815272d94ffc884f253ae 100644
--- a/content/browser/frame_host/navigation_handle_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
@@ -1174,18 +1174,72 @@ IN_PROC_BROWSER_TEST_F(PlzNavigateNavigationHandleImplBrowserTest,
scoped_refptr<SiteInstance> site_instance =
shell()->web_contents()->GetMainFrame()->GetSiteInstance();
- TestNavigationThrottleInstaller installer(
+ auto installer = base::MakeUnique<TestNavigationThrottleInstaller>(
shell()->web_contents(), NavigationThrottle::BLOCK_REQUEST,
NavigationThrottle::PROCEED, NavigationThrottle::PROCEED);
{
+ // A blocked, renderer-initiated navigation should commit an error page
+ // in the process that originated the navigation.
NavigationHandleObserver observer(shell()->web_contents(), blocked_url);
- EXPECT_FALSE(NavigateToURL(shell(), blocked_url));
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+ EXPECT_TRUE(
+ ExecuteScript(shell(), base::StringPrintf("location.href = '%s'",
+ blocked_url.spec().c_str())));
+ navigation_observer.Wait();
+ EXPECT_TRUE(observer.has_committed());
+ EXPECT_TRUE(observer.is_error());
+ EXPECT_EQ(site_instance,
+ shell()->web_contents()->GetMainFrame()->GetSiteInstance());
+ }
+
+ {
+ // Reloading the page should not transfer processes.
+ NavigationHandleObserver observer(shell()->web_contents(), blocked_url);
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+
+ shell()->Reload();
+ navigation_observer.Wait();
EXPECT_TRUE(observer.has_committed());
EXPECT_TRUE(observer.is_error());
EXPECT_EQ(site_instance,
shell()->web_contents()->GetMainFrame()->GetSiteInstance());
}
+
+ installer.reset();
+
+ {
+ // With the throttle uninstalled, going back should return to |start_url| in
+ // the same process, and clear the error page.
+ NavigationHandleObserver observer(shell()->web_contents(), start_url);
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+
+ shell()->GoBackOrForward(-1);
+ navigation_observer.Wait();
+ EXPECT_TRUE(observer.has_committed());
+ EXPECT_FALSE(observer.is_error());
+ EXPECT_EQ(site_instance,
+ shell()->web_contents()->GetMainFrame()->GetSiteInstance());
+ }
+
+ installer = base::MakeUnique<TestNavigationThrottleInstaller>(
+ shell()->web_contents(), NavigationThrottle::BLOCK_REQUEST,
+ NavigationThrottle::PROCEED, NavigationThrottle::PROCEED);
+
+ {
+ // A blocked, browser-initiated navigation should commit an error page in a
+ // different process.
+ NavigationHandleObserver observer(shell()->web_contents(), blocked_url);
+ TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
+
+ EXPECT_FALSE(NavigateToURL(shell(), blocked_url));
+
+ navigation_observer.Wait();
+ EXPECT_TRUE(observer.has_committed());
+ EXPECT_TRUE(observer.is_error());
+ EXPECT_NE(site_instance,
+ shell()->web_contents()->GetMainFrame()->GetSiteInstance());
+ }
}
// Test to verify that error pages caused by network error or other
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698