| 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/test_profile_sync_service.h" | 5 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" |
| 7 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 9 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 11 #include "chrome/browser/signin/signin_manager_factory.h" | 12 #include "chrome/browser/signin/signin_manager_factory.h" |
| 12 #include "chrome/browser/sync/glue/sync_backend_host.h" | 13 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 13 #include "chrome/browser/sync/glue/sync_backend_host_core.h" | 14 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
| 14 #include "chrome/browser/sync/profile_sync_components_factory.h" | 15 #include "chrome/browser/sync/profile_sync_components_factory.h" |
| 15 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 16 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 17 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 signin)), | 121 signin)), |
| 121 oauth2_token_service, | 122 oauth2_token_service, |
| 122 behavior) { | 123 behavior) { |
| 123 SetSyncSetupCompleted(); | 124 SetSyncSetupCompleted(); |
| 124 } | 125 } |
| 125 | 126 |
| 126 TestProfileSyncService::~TestProfileSyncService() { | 127 TestProfileSyncService::~TestProfileSyncService() { |
| 127 } | 128 } |
| 128 | 129 |
| 129 // static | 130 // static |
| 130 KeyedService* TestProfileSyncService::TestFactoryFunction( | 131 scoped_ptr<KeyedService> TestProfileSyncService::TestFactoryFunction( |
| 131 content::BrowserContext* context) { | 132 content::BrowserContext* context) { |
| 132 Profile* profile = static_cast<Profile*>(context); | 133 Profile* profile = static_cast<Profile*>(context); |
| 133 SigninManagerBase* signin = | 134 SigninManagerBase* signin = |
| 134 SigninManagerFactory::GetForProfile(profile); | 135 SigninManagerFactory::GetForProfile(profile); |
| 135 ProfileOAuth2TokenService* oauth2_token_service = | 136 ProfileOAuth2TokenService* oauth2_token_service = |
| 136 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 137 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 137 return new TestProfileSyncService( | 138 return make_scoped_ptr(new TestProfileSyncService( |
| 138 scoped_ptr<ProfileSyncComponentsFactory>( | 139 scoped_ptr<ProfileSyncComponentsFactory>( |
| 139 new ProfileSyncComponentsFactoryMock()), | 140 new ProfileSyncComponentsFactoryMock()), |
| 140 profile, | 141 profile, signin, oauth2_token_service, browser_sync::AUTO_START)); |
| 141 signin, | |
| 142 oauth2_token_service, | |
| 143 browser_sync::AUTO_START); | |
| 144 } | 142 } |
| 145 | 143 |
| 146 // static | 144 // static |
| 147 TestProfileSyncService* TestProfileSyncService::BuildAutoStartAsyncInit( | 145 TestProfileSyncService* TestProfileSyncService::BuildAutoStartAsyncInit( |
| 148 Profile* profile, base::Closure callback) { | 146 Profile* profile, base::Closure callback) { |
| 149 TestProfileSyncService* sync_service = static_cast<TestProfileSyncService*>( | 147 TestProfileSyncService* sync_service = static_cast<TestProfileSyncService*>( |
| 150 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 148 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 151 profile, &TestProfileSyncService::TestFactoryFunction)); | 149 profile, &TestProfileSyncService::TestFactoryFunction)); |
| 152 ProfileSyncComponentsFactoryMock* components = | 150 ProfileSyncComponentsFactoryMock* components = |
| 153 sync_service->components_factory_mock(); | 151 sync_service->components_factory_mock(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 177 base::MessageLoop::current()->Quit(); | 175 base::MessageLoop::current()->Quit(); |
| 178 } | 176 } |
| 179 | 177 |
| 180 UserShare* TestProfileSyncService::GetUserShare() const { | 178 UserShare* TestProfileSyncService::GetUserShare() const { |
| 181 return backend_->GetUserShare(); | 179 return backend_->GetUserShare(); |
| 182 } | 180 } |
| 183 | 181 |
| 184 bool TestProfileSyncService::NeedBackup() const { | 182 bool TestProfileSyncService::NeedBackup() const { |
| 185 return false; | 183 return false; |
| 186 } | 184 } |
| OLD | NEW |