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

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

Issue 2538023002: [Sync] Pass a TaskRunner into SBHI/SBHC, not a thread or message loop. (Closed)
Patch Set: 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 // Synchronously initializes the backend. 206 // Synchronously initializes the backend.
207 void InitializeBackend(bool expect_success) { 207 void InitializeBackend(bool expect_success) {
208 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success)) 208 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success))
209 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); 209 .WillOnce(InvokeWithoutArgs(QuitMessageLoop));
210 SyncBackendHost::HttpPostProviderFactoryGetter 210 SyncBackendHost::HttpPostProviderFactoryGetter
211 http_post_provider_factory_getter = 211 http_post_provider_factory_getter =
212 base::Bind(&NetworkResources::GetHttpPostProviderFactory, 212 base::Bind(&NetworkResources::GetHttpPostProviderFactory,
213 base::Unretained(network_resources_.get()), nullptr, 213 base::Unretained(network_resources_.get()), nullptr,
214 base::Bind(&EmptyNetworkTimeUpdate)); 214 base::Bind(&EmptyNetworkTimeUpdate));
215 backend_->Initialize( 215 backend_->Initialize(
216 &mock_frontend_, &sync_thread_, WeakHandle<JsEventHandler>(), 216 &mock_frontend_, sync_thread_.task_runner(),
217 GURL(std::string()), std::string(), credentials_, true, false, 217 WeakHandle<JsEventHandler>(), GURL(std::string()), std::string(),
218 base::FilePath(), std::move(fake_manager_factory_), 218 credentials_, true, false, base::FilePath(),
219 std::move(fake_manager_factory_),
219 MakeWeakHandle(test_unrecoverable_error_handler_.GetWeakPtr()), 220 MakeWeakHandle(test_unrecoverable_error_handler_.GetWeakPtr()),
220 base::Closure(), http_post_provider_factory_getter, 221 base::Closure(), http_post_provider_factory_getter,
221 std::move(saved_nigori_state_)); 222 std::move(saved_nigori_state_));
222 base::RunLoop run_loop; 223 base::RunLoop run_loop;
223 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 224 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
224 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout()); 225 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::action_timeout());
225 run_loop.Run(); 226 run_loop.Run();
226 // |fake_manager_factory_|'s fake_manager() is set on the sync 227 // |fake_manager_factory_|'s fake_manager() is set on the sync
227 // thread, but we can rely on the message loop barriers to 228 // thread, but we can rely on the message loop barriers to
228 // guarantee that we see the updated value. 229 // guarantee that we see the updated value.
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 backend_->StopSyncingForShutdown(); 825 backend_->StopSyncingForShutdown();
825 // Verify that call to DeactivateNonBlockingDataType doesn't assert. 826 // Verify that call to DeactivateNonBlockingDataType doesn't assert.
826 backend_->DeactivateNonBlockingDataType(AUTOFILL); 827 backend_->DeactivateNonBlockingDataType(AUTOFILL);
827 backend_->Shutdown(STOP_SYNC); 828 backend_->Shutdown(STOP_SYNC);
828 backend_.reset(); 829 backend_.reset();
829 } 830 }
830 831
831 } // namespace 832 } // namespace
832 833
833 } // namespace syncer 834 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698