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

Side by Side Diff: chrome/browser/supervised_user/legacy/supervised_user_sync_service_unittest.cc

Issue 1878143002: Convert //chrome/browser/supervised_user from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 86
87 class SupervisedUserSyncServiceTest : public ::testing::Test { 87 class SupervisedUserSyncServiceTest : public ::testing::Test {
88 public: 88 public:
89 SupervisedUserSyncServiceTest(); 89 SupervisedUserSyncServiceTest();
90 ~SupervisedUserSyncServiceTest() override; 90 ~SupervisedUserSyncServiceTest() override;
91 91
92 protected: 92 protected:
93 scoped_ptr<SyncChangeProcessor> CreateChangeProcessor(); 93 std::unique_ptr<SyncChangeProcessor> CreateChangeProcessor();
94 scoped_ptr<SyncErrorFactory> CreateErrorFactory(); 94 std::unique_ptr<SyncErrorFactory> CreateErrorFactory();
95 SyncData CreateRemoteData(const std::string& id, 95 SyncData CreateRemoteData(const std::string& id,
96 const std::string& name, 96 const std::string& name,
97 const std::string& avatar); 97 const std::string& avatar);
98 98
99 PrefService* prefs() { return profile_.GetPrefs(); } 99 PrefService* prefs() { return profile_.GetPrefs(); }
100 SupervisedUserSyncService* service() { return service_; } 100 SupervisedUserSyncService* service() { return service_; }
101 MockChangeProcessor* change_processor() { return change_processor_; } 101 MockChangeProcessor* change_processor() { return change_processor_; }
102 102
103 private: 103 private:
104 content::TestBrowserThreadBundle thread_bundle_; 104 content::TestBrowserThreadBundle thread_bundle_;
105 TestingProfile profile_; 105 TestingProfile profile_;
106 SupervisedUserSyncService* service_; 106 SupervisedUserSyncService* service_;
107 107
108 // Owned by the SupervisedUserSyncService. 108 // Owned by the SupervisedUserSyncService.
109 MockChangeProcessor* change_processor_; 109 MockChangeProcessor* change_processor_;
110 110
111 // A unique ID for creating "remote" Sync data. 111 // A unique ID for creating "remote" Sync data.
112 int64_t sync_data_id_; 112 int64_t sync_data_id_;
113 }; 113 };
114 114
115 SupervisedUserSyncServiceTest::SupervisedUserSyncServiceTest() 115 SupervisedUserSyncServiceTest::SupervisedUserSyncServiceTest()
116 : change_processor_(NULL), 116 : change_processor_(NULL),
117 sync_data_id_(0) { 117 sync_data_id_(0) {
118 service_ = SupervisedUserSyncServiceFactory::GetForProfile(&profile_); 118 service_ = SupervisedUserSyncServiceFactory::GetForProfile(&profile_);
119 } 119 }
120 120
121 SupervisedUserSyncServiceTest::~SupervisedUserSyncServiceTest() {} 121 SupervisedUserSyncServiceTest::~SupervisedUserSyncServiceTest() {}
122 122
123 scoped_ptr<SyncChangeProcessor> 123 std::unique_ptr<SyncChangeProcessor>
124 SupervisedUserSyncServiceTest::CreateChangeProcessor() { 124 SupervisedUserSyncServiceTest::CreateChangeProcessor() {
125 EXPECT_FALSE(change_processor_); 125 EXPECT_FALSE(change_processor_);
126 change_processor_ = new MockChangeProcessor(); 126 change_processor_ = new MockChangeProcessor();
127 return scoped_ptr<SyncChangeProcessor>(change_processor_); 127 return std::unique_ptr<SyncChangeProcessor>(change_processor_);
128 } 128 }
129 129
130 scoped_ptr<SyncErrorFactory> 130 std::unique_ptr<SyncErrorFactory>
131 SupervisedUserSyncServiceTest::CreateErrorFactory() { 131 SupervisedUserSyncServiceTest::CreateErrorFactory() {
132 return scoped_ptr<SyncErrorFactory>(new syncer::SyncErrorFactoryMock()); 132 return std::unique_ptr<SyncErrorFactory>(new syncer::SyncErrorFactoryMock());
133 } 133 }
134 134
135 SyncData SupervisedUserSyncServiceTest::CreateRemoteData( 135 SyncData SupervisedUserSyncServiceTest::CreateRemoteData(
136 const std::string& id, 136 const std::string& id,
137 const std::string& name, 137 const std::string& name,
138 const std::string& chrome_avatar) { 138 const std::string& chrome_avatar) {
139 ::sync_pb::EntitySpecifics specifics; 139 ::sync_pb::EntitySpecifics specifics;
140 specifics.mutable_managed_user()->set_id(id); 140 specifics.mutable_managed_user()->set_id(id);
141 specifics.mutable_managed_user()->set_name(name); 141 specifics.mutable_managed_user()->set_name(name);
142 specifics.mutable_managed_user()->set_acknowledged(true); 142 specifics.mutable_managed_user()->set_acknowledged(true);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 EXPECT_FALSE(SupervisedUserSyncService::GetAvatarIndex( 362 EXPECT_FALSE(SupervisedUserSyncService::GetAvatarIndex(
363 "chrome-avatar-index:x", 363 "chrome-avatar-index:x",
364 &avatar)); 364 &avatar));
365 365
366 EXPECT_FALSE(SupervisedUserSyncService::GetAvatarIndex( 366 EXPECT_FALSE(SupervisedUserSyncService::GetAvatarIndex(
367 "chromeos-avatar-index:5", 367 "chromeos-avatar-index:5",
368 &avatar)); 368 &avatar));
369 #endif 369 #endif
370 } 370 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698