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 |