| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 12 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | 15 #include "chrome/browser/signin/signin_manager_factory.h" |
| 16 #include "chrome/browser/sync/chrome_sync_client.h" | 16 #include "chrome/browser/sync/chrome_sync_client.h" |
| 17 #include "chrome/browser/sync/glue/sync_backend_host.h" | 17 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 18 #include "chrome/browser/sync/glue/sync_backend_host_core.h" | 18 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
| 19 #include "chrome/browser/sync/profile_sync_service_factory.h" | 19 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 20 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 20 #include "chrome/browser/sync/test/test_http_bridge_factory.h" | 21 #include "chrome/browser/sync/test/test_http_bridge_factory.h" |
| 21 #include "components/invalidation/impl/profile_invalidation_provider.h" | 22 #include "components/invalidation/impl/profile_invalidation_provider.h" |
| 22 #include "components/signin/core/browser/signin_manager.h" | 23 #include "components/signin/core/browser/signin_manager.h" |
| 23 #include "components/sync_driver/signin_manager_wrapper.h" | 24 #include "components/sync_driver/signin_manager_wrapper.h" |
| 24 #include "components/sync_driver/sync_api_component_factory_mock.h" | 25 #include "components/sync_driver/sync_api_component_factory_mock.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "google_apis/gaia/gaia_constants.h" | 27 #include "google_apis/gaia/gaia_constants.h" |
| 27 #include "sync/internal_api/public/test/sync_manager_factory_for_profile_sync_te
st.h" | 28 #include "sync/internal_api/public/test/sync_manager_factory_for_profile_sync_te
st.h" |
| 28 #include "sync/internal_api/public/test/test_internal_components_factory.h" | 29 #include "sync/internal_api/public/test/test_internal_components_factory.h" |
| 29 #include "sync/internal_api/public/user_share.h" | 30 #include "sync/internal_api/public/user_share.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 syncer::WeakHandle<syncer::JsEventHandler> | 119 syncer::WeakHandle<syncer::JsEventHandler> |
| 119 TestProfileSyncService::GetJsEventHandler() { | 120 TestProfileSyncService::GetJsEventHandler() { |
| 120 return syncer::WeakHandle<syncer::JsEventHandler>(); | 121 return syncer::WeakHandle<syncer::JsEventHandler>(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 TestProfileSyncService::TestProfileSyncService( | 124 TestProfileSyncService::TestProfileSyncService( |
| 124 Profile* profile, | 125 Profile* profile, |
| 125 SigninManagerBase* signin, | 126 SigninManagerBase* signin, |
| 126 ProfileOAuth2TokenService* oauth2_token_service, | 127 ProfileOAuth2TokenService* oauth2_token_service, |
| 127 browser_sync::ProfileSyncServiceStartBehavior behavior) | 128 browser_sync::ProfileSyncServiceStartBehavior behavior) |
| 128 : ProfileSyncService( | 129 : ProfileSyncService(make_scoped_ptr(new browser_sync::ChromeSyncClient( |
| 129 make_scoped_ptr(new browser_sync::ChromeSyncClient( | 130 profile, |
| 130 profile, | 131 make_scoped_ptr(new SyncApiComponentFactoryMock))), |
| 131 make_scoped_ptr(new SyncApiComponentFactoryMock))), | 132 profile, |
| 132 profile, | 133 make_scoped_ptr(new SigninManagerWrapper(signin)), |
| 133 make_scoped_ptr(new SigninManagerWrapper(signin)), | 134 oauth2_token_service, |
| 134 oauth2_token_service, | 135 behavior, |
| 135 behavior) { | 136 base::Bind(&EmptyNetworkTimeUpdate)) { |
| 136 SetSyncSetupCompleted(); | 137 SetSyncSetupCompleted(); |
| 137 } | 138 } |
| 138 | 139 |
| 139 TestProfileSyncService::~TestProfileSyncService() { | 140 TestProfileSyncService::~TestProfileSyncService() { |
| 140 } | 141 } |
| 141 | 142 |
| 142 // static | 143 // static |
| 143 scoped_ptr<KeyedService> TestProfileSyncService::TestFactoryFunction( | 144 scoped_ptr<KeyedService> TestProfileSyncService::TestFactoryFunction( |
| 144 content::BrowserContext* context) { | 145 content::BrowserContext* context) { |
| 145 Profile* profile = static_cast<Profile*>(context); | 146 Profile* profile = static_cast<Profile*>(context); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 base::MessageLoop::current()->QuitWhenIdle(); | 188 base::MessageLoop::current()->QuitWhenIdle(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 UserShare* TestProfileSyncService::GetUserShare() const { | 191 UserShare* TestProfileSyncService::GetUserShare() const { |
| 191 return backend_->GetUserShare(); | 192 return backend_->GetUserShare(); |
| 192 } | 193 } |
| 193 | 194 |
| 194 bool TestProfileSyncService::NeedBackup() const { | 195 bool TestProfileSyncService::NeedBackup() const { |
| 195 return false; | 196 return false; |
| 196 } | 197 } |
| OLD | NEW |