| 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 "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 8 #include "chrome/browser/invalidation/profile_invalidation_provider.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/managed_user_signin_manager_wrapper.h" | 15 #include "chrome/browser/sync/managed_user_signin_manager_wrapper.h" |
| 15 #include "chrome/browser/sync/profile_sync_components_factory.h" | 16 #include "chrome/browser/sync/profile_sync_components_factory.h" |
| 16 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 17 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 17 #include "chrome/browser/sync/profile_sync_service_factory.h" | 18 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 18 #include "chrome/browser/sync/test/test_http_bridge_factory.h" | 19 #include "chrome/browser/sync/test/test_http_bridge_factory.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 profile, &TestProfileSyncService::TestFactoryFunction)); | 142 profile, &TestProfileSyncService::TestFactoryFunction)); |
| 142 ProfileSyncComponentsFactoryMock* components = | 143 ProfileSyncComponentsFactoryMock* components = |
| 143 sync_service->components_factory_mock(); | 144 sync_service->components_factory_mock(); |
| 144 // TODO(tim): Convert to a fake instead of mock. | 145 // TODO(tim): Convert to a fake instead of mock. |
| 145 EXPECT_CALL(*components, | 146 EXPECT_CALL(*components, |
| 146 CreateSyncBackendHost(testing::_,testing::_, testing::_, | 147 CreateSyncBackendHost(testing::_,testing::_, testing::_, |
| 147 testing::_, testing::_)). | 148 testing::_, testing::_)). |
| 148 WillOnce(testing::Return( | 149 WillOnce(testing::Return( |
| 149 new browser_sync::SyncBackendHostForProfileSyncTest( | 150 new browser_sync::SyncBackendHostForProfileSyncTest( |
| 150 profile, | 151 profile, |
| 151 invalidation::InvalidationServiceFactory::GetForProfile(profile), | 152 invalidation::ProfileInvalidationProviderFactory::GetForProfile( |
| 153 profile)->GetInvalidationService(), |
| 152 sync_service->sync_prefs_.AsWeakPtr(), | 154 sync_service->sync_prefs_.AsWeakPtr(), |
| 153 callback))); | 155 callback))); |
| 154 return sync_service; | 156 return sync_service; |
| 155 } | 157 } |
| 156 | 158 |
| 157 ProfileSyncComponentsFactoryMock* | 159 ProfileSyncComponentsFactoryMock* |
| 158 TestProfileSyncService::components_factory_mock() { | 160 TestProfileSyncService::components_factory_mock() { |
| 159 // We always create a mock factory, see Build* routines. | 161 // We always create a mock factory, see Build* routines. |
| 160 return static_cast<ProfileSyncComponentsFactoryMock*>(factory()); | 162 return static_cast<ProfileSyncComponentsFactoryMock*>(factory()); |
| 161 } | 163 } |
| 162 | 164 |
| 163 void TestProfileSyncService::OnConfigureDone( | 165 void TestProfileSyncService::OnConfigureDone( |
| 164 const browser_sync::DataTypeManager::ConfigureResult& result) { | 166 const browser_sync::DataTypeManager::ConfigureResult& result) { |
| 165 ProfileSyncService::OnConfigureDone(result); | 167 ProfileSyncService::OnConfigureDone(result); |
| 166 base::MessageLoop::current()->Quit(); | 168 base::MessageLoop::current()->Quit(); |
| 167 } | 169 } |
| 168 | 170 |
| 169 UserShare* TestProfileSyncService::GetUserShare() const { | 171 UserShare* TestProfileSyncService::GetUserShare() const { |
| 170 return backend_->GetUserShare(); | 172 return backend_->GetUserShare(); |
| 171 } | 173 } |
| OLD | NEW |