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

Unified Diff: components/browser_sync/browser/profile_sync_test_util.cc

Issue 1684643002: Avoid BrowserThread in profile_sync_service_autofill_unittest.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just rebased Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/browser_sync/browser/profile_sync_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_sync/browser/profile_sync_test_util.cc
diff --git a/components/browser_sync/browser/profile_sync_test_util.cc b/components/browser_sync/browser/profile_sync_test_util.cc
index fd6d916f5202082d8da15cc31a351d418a6102e3..cb6c543dc543aad674dc8d82683e81c916044f8a 100644
--- a/components/browser_sync/browser/profile_sync_test_util.cc
+++ b/components/browser_sync/browser/profile_sync_test_util.cc
@@ -217,43 +217,35 @@ ProfileSyncServiceBundle::SyncClientBuilder::Build() {
personal_data_manager_, get_syncable_service_callback_,
get_sync_service_callback_,
activate_model_creation_ ? bundle_->db_thread() : nullptr,
- activate_model_creation_ ? bundle_->file_thread() : nullptr,
+ activate_model_creation_ ? base::ThreadTaskRunnerHandle::Get() : nullptr,
history_service_));
}
-struct ProfileSyncServiceBundle::ThreadProvider {
- public:
- ThreadProvider() : worker_pool_owner_(2, "sync test worker pool") {
- DCHECK(base::MessageLoop::current())
- << "The test including the bundle also needs to include a MessageLoop";
- }
- ~ThreadProvider() = default;
-
- base::SequencedWorkerPoolOwner worker_pool_owner_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ThreadProvider);
-};
-
ProfileSyncServiceBundle::ProfileSyncServiceBundle()
- : ProfileSyncServiceBundle(make_scoped_ptr(new ThreadProvider),
- nullptr,
- nullptr,
- nullptr) {}
-
-ProfileSyncServiceBundle::ProfileSyncServiceBundle(
- const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
- const scoped_refptr<base::SingleThreadTaskRunner>& file_thread,
- base::SequencedWorkerPool* worker_pool)
- : ProfileSyncServiceBundle(nullptr, db_thread, file_thread, worker_pool) {}
+ : db_thread_(base::ThreadTaskRunnerHandle::Get()),
+ worker_pool_owner_(2, "sync test worker pool"),
+ signin_client_(&pref_service_),
+#if defined(OS_CHROMEOS)
+ signin_manager_(&signin_client_, &account_tracker_),
+#else
+ signin_manager_(&signin_client_,
+ &auth_service_,
+ &account_tracker_,
+ nullptr),
+#endif
+ url_request_context_(new net::TestURLRequestContextGetter(
+ base::ThreadTaskRunnerHandle::Get())) {
+ browser_sync::RegisterPrefsForProfileSyncService(pref_service_.registry());
+ auth_service_.set_auto_post_fetch_response_on_message_loop(true);
+ account_tracker_.Initialize(&signin_client_);
+ signin_manager_.Initialize(&pref_service_);
+}
ProfileSyncServiceBundle::~ProfileSyncServiceBundle() {}
ProfileSyncService::InitParams ProfileSyncServiceBundle::CreateBasicInitParams(
browser_sync::ProfileSyncServiceStartBehavior start_behavior,
scoped_ptr<sync_driver::SyncClient> sync_client) {
- DCHECK(worker_pool_);
-
ProfileSyncService::InitParams init_params;
init_params.start_behavior = start_behavior;
@@ -268,40 +260,10 @@ ProfileSyncService::InitParams ProfileSyncServiceBundle::CreateBasicInitParams(
init_params.debug_identifier = "dummyDebugName";
init_params.channel = version_info::Channel::UNKNOWN;
init_params.db_thread = db_thread_;
- init_params.file_thread = file_thread_;
- init_params.blocking_pool = worker_pool_;
+ init_params.file_thread = base::ThreadTaskRunnerHandle::Get();
+ init_params.blocking_pool = worker_pool_owner_.pool().get();
return init_params;
}
-ProfileSyncServiceBundle::ProfileSyncServiceBundle(
- scoped_ptr<ThreadProvider> thread_provider,
- scoped_refptr<base::SingleThreadTaskRunner> db_thread,
- scoped_refptr<base::SingleThreadTaskRunner> file_thread,
- base::SequencedWorkerPool* worker_pool)
- : thread_provider_(std::move(thread_provider)),
- db_thread_(thread_provider_ ? base::ThreadTaskRunnerHandle::Get()
- : db_thread),
- file_thread_(thread_provider_ ? base::ThreadTaskRunnerHandle::Get()
- : file_thread),
- worker_pool_(thread_provider_
- ? thread_provider_->worker_pool_owner_.pool().get()
- : worker_pool),
- signin_client_(&pref_service_),
-#if defined(OS_CHROMEOS)
- signin_manager_(&signin_client_, &account_tracker_),
-#else
- signin_manager_(&signin_client_,
- &auth_service_,
- &account_tracker_,
- nullptr),
-#endif
- url_request_context_(new net::TestURLRequestContextGetter(
- base::ThreadTaskRunnerHandle::Get())) {
- browser_sync::RegisterPrefsForProfileSyncService(pref_service_.registry());
- auth_service_.set_auto_post_fetch_response_on_message_loop(true);
- account_tracker_.Initialize(&signin_client_);
- signin_manager_.Initialize(&pref_service_);
-}
-
} // namespace browser_sync
« no previous file with comments | « components/browser_sync/browser/profile_sync_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698