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

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

Issue 1245433002: Don't clear the forward history when replacing entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix leak Created 5 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
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 ba4a49d1d4de3f05005e651f220a64d46afd8550..80b38051ef66d98e9c01038a9e985041ccf5b70e 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -186,10 +186,31 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
EXPECT_EQ(1, controller.GetEntryCount());
EXPECT_EQ(1, RendererHistoryLength(shell()));
- EXPECT_TRUE(NavigateToURLAndReplace(shell(), GURL("data:text/html,page2")));
+ EXPECT_TRUE(NavigateToURLAndReplace(shell(), GURL("data:text/html,page1a")));
EXPECT_EQ(1, controller.GetEntryCount());
EXPECT_EQ(1, RendererHistoryLength(shell()));
+ // Now create two more entries and go back, to test replacing an entry without
+ // pruning the forward history.
+ EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,page2")));
+ EXPECT_EQ(2, controller.GetEntryCount());
+ EXPECT_EQ(2, RendererHistoryLength(shell()));
+
+ EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,page3")));
+ EXPECT_EQ(3, controller.GetEntryCount());
+ EXPECT_EQ(3, RendererHistoryLength(shell()));
+
+ controller.GoBack();
+ EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
+ controller.GoBack();
+ EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
+ EXPECT_TRUE(controller.CanGoForward());
+
+ EXPECT_TRUE(NavigateToURLAndReplace(shell(), GURL("data:text/html,page1b")));
+ EXPECT_EQ(3, controller.GetEntryCount());
+ EXPECT_EQ(3, RendererHistoryLength(shell()));
+ EXPECT_TRUE(controller.CanGoForward());
+
// Note that there's no way to access the renderer's notion of the history
// offset via JavaScript. Checking just the history length, though, is enough;
// if the replacement failed, there would be a new history entry and thus an

Powered by Google App Engine
This is Rietveld 408576698