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

Side by Side Diff: chrome/browser/sessions/persistent_tab_restore_service_unittest.cc

Issue 1342743002: Remove Profile and HostDesktopType dependencies from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sessions/persistent_tab_restore_service.h" 5 #include "chrome/browser/sessions/persistent_tab_restore_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 protected: 74 protected:
75 enum { 75 enum {
76 kMaxEntries = TabRestoreServiceHelper::kMaxEntries, 76 kMaxEntries = TabRestoreServiceHelper::kMaxEntries,
77 }; 77 };
78 78
79 // testing::Test: 79 // testing::Test:
80 void SetUp() override { 80 void SetUp() override {
81 ChromeRenderViewHostTestHarness::SetUp(); 81 ChromeRenderViewHostTestHarness::SetUp();
82 time_factory_ = new PersistentTabRestoreTimeFactory(); 82 time_factory_ = new PersistentTabRestoreTimeFactory();
83 service_.reset(new PersistentTabRestoreService( 83 service_.reset(new PersistentTabRestoreService(
84 profile(),
85 make_scoped_ptr(new ChromeTabRestoreServiceClient(profile())), 84 make_scoped_ptr(new ChromeTabRestoreServiceClient(profile())),
86 time_factory_)); 85 time_factory_));
87 } 86 }
88 87
89 void TearDown() override { 88 void TearDown() override {
90 service_->Shutdown(); 89 service_->Shutdown();
91 service_.reset(); 90 service_.reset();
92 delete time_factory_; 91 delete time_factory_;
93 ChromeRenderViewHostTestHarness::TearDown(); 92 ChromeRenderViewHostTestHarness::TearDown();
94 } 93 }
(...skipping 20 matching lines...) Expand all
115 WebContentsTester::For(web_contents())->CommitPendingNavigation(); 114 WebContentsTester::For(web_contents())->CommitPendingNavigation();
116 } 115 }
117 116
118 void RecreateService() { 117 void RecreateService() {
119 // Must set service to null first so that it is destroyed before the new 118 // Must set service to null first so that it is destroyed before the new
120 // one is created. 119 // one is created.
121 service_->Shutdown(); 120 service_->Shutdown();
122 content::RunAllBlockingPoolTasksUntilIdle(); 121 content::RunAllBlockingPoolTasksUntilIdle();
123 service_.reset(); 122 service_.reset();
124 service_.reset(new PersistentTabRestoreService( 123 service_.reset(new PersistentTabRestoreService(
125 profile(),
126 make_scoped_ptr(new ChromeTabRestoreServiceClient(profile())), 124 make_scoped_ptr(new ChromeTabRestoreServiceClient(profile())),
127 time_factory_)); 125 time_factory_));
128 SynchronousLoadTabsFromLastSession(); 126 SynchronousLoadTabsFromLastSession();
129 } 127 }
130 128
131 // Adds a window with one tab and url to the profile's session service. 129 // Adds a window with one tab and url to the profile's session service.
132 // If |pinned| is true, the tab is marked as pinned in the session service. 130 // If |pinned| is true, the tab is marked as pinned in the session service.
133 void AddWindowWithOneTabToSessionService(bool pinned) { 131 void AddWindowWithOneTabToSessionService(bool pinned) {
134 SessionService* session_service = 132 SessionService* session_service =
135 SessionServiceFactory::GetForProfile(profile()); 133 SessionServiceFactory::GetForProfile(profile());
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 760
763 EXPECT_FALSE(service_->IsLoaded()); 761 EXPECT_FALSE(service_->IsLoaded());
764 TestTabRestoreServiceObserver observer; 762 TestTabRestoreServiceObserver observer;
765 service_->AddObserver(&observer); 763 service_->AddObserver(&observer);
766 EXPECT_EQ(max_entries, service_->entries().size()); 764 EXPECT_EQ(max_entries, service_->entries().size());
767 SynchronousLoadTabsFromLastSession(); 765 SynchronousLoadTabsFromLastSession();
768 EXPECT_TRUE(observer.got_loaded()); 766 EXPECT_TRUE(observer.got_loaded());
769 EXPECT_TRUE(service_->IsLoaded()); 767 EXPECT_TRUE(service_->IsLoaded());
770 service_->RemoveObserver(&observer); 768 service_->RemoveObserver(&observer);
771 } 769 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/persistent_tab_restore_service.cc ('k') | chrome/browser/sessions/tab_restore_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698