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

Side by Side Diff: components/sync_bookmarks/bookmark_data_type_controller_unittest.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync_bookmarks/bookmark_data_type_controller.h" 5 #include "components/sync_bookmarks/bookmark_data_type_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return history_service_.get(); 64 return history_service_.get();
65 } 65 }
66 syncer::SyncService* GetSyncService() override { return &service_; } 66 syncer::SyncService* GetSyncService() override { return &service_; }
67 syncer::SyncApiComponentFactory* GetSyncApiComponentFactory() override { 67 syncer::SyncApiComponentFactory* GetSyncApiComponentFactory() override {
68 return profile_sync_factory_.get(); 68 return profile_sync_factory_.get();
69 } 69 }
70 70
71 void SetUp() override { 71 void SetUp() override {
72 model_associator_ = new ModelAssociatorMock(); 72 model_associator_ = new ModelAssociatorMock();
73 change_processor_ = new ChangeProcessorMock(); 73 change_processor_ = new ChangeProcessorMock();
74 history_service_.reset(new HistoryMock()); 74 history_service_ = base::MakeUnique<HistoryMock>();
75 profile_sync_factory_.reset(new syncer::SyncApiComponentFactoryMock( 75 profile_sync_factory_ =
76 model_associator_, change_processor_)); 76 base::MakeUnique<syncer::SyncApiComponentFactoryMock>(
77 bookmark_dtc_.reset( 77 model_associator_, change_processor_);
78 new BookmarkDataTypeController(base::Bind(&base::DoNothing), this)); 78 bookmark_dtc_ = base::MakeUnique<BookmarkDataTypeController>(
79 base::Bind(&base::DoNothing), this);
79 } 80 }
80 81
81 protected: 82 protected:
82 enum BookmarkLoadPolicy { 83 enum BookmarkLoadPolicy {
83 DONT_LOAD_MODEL, 84 DONT_LOAD_MODEL,
84 LOAD_MODEL, 85 LOAD_MODEL,
85 }; 86 };
86 87
87 void CreateBookmarkModel(BookmarkLoadPolicy bookmark_load_policy) { 88 void CreateBookmarkModel(BookmarkLoadPolicy bookmark_load_policy) {
88 bookmark_model_.reset( 89 bookmark_model_ = base::MakeUnique<BookmarkModel>(
89 new BookmarkModel(base::MakeUnique<bookmarks::TestBookmarkClient>())); 90 base::MakeUnique<bookmarks::TestBookmarkClient>());
90 if (bookmark_load_policy == LOAD_MODEL) { 91 if (bookmark_load_policy == LOAD_MODEL) {
91 TestingPrefServiceSimple prefs; 92 TestingPrefServiceSimple prefs;
92 bookmark_model_->Load(&prefs, base::FilePath(), 93 bookmark_model_->Load(&prefs, base::FilePath(),
93 base::ThreadTaskRunnerHandle::Get(), 94 base::ThreadTaskRunnerHandle::Get(),
94 base::ThreadTaskRunnerHandle::Get()); 95 base::ThreadTaskRunnerHandle::Get());
95 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_.get()); 96 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_.get());
96 } 97 }
97 } 98 }
98 99
99 void SetStartExpectations() { 100 void SetStartExpectations() {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 SetStopExpectations(); 291 SetStopExpectations();
291 292
292 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state()); 293 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
293 294
294 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _)); 295 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _));
295 Start(); 296 Start();
296 EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state()); 297 EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state());
297 bookmark_dtc_->Stop(); 298 bookmark_dtc_->Stop();
298 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state()); 299 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
299 } 300 }
OLDNEW
« no previous file with comments | « components/sync/tools/sync_listen_notifications.cc ('k') | components/sync_sessions/session_data_type_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698