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

Unified Diff: components/search_engines/search_engine_data_type_controller_unittest.cc

Issue 2289143003: [Sync] Convert DTCs to be not RefCounted and NonThreadSafe. (Closed)
Patch Set: Use ThreadChecker instead of NonThreadSafe. Created 4 years, 3 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: components/search_engines/search_engine_data_type_controller_unittest.cc
diff --git a/components/search_engines/search_engine_data_type_controller_unittest.cc b/components/search_engines/search_engine_data_type_controller_unittest.cc
index 98d6914d885f80492732aa390f8be2a9f0835a6c..f4663d166d030bc57a2ec233183a952f34f5e7ea 100644
--- a/components/search_engines/search_engine_data_type_controller_unittest.cc
+++ b/components/search_engines/search_engine_data_type_controller_unittest.cc
@@ -12,6 +12,7 @@
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/test/test_message_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/tracked_objects.h"
#include "components/search_engines/template_url_service.h"
@@ -37,7 +38,11 @@ class SyncSearchEngineDataTypeControllerTest
public:
SyncSearchEngineDataTypeControllerTest()
: sync_driver::FakeSyncClient(&profile_sync_factory_),
- template_url_service_(new TemplateURLService(nullptr, 0)) {
+ template_url_service_(new TemplateURLService(nullptr, 0)),
+ search_engine_dtc_(
+ new SearchEngineDataTypeController(base::Bind(&base::DoNothing),
+ this,
+ template_url_service_.get())) {
// Disallow the TemplateURLService from loading until
// PreloadTemplateURLService() is called .
template_url_service_->set_disable_load(true);
@@ -49,17 +54,9 @@ class SyncSearchEngineDataTypeControllerTest
return syncable_service_.AsWeakPtr();
}
- void SetUp() override {
- search_engine_dtc_ = new SearchEngineDataTypeController(
- base::ThreadTaskRunnerHandle::Get(),
- base::Bind(&base::DoNothing), this,
- template_url_service_.get());
- }
-
void TearDown() override {
// Must be done before we pump the loop.
syncable_service_.StopSyncing(syncer::SEARCH_ENGINES);
- search_engine_dtc_ = NULL;
}
protected:
@@ -87,9 +84,9 @@ class SyncSearchEngineDataTypeControllerTest
base::RunLoop().RunUntilIdle();
}
- base::MessageLoop message_loop_;
+ base::TestMessageLoop message_loop_;
std::unique_ptr<TemplateURLService> template_url_service_;
- scoped_refptr<SearchEngineDataTypeController> search_engine_dtc_;
+ std::unique_ptr<SearchEngineDataTypeController> search_engine_dtc_;
SyncApiComponentFactoryMock profile_sync_factory_;
syncer::FakeSyncableService syncable_service_;
sync_driver::StartCallbackMock start_callback_;

Powered by Google App Engine
This is Rietveld 408576698