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

Unified Diff: components/sync/driver/ui_model_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/sync/driver/ui_model_type_controller_unittest.cc
diff --git a/components/sync/driver/ui_model_type_controller_unittest.cc b/components/sync/driver/ui_model_type_controller_unittest.cc
index 437d681dd33290d049c83fbf2bf7a8fbfde8eff3..35fe599220179c28d0d26e368a14d2cd4c233453 100644
--- a/components/sync/driver/ui_model_type_controller_unittest.cc
+++ b/components/sync/driver/ui_model_type_controller_unittest.cc
@@ -4,6 +4,9 @@
#include "components/sync/driver/ui_model_type_controller.h"
+#include <memory>
+#include <utility>
+
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
@@ -27,23 +30,6 @@ namespace sync_driver_v2 {
namespace {
-// Test controller derived from UIModelTypeController.
-class TestUIModelTypeController : public UIModelTypeController {
- public:
- TestUIModelTypeController(
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
- const base::Closure& error_callback,
- syncer::ModelType model_type,
- sync_driver::SyncClient* sync_client)
- : UIModelTypeController(ui_thread,
- error_callback,
- model_type,
- sync_client) {}
-
- private:
- ~TestUIModelTypeController() override {}
-};
-
// A no-op instance of CommitQueue.
class NullCommitQueue : public syncer_v2::CommitQueue {
public:
@@ -142,10 +128,10 @@ class UIModelTypeControllerTest : public testing::Test,
~UIModelTypeControllerTest() override {}
void SetUp() override {
- controller_ = new TestUIModelTypeController(
- ui_loop_.task_runner(), base::Closure(), syncer::DEVICE_INFO, this);
- service_.reset(new syncer_v2::FakeModelTypeService(base::Bind(
- &UIModelTypeControllerTest::CreateProcessor, base::Unretained(this))));
+ controller_ = base::MakeUnique<UIModelTypeController>(
+ syncer::DEVICE_INFO, base::Closure(), this);
+ service_ = base::MakeUnique<syncer_v2::FakeModelTypeService>(base::Bind(
+ &UIModelTypeControllerTest::CreateProcessor, base::Unretained(this)));
}
void TearDown() override {
@@ -215,7 +201,7 @@ class UIModelTypeControllerTest : public testing::Test,
auto_run_tasks_ = auto_run_tasks;
}
- void LoadModelsDone(syncer::ModelType type, syncer::SyncError error) {
+ void LoadModelsDone(syncer::ModelType type, const syncer::SyncError& error) {
load_models_callback_called_ = true;
load_models_error_ = error;
}
@@ -228,7 +214,7 @@ class UIModelTypeControllerTest : public testing::Test,
}
syncer_v2::SharedModelTypeProcessor* type_processor_;
- scoped_refptr<TestUIModelTypeController> controller_;
+ std::unique_ptr<UIModelTypeController> controller_;
bool auto_run_tasks_;
bool load_models_callback_called_;

Powered by Google App Engine
This is Rietveld 408576698