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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ui_thread, | 79 ui_thread, |
80 invalidator, | 80 invalidator, |
81 sync_prefs, | 81 sync_prefs, |
82 temp_dir.Append(base::FilePath(FILE_PATH_LITERAL("test")))), | 82 temp_dir.Append(base::FilePath(FILE_PATH_LITERAL("test")))), |
83 callback_(callback) {} | 83 callback_(callback) {} |
84 | 84 |
85 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} | 85 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} |
86 | 86 |
87 void SyncBackendHostForProfileSyncTest::InitCore( | 87 void SyncBackendHostForProfileSyncTest::InitCore( |
88 std::unique_ptr<syncer::DoInitializeOptions> options) { | 88 std::unique_ptr<syncer::DoInitializeOptions> options) { |
89 options->http_bridge_factory = | 89 options->http_bridge_factory = base::MakeUnique<TestHttpBridgeFactory>(); |
90 std::unique_ptr<syncer::HttpPostProviderFactory>( | 90 options->sync_manager_factory = |
91 new TestHttpBridgeFactory()); | 91 base::MakeUnique<syncer::SyncManagerFactoryForProfileSyncTest>(callback_); |
92 options->sync_manager_factory.reset( | |
93 new syncer::SyncManagerFactoryForProfileSyncTest(callback_)); | |
94 options->credentials.email = "testuser@gmail.com"; | 92 options->credentials.email = "testuser@gmail.com"; |
95 options->credentials.sync_token = "token"; | 93 options->credentials.sync_token = "token"; |
96 options->credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 94 options->credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
97 options->restored_key_for_bootstrapping.clear(); | 95 options->restored_key_for_bootstrapping.clear(); |
98 | 96 |
99 // It'd be nice if we avoided creating the EngineComponentsFactory in the | 97 // 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 | 98 // first place, but SyncBackendHost will have created one by now so we must |
101 // free it. Grab the switches to pass on first. | 99 // free it. Grab the switches to pass on first. |
102 syncer::EngineComponentsFactory::Switches factory_switches = | 100 syncer::EngineComponentsFactory::Switches factory_switches = |
103 options->engine_components_factory->GetSwitches(); | 101 options->engine_components_factory->GetSwitches(); |
104 options->engine_components_factory.reset( | 102 options->engine_components_factory = |
105 new syncer::TestEngineComponentsFactory( | 103 base::MakeUnique<syncer::TestEngineComponentsFactory>( |
106 factory_switches, syncer::EngineComponentsFactory::STORAGE_IN_MEMORY, | 104 factory_switches, syncer::EngineComponentsFactory::STORAGE_IN_MEMORY, |
107 nullptr)); | 105 nullptr); |
108 | 106 |
109 SyncBackendHostImpl::InitCore(std::move(options)); | 107 SyncBackendHostImpl::InitCore(std::move(options)); |
110 } | 108 } |
111 | 109 |
112 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( | 110 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( |
113 syncer::ConfigureReason reason, | 111 syncer::ConfigureReason reason, |
114 syncer::ModelTypeSet to_download, | 112 syncer::ModelTypeSet to_download, |
115 syncer::ModelTypeSet to_purge, | 113 syncer::ModelTypeSet to_purge, |
116 syncer::ModelTypeSet to_journal, | 114 syncer::ModelTypeSet to_journal, |
117 syncer::ModelTypeSet to_unapply, | 115 syncer::ModelTypeSet to_unapply, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 228 |
231 bool CreateRootHelper::success() { | 229 bool CreateRootHelper::success() { |
232 return success_; | 230 return success_; |
233 } | 231 } |
234 | 232 |
235 void CreateRootHelper::CreateRootCallback() { | 233 void CreateRootHelper::CreateRootCallback() { |
236 success_ = test_->CreateRoot(model_type_); | 234 success_ = test_->CreateRoot(model_type_); |
237 } | 235 } |
238 | 236 |
239 } // namespace browser_sync | 237 } // namespace browser_sync |
OLD | NEW |