| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 14 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 17 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
| 18 #include "chrome/browser/sync/chrome_sync_client.h" | 18 #include "chrome/browser/sync/chrome_sync_client.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" | |
| 21 #include "chrome/browser/sync/test/test_http_bridge_factory.h" | 20 #include "chrome/browser/sync/test/test_http_bridge_factory.h" |
| 22 #include "chrome/common/channel_info.h" | 21 #include "chrome/common/channel_info.h" |
| 22 #include "components/browser_sync/browser/profile_sync_test_util.h" |
| 23 #include "components/invalidation/impl/profile_invalidation_provider.h" | 23 #include "components/invalidation/impl/profile_invalidation_provider.h" |
| 24 #include "components/signin/core/browser/signin_manager.h" | 24 #include "components/signin/core/browser/signin_manager.h" |
| 25 #include "components/sync_driver/glue/sync_backend_host.h" | 25 #include "components/sync_driver/glue/sync_backend_host.h" |
| 26 #include "components/sync_driver/glue/sync_backend_host_core.h" | 26 #include "components/sync_driver/glue/sync_backend_host_core.h" |
| 27 #include "components/sync_driver/signin_manager_wrapper.h" | 27 #include "components/sync_driver/signin_manager_wrapper.h" |
| 28 #include "components/sync_driver/sync_api_component_factory_mock.h" | 28 #include "components/sync_driver/sync_api_component_factory_mock.h" |
| 29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 30 #include "google_apis/gaia/gaia_constants.h" | 30 #include "google_apis/gaia/gaia_constants.h" |
| 31 #include "sync/internal_api/public/test/sync_manager_factory_for_profile_sync_te
st.h" | 31 #include "sync/internal_api/public/test/sync_manager_factory_for_profile_sync_te
st.h" |
| 32 #include "sync/internal_api/public/test/test_internal_components_factory.h" | 32 #include "sync/internal_api/public/test/test_internal_components_factory.h" |
| 33 #include "sync/internal_api/public/user_share.h" | 33 #include "sync/internal_api/public/user_share.h" |
| 34 #include "sync/protocol/encryption.pb.h" | 34 #include "sync/protocol/encryption.pb.h" |
| 35 #include "testing/gmock/include/gmock/gmock.h" | 35 #include "testing/gmock/include/gmock/gmock.h" |
| 36 | 36 |
| 37 using content::BrowserThread; | 37 using content::BrowserThread; |
| 38 using syncer::InternalComponentsFactory; | 38 using syncer::InternalComponentsFactory; |
| 39 using syncer::TestInternalComponentsFactory; | 39 using syncer::TestInternalComponentsFactory; |
| 40 using syncer::UserShare; | 40 using syncer::UserShare; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 ProfileSyncService::InitParams GetInitParams( | 44 ProfileSyncService::InitParams GetInitParams( |
| 45 Profile* profile, | 45 Profile* profile, |
| 46 SigninManagerBase* signin, | 46 SigninManagerBase* signin, |
| 47 ProfileOAuth2TokenService* oauth2_token_service, | 47 ProfileOAuth2TokenService* oauth2_token_service, |
| 48 browser_sync::ProfileSyncServiceStartBehavior behavior) { | 48 browser_sync::ProfileSyncServiceStartBehavior behavior) { |
| 49 ProfileSyncService::InitParams init_params = | 49 ProfileSyncService::InitParams init_params; |
| 50 CreateProfileSyncServiceParamsForTest(profile); | |
| 51 | 50 |
| 52 init_params.signin_wrapper = | 51 init_params.signin_wrapper = |
| 53 make_scoped_ptr(new SigninManagerWrapper(signin)); | 52 make_scoped_ptr(new SigninManagerWrapper(signin)); |
| 54 init_params.oauth2_token_service = oauth2_token_service; | 53 init_params.oauth2_token_service = oauth2_token_service; |
| 55 init_params.start_behavior = behavior; | 54 init_params.start_behavior = behavior; |
| 55 init_params.sync_client = |
| 56 make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)); |
| 57 init_params.network_time_update_callback = |
| 58 base::Bind(&browser_sync::EmptyNetworkTimeUpdate); |
| 59 init_params.base_directory = profile->GetPath(); |
| 60 init_params.url_request_context = profile->GetRequestContext(); |
| 61 init_params.debug_identifier = profile->GetDebugName(); |
| 62 init_params.channel = chrome::GetChannel(); |
| 63 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread( |
| 64 content::BrowserThread::DB); |
| 65 init_params.file_thread = |
| 66 content::BrowserThread::GetMessageLoopProxyForThread( |
| 67 content::BrowserThread::FILE); |
| 68 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 56 | 69 |
| 57 return init_params; | 70 return init_params; |
| 58 } | 71 } |
| 59 | 72 |
| 60 } // namespace | 73 } // namespace |
| 61 | 74 |
| 62 namespace browser_sync { | 75 namespace browser_sync { |
| 63 | 76 |
| 64 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( | 77 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( |
| 65 Profile* profile, | 78 Profile* profile, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 base::MessageLoop::current()->QuitWhenIdle(); | 219 base::MessageLoop::current()->QuitWhenIdle(); |
| 207 } | 220 } |
| 208 | 221 |
| 209 UserShare* TestProfileSyncService::GetUserShare() const { | 222 UserShare* TestProfileSyncService::GetUserShare() const { |
| 210 return backend_->GetUserShare(); | 223 return backend_->GetUserShare(); |
| 211 } | 224 } |
| 212 | 225 |
| 213 bool TestProfileSyncService::NeedBackup() const { | 226 bool TestProfileSyncService::NeedBackup() const { |
| 214 return false; | 227 return false; |
| 215 } | 228 } |
| OLD | NEW |