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

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

Issue 19699007: Ensure we don't crash if user navigates back from NTP to Chrome sign-in page before it has fully lo… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing indent. Created 7 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/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 2c327f294307002a5d55619bf52da10bfd0510df..a1904d04e2de3d9da87c046157cdf89cb64bbf2a 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -2398,20 +2398,25 @@ TEST_F(NavigationControllerTest, RemoveEntry) {
test_rvh()->SendNavigate(4, url5);
// Try to remove the last entry. Will fail because it is the current entry.
- controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1);
+ EXPECT_FALSE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1));
EXPECT_EQ(5, controller.GetEntryCount());
EXPECT_EQ(4, controller.GetLastCommittedEntryIndex());
- // Go back and remove the last entry.
+ // Go back, but don't commit yet. Check that we can't delete the current
+ // and pending entries.
controller.GoBack();
+ EXPECT_FALSE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1));
+ EXPECT_FALSE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 2));
+
+ // Now commit and delete the last entry.
test_rvh()->SendNavigate(3, url4);
- controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1);
+ EXPECT_TRUE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1));
EXPECT_EQ(4, controller.GetEntryCount());
EXPECT_EQ(3, controller.GetLastCommittedEntryIndex());
EXPECT_FALSE(controller.GetPendingEntry());
// Remove an entry which is not the last committed one.
- controller.RemoveEntryAtIndex(0);
+ EXPECT_TRUE(controller.RemoveEntryAtIndex(0));
EXPECT_EQ(3, controller.GetEntryCount());
EXPECT_EQ(2, controller.GetLastCommittedEntryIndex());
EXPECT_FALSE(controller.GetPendingEntry());
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl.cc ('k') | content/public/browser/navigation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698