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

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

Issue 1672373002: Don't rely on the pending NavigationEntry for location.replace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug numbers Created 4 years, 10 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
Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index 4e7c85c89b00fe94840c433b6fa06e8cfff6ef18..5d1715e628fa9dcf09b29338455525fbb42a60e1 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -653,15 +653,15 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
NavigateToURL(shell(), GURL(url::kAboutBlankURL));
EXPECT_EQ(3, controller.GetEntryCount());
- // ... and replace it with a failed load. (Note that when you set the
- // should_replace_current_entry flag, the navigation is classified as NEW_PAGE
- // because that is a classification of the renderer's behavior, and the flag
- // is a browser-side flag.)
+ // ... and replace it with a failed load.
+ // TODO(creis): Make this be NEW_PAGE along with the other location.replace
+ // cases. There isn't much impact to having this be EXISTING_PAGE for now.
+ // See https://crbug.com/317872.
{
FrameNavigateParamsCapturer capturer(root);
NavigateToURLAndReplace(shell(), error_url);
capturer.Wait();
- EXPECT_EQ(NAVIGATION_TYPE_NEW_PAGE, capturer.details().type);
+ EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type);
NavigationEntry* entry = controller.GetLastCommittedEntry();
EXPECT_EQ(PAGE_TYPE_ERROR, entry->GetPageType());
EXPECT_EQ(3, controller.GetEntryCount());
@@ -761,6 +761,20 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
EXPECT_EQ(NAVIGATION_TYPE_NEW_PAGE, capturer.details().type);
EXPECT_TRUE(capturer.details().is_in_page);
}
+
+ if (AreAllSitesIsolatedForTesting()) {
+ // Cross-process location.replace().
+ FrameNavigateParamsCapturer capturer(root);
+ GURL frame_url(embedded_test_server()->GetURL(
+ "foo.com", "/navigation_controller/simple_page_1.html"));
+ std::string script = "location.replace('" + frame_url.spec() + "')";
+ EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
+ capturer.Wait();
+ EXPECT_EQ(ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_CLIENT_REDIRECT,
+ capturer.params().transition);
+ EXPECT_EQ(NAVIGATION_TYPE_NEW_PAGE, capturer.details().type);
+ EXPECT_FALSE(capturer.details().is_in_page);
+ }
}
// Verify that navigations for NAVIGATION_TYPE_EXISTING_PAGE are correctly
@@ -884,6 +898,8 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
{
// location.replace().
+ // TODO(creis): Change this to be NEW_PAGE with replacement in
+ // https://crbug.com/317872.
FrameNavigateParamsCapturer capturer(root);
GURL frame_url(embedded_test_server()->GetURL(
"/navigation_controller/simple_page_1.html"));

Powered by Google App Engine
This is Rietveld 408576698