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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sessions/tab_restore_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/stringprintf.h" 5 #include "base/stringprintf.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/sessions/session_types.h" 7 #include "chrome/browser/sessions/session_types.h"
8 #include "chrome/browser/sessions/session_service.h" 8 #include "chrome/browser/sessions/session_service.h"
9 #include "chrome/browser/sessions/session_service_factory.h" 9 #include "chrome/browser/sessions/session_service_factory.h"
10 #include "chrome/browser/sessions/tab_restore_service.h" 10 #include "chrome/browser/sessions/tab_restore_service.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 tab->navigations.push_back(navigation); 609 tab->navigations.push_back(navigation);
610 tab->navigations.push_back(navigation); 610 tab->navigations.push_back(navigation);
611 service_->entries_.push_front(tab); 611 service_->entries_.push_front(tab);
612 EXPECT_EQ(max_entries, service_->entries_.size()); 612 EXPECT_EQ(max_entries, service_->entries_.size());
613 service_->PruneEntries(); 613 service_->PruneEntries();
614 EXPECT_EQ(max_entries, service_->entries_.size()); 614 EXPECT_EQ(max_entries, service_->entries_.size());
615 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 615 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
616 static_cast<Tab*>(service_->entries_.front())-> 616 static_cast<Tab*>(service_->entries_.front())->
617 navigations[1].virtual_url()); 617 navigations[1].virtual_url());
618 } 618 }
619
620 // Regression test for crbug.com/106082
621 TEST_F(TabRestoreServiceTest, PruneIsCalled) {
622 CreateSessionServiceWithOneWindow(false);
623
624 SessionServiceFactory::GetForProfile(profile())->
625 MoveCurrentSessionToLastSession();
626
627 profile()->set_restored_last_session(true);
628
629 const size_t max_entries = TabRestoreService::kMaxEntries;
630 for (size_t i = 0; i < max_entries + 5; i++) {
631 NavigateAndCommit(GURL(StringPrintf("http://%d", static_cast<int>(i))));
632 service_->CreateHistoricalTab(&controller(), -1);
633 }
634
635 EXPECT_EQ(max_entries, service_->entries_.size());
636 // This should not crash.
637 service_->LoadTabsFromLastSession();
638 EXPECT_EQ(max_entries, service_->entries_.size());
639 }
OLDNEW
« 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