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

Unified Diff: chrome/browser/sessions/tab_restore_service_browsertest.cc

Issue 8776018: fix tab restore service crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: always prune Created 9 years 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 | « chrome/browser/sessions/tab_restore_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/tab_restore_service_browsertest.cc
diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc
index b11738bea2e54d00c76c440b7ef81726b35cdfc8..c495361705b294b9bf9b17d2ba3fbc4d6938b169 100644
--- a/chrome/browser/sessions/tab_restore_service_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc
@@ -616,3 +616,24 @@ TEST_F(TabRestoreServiceTest, PruneEntries) {
static_cast<Tab*>(service_->entries_.front())->
navigations[1].virtual_url());
}
+
+// Regression test for crbug.com/106082
+TEST_F(TabRestoreServiceTest, PruneIsCalled) {
+ CreateSessionServiceWithOneWindow(false);
+
+ SessionServiceFactory::GetForProfile(profile())->
+ MoveCurrentSessionToLastSession();
+
+ profile()->set_restored_last_session(true);
+
+ const size_t max_entries = TabRestoreService::kMaxEntries;
+ for (size_t i = 0; i < max_entries + 5; i++) {
+ NavigateAndCommit(GURL(StringPrintf("http://%d", static_cast<int>(i))));
+ service_->CreateHistoricalTab(&controller(), -1);
+ }
+
+ EXPECT_EQ(max_entries, service_->entries_.size());
+ // This should not crash.
+ service_->LoadTabsFromLastSession();
+ EXPECT_EQ(max_entries, service_->entries_.size());
+}
« no previous file with comments | « chrome/browser/sessions/tab_restore_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698