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

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

Issue 2188283002: Add regression test for an aborting navigation losing its nav_entry_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments Created 4 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9aacb49b0e91ef4143019bde521851eae795c131..c49846cf376a6df6dada3efe4bbb8b171a98bf92 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -5011,6 +5011,35 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
GURL(exploded_state.top.children.at(0).url_string.string()));
}
+// Start a provisional navigation, but abort it by going back before it commits.
+// In crbug.com/631617 there was an issue which cleared the
+// pending_navigation_params_ in RenderFrameImpl. This caused the interrupting
+// navigation to lose important navigation data like its nav_entry_id, which
+// could cause it to commit in-place instead of in the correct location in the
+// browsing history.
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
+ AbortProvisionalLoadRetainsNavigationParams) {
+ EXPECT_TRUE(
+ NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
+ EXPECT_TRUE(
+ NavigateToURL(shell(), embedded_test_server()->GetURL("/title2.html")));
+
+ TestNavigationManager delayer(shell()->web_contents(),
+ embedded_test_server()->GetURL("/title3.html"));
+ shell()->LoadURL(embedded_test_server()->GetURL("/title3.html"));
+ delayer.WaitForWillStartRequest();
+
+ NavigationController& controller = shell()->web_contents()->GetController();
+
+ TestNavigationManager back_manager(
+ shell()->web_contents(), embedded_test_server()->GetURL("/title1.html"));
+ controller.GoBack();
+ back_manager.WaitForNavigationFinished();
+
+ EXPECT_TRUE(controller.CanGoForward());
+ EXPECT_EQ(0, controller.GetCurrentEntryIndex());
+}
+
// Ensure that we do not corrupt a NavigationEntry's PageState if two forward
// navigations compete in different frames. See https://crbug.com/623319.
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698