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

Unified Diff: chrome/browser/sync/profile_sync_service_typed_url_unittest.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
Index: chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index 9838574ec3d3e0714594b96b2d2d74711e797a24..9300403d4a9bd057761848493e954c27642b97c5 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -165,21 +165,21 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
}
protected:
- ProfileSyncServiceTypedUrlTest() : history_thread_("history") {
+ ProfileSyncServiceTypedUrlTest() {
profile_sync_service_bundle_.pref_service()
->registry()
->RegisterBooleanPref(kDummySavingBrowserHistoryDisabled, false);
- history_thread_.Start();
+ data_type_thread_.Start();
base::RunLoop run_loop;
- history_thread_.task_runner()->PostTaskAndReply(
+ data_type_thread_.task_runner()->PostTaskAndReply(
FROM_HERE,
base::Bind(&ProfileSyncServiceTypedUrlTest::CreateHistoryService,
base::Unretained(this)),
run_loop.QuitClosure());
run_loop.Run();
history_service_ = make_scoped_ptr(new HistoryServiceMock);
- history_service_->set_task_runner(history_thread_.task_runner());
+ history_service_->set_task_runner(data_type_thread_.task_runner());
history_service_->set_backend(history_backend_);
browser_sync::ProfileSyncServiceBundle::SyncClientBuilder builder(
@@ -201,7 +201,10 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
new TestTypedUrlSyncableService(history_backend_.get()));
}
- void DeleteSyncableService() { syncable_service_.reset(); }
+ void DeleteSyncableService() {
+ syncable_service_.reset();
+ history_backend_ = nullptr;
+ }
~ProfileSyncServiceTypedUrlTest() override {
history_service_->Shutdown();
@@ -220,11 +223,12 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
run_loop.Run();
}
- sync_service_->Shutdown();
+ // Spin the loop again for deletion tasks posted from the Sync thread.
+ base::RunLoop().RunUntilIdle();
{
base::RunLoop run_loop;
- history_thread_.task_runner()->PostTaskAndReply(
+ data_type_thread_.task_runner()->PostTaskAndReply(
FROM_HERE,
base::Bind(&ProfileSyncServiceTypedUrlTest::DeleteSyncableService,
base::Unretained(this)),
@@ -297,7 +301,7 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
}
void SendNotification(const base::Closure& task) {
- history_thread_.task_runner()->PostTaskAndReply(
+ data_type_thread_.task_runner()->PostTaskAndReply(
FROM_HERE, task,
base::Bind(&base::MessageLoop::QuitNow,
base::Unretained(base::MessageLoop::current())));
@@ -374,9 +378,6 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
return syncable_service_->AsWeakPtr();
}
- // The separate thread is needed, because TypedUrlDataTypeController
- // requires to run on another thread than the UI thread.
- base::Thread history_thread_;
scoped_refptr<HistoryBackendMock> history_backend_;
scoped_ptr<HistoryServiceMock> history_service_;
sync_driver::DataTypeErrorHandlerMock error_handler_;
« no previous file with comments | « chrome/browser/sync/profile_sync_service_autofill_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698