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

Unified Diff: content/browser/web_contents/navigation_controller_impl_unittest.cc

Issue 12552005: Also update the session history in the renderer when the active entry is a new pending entry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 7 years, 9 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 | « content/browser/web_contents/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/navigation_controller_impl_unittest.cc
diff --git a/content/browser/web_contents/navigation_controller_impl_unittest.cc b/content/browser/web_contents/navigation_controller_impl_unittest.cc
index 1d698b3dede369d431d87265cbd37e4b68e85bd9..0f25e2ea97675eb419a9091b18bf1f03f357cb2d 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -2970,7 +2970,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForIntermediate) {
EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url2);
}
-// Test call to PruneAllButActive for intermediate entry.
+// Test call to PruneAllButActive for a pending entry.
TEST_F(NavigationControllerTest, PruneAllButActiveForPending) {
NavigationControllerImpl& controller = controller_impl();
const GURL url1("http://foo/1");
@@ -2991,6 +2991,41 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForPending) {
EXPECT_EQ(0, controller.GetPendingEntryIndex());
}
+// Test call to PruneAllButActive for a pending entry that is not yet in the
+// list of entries.
+TEST_F(NavigationControllerTest, PruneAllButActiveForPendingNotInList) {
+ NavigationControllerImpl& controller = controller_impl();
+ const GURL url1("http://foo/1");
+ const GURL url2("http://foo/2");
+ const GURL url3("http://foo/3");
+
+ NavigateAndCommit(url1);
+ NavigateAndCommit(url2);
+
+ // Create a pending entry that is not in the entry list.
+ controller.LoadURL(
+ url3, Referrer(), PAGE_TRANSITION_TYPED, std::string());
+ EXPECT_TRUE(controller.GetPendingEntry());
+ EXPECT_EQ(2, controller.GetEntryCount());
+
+ contents()->ExpectSetHistoryLengthAndPrune(
+ NULL, 0, controller.GetPendingEntry()->GetPageID());
+ controller.PruneAllButActive();
+
+ // We should only have the pending entry at this point, and it should still
+ // not be in the entry list.
+ EXPECT_EQ(-1, controller.GetPendingEntryIndex());
+ EXPECT_TRUE(controller.GetPendingEntry());
+ EXPECT_EQ(0, controller.GetEntryCount());
+
+ // Try to commit the pending entry.
+ test_rvh()->SendNavigate(2, url3);
+ EXPECT_EQ(-1, controller.GetPendingEntryIndex());
+ EXPECT_FALSE(controller.GetPendingEntry());
+ EXPECT_EQ(1, controller.GetEntryCount());
+ EXPECT_EQ(url3, controller.GetEntryAtIndex(0)->GetURL());
+}
+
// Test call to PruneAllButActive for transient entry.
TEST_F(NavigationControllerTest, PruneAllButActiveForTransient) {
NavigationControllerImpl& controller = controller_impl();
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698