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

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: Rebase, address comments, remove TestMessageLoop. 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..5811293a7178113f8dfe1d9865f00b408e4675c5 100644
--- a/components/search_engines/search_engine_data_type_controller_unittest.cc
+++ b/components/search_engines/search_engine_data_type_controller_unittest.cc
@@ -10,6 +10,7 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/memory/ptr_util.h"
+#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.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),
Peter Kasting 2016/09/02 22:27:47 Nit: Can we just pass a Callback(), or does that n
maxbogue 2016/09/03 00:14:51 Switched to base::Closure(), yes. Thanks!
+ 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:
@@ -89,7 +86,7 @@ class SyncSearchEngineDataTypeControllerTest
base::MessageLoop message_loop_;
std::unique_ptr<TemplateURLService> template_url_service_;
- scoped_refptr<SearchEngineDataTypeController> search_engine_dtc_;
+ std::unique_ptr<SearchEngineDataTypeController> search_engine_dtc_;
Peter Kasting 2016/09/02 22:27:47 Nit: It looks like this is never nulled out. Can
maxbogue 2016/09/03 00:14:51 Yep! Done.
SyncApiComponentFactoryMock profile_sync_factory_;
syncer::FakeSyncableService syncable_service_;
sync_driver::StartCallbackMock start_callback_;

Powered by Google App Engine
This is Rietveld 408576698