| OLD | NEW |
| 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/profile_sync_service_mock.h" | 5 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/prefs/testing_pref_store.h" | 8 #include "base/prefs/testing_pref_store.h" |
| 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
| 11 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 11 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 12 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 12 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
| 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 17 #include "components/signin/core/browser/signin_manager.h" | 17 #include "components/signin/core/browser/signin_manager.h" |
| 18 | 18 |
| 19 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile) | 19 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile) |
| 20 : ProfileSyncServiceMock( | 20 : ProfileSyncServiceMock( |
| 21 scoped_ptr<ProfileSyncComponentsFactory>( | 21 scoped_ptr<sync_driver::SyncApiComponentFactory>( |
| 22 new ProfileSyncComponentsFactoryMock()), | 22 new ProfileSyncComponentsFactoryMock()), |
| 23 profile) { | 23 profile) { |
| 24 } | 24 } |
| 25 | 25 |
| 26 ProfileSyncServiceMock::ProfileSyncServiceMock( | 26 ProfileSyncServiceMock::ProfileSyncServiceMock( |
| 27 scoped_ptr<ProfileSyncComponentsFactory> factory, Profile* profile) | 27 scoped_ptr<sync_driver::SyncApiComponentFactory> factory, Profile* profile) |
| 28 : ProfileSyncService( | 28 : ProfileSyncService( |
| 29 factory.Pass(), | 29 factory.Pass(), |
| 30 profile, | 30 profile, |
| 31 make_scoped_ptr(new SupervisedUserSigninManagerWrapper( | 31 make_scoped_ptr(new SupervisedUserSigninManagerWrapper( |
| 32 profile, | 32 profile, |
| 33 SigninManagerFactory::GetForProfile(profile))), | 33 SigninManagerFactory::GetForProfile(profile))), |
| 34 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 34 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 35 browser_sync::MANUAL_START) { | 35 browser_sync::MANUAL_START) { |
| 36 ON_CALL(*this, IsSyncRequested()).WillByDefault(testing::Return(true)); | 36 ON_CALL(*this, IsSyncRequested()).WillByDefault(testing::Return(true)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 ProfileSyncServiceMock::~ProfileSyncServiceMock() { | 39 ProfileSyncServiceMock::~ProfileSyncServiceMock() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { | 43 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { |
| 44 TestingProfile* profile = new TestingProfile(); | 44 TestingProfile* profile = new TestingProfile(); |
| 45 SigninManagerFactory::GetForProfile(profile)-> | 45 SigninManagerFactory::GetForProfile(profile)-> |
| 46 SetAuthenticatedAccountInfo("12345", "foo"); | 46 SetAuthenticatedAccountInfo("12345", "foo"); |
| 47 return profile; | 47 return profile; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 scoped_ptr<KeyedService> ProfileSyncServiceMock::BuildMockProfileSyncService( | 51 scoped_ptr<KeyedService> ProfileSyncServiceMock::BuildMockProfileSyncService( |
| 52 content::BrowserContext* profile) { | 52 content::BrowserContext* profile) { |
| 53 return make_scoped_ptr( | 53 return make_scoped_ptr( |
| 54 new ProfileSyncServiceMock(static_cast<Profile*>(profile))); | 54 new ProfileSyncServiceMock(static_cast<Profile*>(profile))); |
| 55 } | 55 } |
| OLD | NEW |