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

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

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 years, 6 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/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 window_id, tab_id, 139 window_id, tab_id,
140 SerializedNavigationEntryTestHelper::CreateNavigation( 140 SerializedNavigationEntryTestHelper::CreateNavigation(
141 url1_.spec(), "title")); 141 url1_.spec(), "title"));
142 } 142 }
143 143
144 // Creates a SessionService and assigns it to the Profile. The SessionService 144 // Creates a SessionService and assigns it to the Profile. The SessionService
145 // is configured with a single window with a single tab pointing at url1_ by 145 // is configured with a single window with a single tab pointing at url1_ by
146 // way of AddWindowWithOneTabToSessionService. If |pinned| is true, the 146 // way of AddWindowWithOneTabToSessionService. If |pinned| is true, the
147 // tab is marked as pinned in the session service. 147 // tab is marked as pinned in the session service.
148 void CreateSessionServiceWithOneWindow(bool pinned) { 148 void CreateSessionServiceWithOneWindow(bool pinned) {
149 // The profile takes ownership of this. 149 scoped_ptr<SessionService> session_service(new SessionService(profile()));
150 SessionService* session_service = new SessionService(profile()); 150 SessionServiceFactory::SetForTestProfile(profile(), session_service.Pass());
151 SessionServiceFactory::SetForTestProfile(profile(), session_service);
152 151
153 AddWindowWithOneTabToSessionService(pinned); 152 AddWindowWithOneTabToSessionService(pinned);
154 153
155 // Set this, otherwise previous session won't be loaded. 154 // Set this, otherwise previous session won't be loaded.
156 profile()->set_last_session_exited_cleanly(false); 155 profile()->set_last_session_exited_cleanly(false);
157 } 156 }
158 157
159 void SynchronousLoadTabsFromLastSession() { 158 void SynchronousLoadTabsFromLastSession() {
160 // Ensures that the load is complete before continuing. 159 // Ensures that the load is complete before continuing.
161 service_->LoadTabsFromLastSession(); 160 service_->LoadTabsFromLastSession();
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 754
756 EXPECT_FALSE(service_->IsLoaded()); 755 EXPECT_FALSE(service_->IsLoaded());
757 TestTabRestoreServiceObserver observer; 756 TestTabRestoreServiceObserver observer;
758 service_->AddObserver(&observer); 757 service_->AddObserver(&observer);
759 EXPECT_EQ(max_entries, service_->entries().size()); 758 EXPECT_EQ(max_entries, service_->entries().size());
760 SynchronousLoadTabsFromLastSession(); 759 SynchronousLoadTabsFromLastSession();
761 EXPECT_TRUE(observer.got_loaded()); 760 EXPECT_TRUE(observer.got_loaded());
762 EXPECT_TRUE(service_->IsLoaded()); 761 EXPECT_TRUE(service_->IsLoaded());
763 service_->RemoveObserver(&observer); 762 service_->RemoveObserver(&observer);
764 } 763 }
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service_unittest.cc ('k') | chrome/browser/sessions/session_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698