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

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

Issue 334713008: Use AttachmentUploadImpl instead of FakeAttachmentUploader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Apply CR feedback from tim. Created 6 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 | Annotate | Revision Log
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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/prefs/pref_service_syncable.h" 9 #include "chrome/browser/prefs/pref_service_syncable.h"
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 virtual void TearDown() { 95 virtual void TearDown() {
96 sync_->RemoveObserver(&observer_); 96 sync_->RemoveObserver(&observer_);
97 } 97 }
98 98
99 static KeyedService* BuildService(content::BrowserContext* browser_context) { 99 static KeyedService* BuildService(content::BrowserContext* browser_context) {
100 Profile* profile = static_cast<Profile*>(browser_context); 100 Profile* profile = static_cast<Profile*>(browser_context);
101 return new ProfileSyncService( 101 return new ProfileSyncService(
102 new ProfileSyncComponentsFactoryMock(), 102 new ProfileSyncComponentsFactoryMock(),
103 profile, 103 profile,
104 new ManagedUserSigninManagerWrapper( 104 make_scoped_ptr(new ManagedUserSigninManagerWrapper(
105 profile, SigninManagerFactory::GetForProfile(profile)), 105 profile, SigninManagerFactory::GetForProfile(profile))),
106 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 106 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
107 browser_sync::MANUAL_START); 107 browser_sync::MANUAL_START);
108 } 108 }
109 109
110 void CreateSyncService() { 110 void CreateSyncService() {
111 sync_ = static_cast<ProfileSyncService*>( 111 sync_ = static_cast<ProfileSyncService*>(
112 ProfileSyncServiceFactory::GetForProfile(profile_)); 112 ProfileSyncServiceFactory::GetForProfile(profile_));
113 sync_->AddObserver(&observer_); 113 sync_->AddObserver(&observer_);
114 } 114 }
115 115
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 SigninManagerFactory::GetForProfile(profile); 178 SigninManagerFactory::GetForProfile(profile);
179 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, 179 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
180 "test_user@gmail.com"); 180 "test_user@gmail.com");
181 signin->SetAuthenticatedUsername("test_user@gmail.com"); 181 signin->SetAuthenticatedUsername("test_user@gmail.com");
182 ProfileOAuth2TokenService* oauth2_token_service = 182 ProfileOAuth2TokenService* oauth2_token_service =
183 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 183 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
184 EXPECT_FALSE(signin->GetAuthenticatedUsername().empty()); 184 EXPECT_FALSE(signin->GetAuthenticatedUsername().empty());
185 return new ProfileSyncService( 185 return new ProfileSyncService(
186 new ProfileSyncComponentsFactoryMock(), 186 new ProfileSyncComponentsFactoryMock(),
187 profile, 187 profile,
188 new ManagedUserSigninManagerWrapper(profile, signin), 188 make_scoped_ptr(new ManagedUserSigninManagerWrapper(profile, signin)),
189 oauth2_token_service, 189 oauth2_token_service,
190 browser_sync::AUTO_START); 190 browser_sync::AUTO_START);
191 } 191 }
192 }; 192 };
193 193
194 TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { 194 TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
195 // We've never completed startup. 195 // We've never completed startup.
196 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 196 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
197 CreateSyncService(); 197 CreateSyncService();
198 SetUpSyncBackendHost(); 198 SetUpSyncBackendHost();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 519 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
520 520
521 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 521 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
522 sync_->Initialize(); 522 sync_->Initialize();
523 523
524 sync_->SetSetupInProgress(true); 524 sync_->SetSetupInProgress(true);
525 IssueTestTokens(); 525 IssueTestTokens();
526 sync_->SetSetupInProgress(false); 526 sync_->SetSetupInProgress(false);
527 EXPECT_FALSE(sync_->sync_initialized()); 527 EXPECT_FALSE(sync_->sync_initialized());
528 } 528 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_mock.cc ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698