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

Side by Side Diff: chrome/browser/sync/profile_sync_service_startup_unittest.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 5 #include <utility>
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void TearDown() override { sync_->RemoveObserver(&observer_); } 158 void TearDown() override { sync_->RemoveObserver(&observer_); }
159 159
160 static scoped_ptr<KeyedService> BuildService( 160 static scoped_ptr<KeyedService> BuildService(
161 content::BrowserContext* browser_context) { 161 content::BrowserContext* browser_context) {
162 Profile* profile = static_cast<Profile*>(browser_context); 162 Profile* profile = static_cast<Profile*>(browser_context);
163 scoped_ptr<browser_sync::ChromeSyncClient> sync_client( 163 scoped_ptr<browser_sync::ChromeSyncClient> sync_client(
164 new browser_sync::ChromeSyncClient(profile)); 164 new browser_sync::ChromeSyncClient(profile));
165 sync_client->SetSyncApiComponentFactoryForTesting( 165 sync_client->SetSyncApiComponentFactoryForTesting(
166 make_scoped_ptr(new SyncApiComponentFactoryMock())); 166 make_scoped_ptr(new SyncApiComponentFactoryMock()));
167 return make_scoped_ptr(new TestProfileSyncServiceNoBackup( 167 return make_scoped_ptr(new TestProfileSyncServiceNoBackup(
168 sync_client.Pass(), profile, 168 std::move(sync_client), profile,
169 make_scoped_ptr(new SigninManagerWrapper( 169 make_scoped_ptr(new SigninManagerWrapper(
170 SigninManagerFactory::GetForProfile(profile))), 170 SigninManagerFactory::GetForProfile(profile))),
171 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 171 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
172 browser_sync::MANUAL_START)); 172 browser_sync::MANUAL_START));
173 } 173 }
174 174
175 void CreateSyncService() { 175 void CreateSyncService() {
176 sync_ = static_cast<ProfileSyncService*>( 176 sync_ = static_cast<ProfileSyncService*>(
177 ProfileSyncServiceFactory::GetForProfile(profile_)); 177 ProfileSyncServiceFactory::GetForProfile(profile_));
178 sync_->AddObserver(&observer_); 178 sync_->AddObserver(&observer_);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 SigninManagerFactory::GetForProfile(profile)); 265 SigninManagerFactory::GetForProfile(profile));
266 SimulateTestUserSignin(profile, signin, nullptr); 266 SimulateTestUserSignin(profile, signin, nullptr);
267 ProfileOAuth2TokenService* oauth2_token_service = 267 ProfileOAuth2TokenService* oauth2_token_service =
268 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 268 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
269 EXPECT_TRUE(signin->IsAuthenticated()); 269 EXPECT_TRUE(signin->IsAuthenticated());
270 scoped_ptr<browser_sync::ChromeSyncClient> sync_client( 270 scoped_ptr<browser_sync::ChromeSyncClient> sync_client(
271 new browser_sync::ChromeSyncClient(profile)); 271 new browser_sync::ChromeSyncClient(profile));
272 sync_client->SetSyncApiComponentFactoryForTesting( 272 sync_client->SetSyncApiComponentFactoryForTesting(
273 make_scoped_ptr(new SyncApiComponentFactoryMock())); 273 make_scoped_ptr(new SyncApiComponentFactoryMock()));
274 return make_scoped_ptr(new TestProfileSyncServiceNoBackup( 274 return make_scoped_ptr(new TestProfileSyncServiceNoBackup(
275 sync_client.Pass(), profile, 275 std::move(sync_client), profile,
276 make_scoped_ptr(new SigninManagerWrapper(signin)), oauth2_token_service, 276 make_scoped_ptr(new SigninManagerWrapper(signin)), oauth2_token_service,
277 browser_sync::AUTO_START)); 277 browser_sync::AUTO_START));
278 } 278 }
279 }; 279 };
280 280
281 TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { 281 TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
282 // We've never completed startup. 282 // We've never completed startup.
283 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 283 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
284 CreateSyncService(); 284 CreateSyncService();
285 SetUpSyncBackendHost(); 285 SetUpSyncBackendHost();
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 595 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
596 596
597 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 597 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
598 sync_->Initialize(); 598 sync_->Initialize();
599 599
600 sync_->SetSetupInProgress(true); 600 sync_->SetSetupInProgress(true);
601 IssueTestTokens(account_id); 601 IssueTestTokens(account_id);
602 sync_->SetSetupInProgress(false); 602 sync_->SetSetupInProgress(false);
603 EXPECT_FALSE(sync_->IsSyncActive()); 603 EXPECT_FALSE(sync_->IsSyncActive());
604 } 604 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698