| 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 "components/browser_sync/abstract_profile_sync_service_test.h" | 5 #include "components/browser_sync/abstract_profile_sync_service_test.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "components/browser_sync/test_http_bridge_factory.h" | 15 #include "components/browser_sync/test_http_bridge_factory.h" |
| 16 #include "components/browser_sync/test_profile_sync_service.h" | 16 #include "components/browser_sync/test_profile_sync_service.h" |
| 17 #include "components/sync/core/test/sync_manager_factory_for_profile_sync_test.h
" | |
| 18 #include "components/sync/core/test/test_internal_components_factory.h" | |
| 19 #include "components/sync/driver/glue/sync_backend_host_core.h" | 17 #include "components/sync/driver/glue/sync_backend_host_core.h" |
| 20 #include "components/sync/driver/sync_api_component_factory_mock.h" | 18 #include "components/sync/driver/sync_api_component_factory_mock.h" |
| 19 #include "components/sync/engine/sync_manager_factory_for_profile_sync_test.h" |
| 20 #include "components/sync/engine/test_engine_components_factory.h" |
| 21 #include "components/sync/protocol/sync.pb.h" | 21 #include "components/sync/protocol/sync.pb.h" |
| 22 #include "components/sync/syncable/test_user_share.h" | 22 #include "components/sync/syncable/test_user_share.h" |
| 23 #include "google_apis/gaia/gaia_constants.h" | 23 #include "google_apis/gaia/gaia_constants.h" |
| 24 | 24 |
| 25 using syncer::SyncBackendHostImpl; | 25 using syncer::SyncBackendHostImpl; |
| 26 using syncer::ModelType; | 26 using syncer::ModelType; |
| 27 using testing::_; | 27 using testing::_; |
| 28 using testing::Return; | 28 using testing::Return; |
| 29 | 29 |
| 30 namespace browser_sync { | 30 namespace browser_sync { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 options->http_bridge_factory = | 89 options->http_bridge_factory = |
| 90 std::unique_ptr<syncer::HttpPostProviderFactory>( | 90 std::unique_ptr<syncer::HttpPostProviderFactory>( |
| 91 new TestHttpBridgeFactory()); | 91 new TestHttpBridgeFactory()); |
| 92 options->sync_manager_factory.reset( | 92 options->sync_manager_factory.reset( |
| 93 new syncer::SyncManagerFactoryForProfileSyncTest(callback_)); | 93 new syncer::SyncManagerFactoryForProfileSyncTest(callback_)); |
| 94 options->credentials.email = "testuser@gmail.com"; | 94 options->credentials.email = "testuser@gmail.com"; |
| 95 options->credentials.sync_token = "token"; | 95 options->credentials.sync_token = "token"; |
| 96 options->credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 96 options->credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
| 97 options->restored_key_for_bootstrapping.clear(); | 97 options->restored_key_for_bootstrapping.clear(); |
| 98 | 98 |
| 99 // It'd be nice if we avoided creating the InternalComponentsFactory in the | 99 // It'd be nice if we avoided creating the EngineComponentsFactory in the |
| 100 // first place, but SyncBackendHost will have created one by now so we must | 100 // first place, but SyncBackendHost will have created one by now so we must |
| 101 // free it. Grab the switches to pass on first. | 101 // free it. Grab the switches to pass on first. |
| 102 syncer::InternalComponentsFactory::Switches factory_switches = | 102 syncer::EngineComponentsFactory::Switches factory_switches = |
| 103 options->internal_components_factory->GetSwitches(); | 103 options->engine_components_factory->GetSwitches(); |
| 104 options->internal_components_factory.reset( | 104 options->engine_components_factory.reset( |
| 105 new syncer::TestInternalComponentsFactory( | 105 new syncer::TestEngineComponentsFactory( |
| 106 factory_switches, | 106 factory_switches, syncer::EngineComponentsFactory::STORAGE_IN_MEMORY, |
| 107 syncer::InternalComponentsFactory::STORAGE_IN_MEMORY, nullptr)); | 107 nullptr)); |
| 108 | 108 |
| 109 SyncBackendHostImpl::InitCore(std::move(options)); | 109 SyncBackendHostImpl::InitCore(std::move(options)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( | 112 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( |
| 113 syncer::ConfigureReason reason, | 113 syncer::ConfigureReason reason, |
| 114 syncer::ModelTypeSet to_download, | 114 syncer::ModelTypeSet to_download, |
| 115 syncer::ModelTypeSet to_purge, | 115 syncer::ModelTypeSet to_purge, |
| 116 syncer::ModelTypeSet to_journal, | 116 syncer::ModelTypeSet to_journal, |
| 117 syncer::ModelTypeSet to_unapply, | 117 syncer::ModelTypeSet to_unapply, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 bool CreateRootHelper::success() { | 231 bool CreateRootHelper::success() { |
| 232 return success_; | 232 return success_; |
| 233 } | 233 } |
| 234 | 234 |
| 235 void CreateRootHelper::CreateRootCallback() { | 235 void CreateRootHelper::CreateRootCallback() { |
| 236 success_ = test_->CreateRoot(model_type_); | 236 success_ = test_->CreateRoot(model_type_); |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace browser_sync | 239 } // namespace browser_sync |
| OLD | NEW |