Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Side by Side Diff: components/sync/driver/glue/sync_backend_host_impl_unittest.cc

Issue 2559123002: [Sync] SyncEngine refactor part 2: SyncServiceBase. (Closed)
Patch Set: Address comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sync/driver/glue/sync_backend_host_impl.h" 5 #include "components/sync/driver/glue/sync_backend_host_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 // Synchronously initializes the backend. 207 // Synchronously initializes the backend.
208 void InitializeBackend(bool expect_success) { 208 void InitializeBackend(bool expect_success) {
209 EXPECT_CALL(mock_host_, OnEngineInitialized(_, _, _, _, expect_success)) 209 EXPECT_CALL(mock_host_, OnEngineInitialized(_, _, _, _, expect_success))
210 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); 210 .WillOnce(InvokeWithoutArgs(QuitMessageLoop));
211 SyncEngine::HttpPostProviderFactoryGetter 211 SyncEngine::HttpPostProviderFactoryGetter
212 http_post_provider_factory_getter = 212 http_post_provider_factory_getter =
213 base::Bind(&NetworkResources::GetHttpPostProviderFactory, 213 base::Bind(&NetworkResources::GetHttpPostProviderFactory,
214 base::Unretained(network_resources_.get()), nullptr, 214 base::Unretained(network_resources_.get()), nullptr,
215 base::Bind(&EmptyNetworkTimeUpdate)); 215 base::Bind(&EmptyNetworkTimeUpdate));
216 backend_->Initialize( 216
217 &mock_host_, sync_thread_.task_runner(), WeakHandle<JsEventHandler>(), 217 SyncEngine::InitParams params;
218 GURL(std::string()), std::string(), credentials_, true, false, 218 params.sync_task_runner = sync_thread_.task_runner();
219 base::FilePath(), std::move(fake_manager_factory_), 219 params.host = &mock_host_;
220 params.registrar = base::MakeUnique<SyncBackendRegistrar>(
221 std::string(), base::Bind(&SyncClient::CreateModelWorkerForGroup,
222 base::Unretained(&sync_client_)));
223 params.http_factory_getter = http_post_provider_factory_getter;
224 params.credentials = credentials_;
225 params.sync_manager_factory = std::move(fake_manager_factory_);
226 params.delete_sync_data_folder = true;
227 params.unrecoverable_error_handler =
220 MakeWeakHandle(test_unrecoverable_error_handler_.GetWeakPtr()), 228 MakeWeakHandle(test_unrecoverable_error_handler_.GetWeakPtr()),
221 base::Closure(), http_post_provider_factory_getter, 229 params.saved_nigori_state = std::move(saved_nigori_state_);
222 std::move(saved_nigori_state_)); 230 sync_prefs_->GetInvalidationVersions(&params.invalidation_versions);
231
232 backend_->Initialize(std::move(params));
233
223 base::RunLoop run_loop; 234 base::RunLoop run_loop;
224 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 235 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
225 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout()); 236 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout());
226 run_loop.Run(); 237 run_loop.Run();
227 // |fake_manager_factory_|'s fake_manager() is set on the sync 238 // |fake_manager_factory_|'s fake_manager() is set on the sync
228 // thread, but we can rely on the message loop barriers to 239 // thread, but we can rely on the message loop barriers to
229 // guarantee that we see the updated value. 240 // guarantee that we see the updated value.
230 DCHECK(fake_manager_); 241 DCHECK(fake_manager_);
231 } 242 }
232 243
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 backend_->StopSyncingForShutdown(); 832 backend_->StopSyncingForShutdown();
822 // Verify that call to DeactivateNonBlockingDataType doesn't assert. 833 // Verify that call to DeactivateNonBlockingDataType doesn't assert.
823 backend_->DeactivateNonBlockingDataType(AUTOFILL); 834 backend_->DeactivateNonBlockingDataType(AUTOFILL);
824 backend_->Shutdown(STOP_SYNC); 835 backend_->Shutdown(STOP_SYNC);
825 backend_.reset(); 836 backend_.reset();
826 } 837 }
827 838
828 } // namespace 839 } // namespace
829 840
830 } // namespace syncer 841 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_impl.cc ('k') | components/sync/driver/sync_service_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698