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

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

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to include the update to ProfileSyncService: r224220 Created 7 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 (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 "chrome/browser/sync/test_profile_sync_service.h" 5 #include "chrome/browser/sync/test_profile_sync_service.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/signin/signin_manager.h" 8 #include "chrome/browser/signin/signin_manager.h"
9 #include "chrome/browser/signin/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/browser/sync/glue/data_type_controller.h" 10 #include "chrome/browser/sync/glue/data_type_controller.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 syncer::WeakHandle<syncer::JsEventHandler> 202 syncer::WeakHandle<syncer::JsEventHandler>
203 TestProfileSyncService::GetJsEventHandler() { 203 TestProfileSyncService::GetJsEventHandler() {
204 return syncer::WeakHandle<syncer::JsEventHandler>(); 204 return syncer::WeakHandle<syncer::JsEventHandler>();
205 } 205 }
206 206
207 TestProfileSyncService::TestProfileSyncService( 207 TestProfileSyncService::TestProfileSyncService(
208 ProfileSyncComponentsFactory* factory, 208 ProfileSyncComponentsFactory* factory,
209 Profile* profile, 209 Profile* profile,
210 SigninManagerBase* signin, 210 SigninManagerBase* signin,
211 OAuth2TokenService* oauth2_token_service, 211 ProfileOAuth2TokenService* oauth2_token_service,
212 ProfileSyncService::StartBehavior behavior, 212 ProfileSyncService::StartBehavior behavior,
213 bool synchronous_backend_initialization) 213 bool synchronous_backend_initialization)
214 : ProfileSyncService(factory, 214 : ProfileSyncService(factory,
215 profile, 215 profile,
216 signin, 216 signin,
217 oauth2_token_service, 217 oauth2_token_service,
218 behavior), 218 behavior),
219 synchronous_backend_initialization_( 219 synchronous_backend_initialization_(
220 synchronous_backend_initialization), 220 synchronous_backend_initialization),
221 synchronous_sync_configuration_(false), 221 synchronous_sync_configuration_(false),
222 set_initial_sync_ended_on_init_(true), 222 set_initial_sync_ended_on_init_(true),
223 fail_initial_download_(false), 223 fail_initial_download_(false),
224 storage_option_(syncer::STORAGE_IN_MEMORY) { 224 storage_option_(syncer::STORAGE_IN_MEMORY) {
225 SetSyncSetupCompleted(); 225 SetSyncSetupCompleted();
226 } 226 }
227 227
228 TestProfileSyncService::~TestProfileSyncService() { 228 TestProfileSyncService::~TestProfileSyncService() {
229 } 229 }
230 230
231 // static 231 // static
232 BrowserContextKeyedService* TestProfileSyncService::BuildAutoStartAsyncInit( 232 BrowserContextKeyedService* TestProfileSyncService::BuildAutoStartAsyncInit(
233 content::BrowserContext* context) { 233 content::BrowserContext* context) {
234 Profile* profile = static_cast<Profile*>(context); 234 Profile* profile = static_cast<Profile*>(context);
235 SigninManagerBase* signin = 235 SigninManagerBase* signin =
236 SigninManagerFactory::GetForProfile(profile); 236 SigninManagerFactory::GetForProfile(profile);
237 OAuth2TokenService* oauth2_token_service = 237 ProfileOAuth2TokenService* oauth2_token_service =
238 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 238 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
239 ProfileSyncComponentsFactoryMock* factory = 239 ProfileSyncComponentsFactoryMock* factory =
240 new ProfileSyncComponentsFactoryMock(); 240 new ProfileSyncComponentsFactoryMock();
241 return new TestProfileSyncService(factory, 241 return new TestProfileSyncService(factory,
242 profile, 242 profile,
243 signin, 243 signin,
244 oauth2_token_service, 244 oauth2_token_service,
245 ProfileSyncService::AUTO_START, 245 ProfileSyncService::AUTO_START,
246 false); 246 false);
247 } 247 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 sync_prefs_.AsWeakPtr(), 315 sync_prefs_.AsWeakPtr(),
316 id_factory_, 316 id_factory_,
317 callback_, 317 callback_,
318 set_initial_sync_ended_on_init_, 318 set_initial_sync_ended_on_init_,
319 synchronous_backend_initialization_, 319 synchronous_backend_initialization_,
320 fail_initial_download_, 320 fail_initial_download_,
321 storage_option_)); 321 storage_option_));
322 } 322 }
323 323
324 scoped_ptr<OAuth2TokenService::Request> FakeOAuth2TokenService::StartRequest( 324 scoped_ptr<OAuth2TokenService::Request> FakeOAuth2TokenService::StartRequest(
325 const std::string& account_id,
325 const OAuth2TokenService::ScopeSet& scopes, 326 const OAuth2TokenService::ScopeSet& scopes,
326 OAuth2TokenService::Consumer* consumer) { 327 OAuth2TokenService::Consumer* consumer) {
327 // Ensure token in question is cached and never expires. Request will succeed 328 // Ensure token in question is cached and never expires. Request will succeed
328 // without network IO. 329 // without network IO.
329 RegisterCacheEntry("test_client_id", 330 RegisterCacheEntry("test_client_id",
330 GetRefreshToken(), 331 account_id,
331 scopes, 332 scopes,
332 "access_token", 333 "access_token",
333 base::Time::Max()); 334 base::Time::Max());
334 return ProfileOAuth2TokenService::StartRequest(scopes, consumer); 335 return ProfileOAuth2TokenService::StartRequest(account_id, scopes, consumer);
335 } 336 }
336 337
337 BrowserContextKeyedService* FakeOAuth2TokenService::BuildTokenService( 338 BrowserContextKeyedService* FakeOAuth2TokenService::BuildTokenService(
338 content::BrowserContext* context) { 339 content::BrowserContext* context) {
339 Profile* profile = static_cast<Profile*>(context); 340 Profile* profile = static_cast<Profile*>(context);
340 341
341 FakeOAuth2TokenService* service = new FakeOAuth2TokenService(); 342 FakeOAuth2TokenService* service = new FakeOAuth2TokenService();
342 service->Initialize(profile); 343 service->Initialize(profile);
343 return service; 344 return service;
344 } 345 }
346
347 void FakeOAuth2TokenService::PersistCredentials(
348 const std::string& account_id,
349 const std::string& refresh_token) {
350 // Disabling the token persistence.
351 }
352
353 void FakeOAuth2TokenService::ClearPersistedCredentials(
354 const std::string& account_id) {
355 // Disabling the token persistence.
356 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.h ('k') | chrome/browser/sync_file_system/drive_backend_v1/api_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698