Chromium Code Reviews| 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/chrome_sync_client.h" | 11 #include "chrome/browser/sync/chrome_sync_client.h" |
| 12 #include "chrome/browser/sync/profile_sync_test_util.h" | 12 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 13 #include "chrome/common/channel_info.h" | 13 #include "chrome/common/channel_info.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 17 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 18 #include "components/signin/core/browser/signin_manager.h" | 18 #include "components/signin/core/browser/signin_manager.h" |
| 19 #include "components/sync_driver/signin_manager_wrapper.h" | 19 #include "components/sync_driver/signin_manager_wrapper.h" |
| 20 #include "components/sync_driver/sync_api_component_factory_mock.h" | 20 #include "components/sync_driver/sync_api_component_factory_mock.h" |
| 21 | 21 |
| 22 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile) | 22 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile) |
| 23 : ProfileSyncServiceMock( | 23 : ProfileSyncServiceMock( |
| 24 make_scoped_ptr( | 24 make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)), |
| 25 new browser_sync::ChromeSyncClient( | |
| 26 profile, | |
| 27 make_scoped_ptr(new SyncApiComponentFactoryMock()))) | |
| 28 .Pass(), | |
| 29 profile) {} | 25 profile) {} |
| 30 | 26 |
| 31 ProfileSyncServiceMock::ProfileSyncServiceMock( | 27 ProfileSyncServiceMock::ProfileSyncServiceMock( |
| 32 scoped_ptr<sync_driver::SyncClient> sync_client, | 28 scoped_ptr<sync_driver::SyncClient> sync_client, |
| 33 Profile* profile) | 29 Profile* profile) |
| 34 : ProfileSyncService( | 30 : ProfileSyncService( |
| 35 sync_client.Pass(), | 31 sync_client.Pass(), |
| 36 make_scoped_ptr(new SigninManagerWrapper( | 32 make_scoped_ptr(new SigninManagerWrapper( |
| 37 SigninManagerFactory::GetForProfile(profile))), | 33 SigninManagerFactory::GetForProfile(profile))), |
| 38 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 34 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 57 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { | 53 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { |
| 58 TestingProfile* profile = new TestingProfile(); | 54 TestingProfile* profile = new TestingProfile(); |
| 59 SigninManagerFactory::GetForProfile(profile)-> | 55 SigninManagerFactory::GetForProfile(profile)-> |
| 60 SetAuthenticatedAccountInfo("12345", "foo"); | 56 SetAuthenticatedAccountInfo("12345", "foo"); |
| 61 return profile; | 57 return profile; |
| 62 } | 58 } |
| 63 | 59 |
| 64 // static | 60 // static |
| 65 scoped_ptr<KeyedService> ProfileSyncServiceMock::BuildMockProfileSyncService( | 61 scoped_ptr<KeyedService> ProfileSyncServiceMock::BuildMockProfileSyncService( |
| 66 content::BrowserContext* profile) { | 62 content::BrowserContext* profile) { |
| 67 return make_scoped_ptr( | 63 scoped_ptr<ProfileSyncServiceMock> sync_service( |
| 68 new ProfileSyncServiceMock(static_cast<Profile*>(profile))); | 64 new ProfileSyncServiceMock(static_cast<Profile*>(profile))); |
| 65 sync_service->GetSyncClient()->Initialize( | |
|
blundell
2015/11/13 09:33:56
nit: Any reason not to put this in the constructor
Nicolas Zea
2015/11/14 00:52:26
This has been removed.
| |
| 66 make_scoped_ptr(new SyncApiComponentFactoryMock()), sync_service.get()); | |
| 67 return sync_service.Pass(); | |
| 69 } | 68 } |
| OLD | NEW |