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

Side by Side Diff: chrome/browser/prefs/profile_pref_store_manager_unittest.cc

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky 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 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 "chrome/browser/prefs/profile_pref_store_manager.h" 5 #include "chrome/browser/prefs/profile_pref_store_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // case... 194 // case...
195 base::RunLoop().RunUntilIdle(); 195 base::RunLoop().RunUntilIdle();
196 } 196 }
197 } 197 }
198 198
199 void InitializePrefStore(PersistentPrefStore* pref_store) { 199 void InitializePrefStore(PersistentPrefStore* pref_store) {
200 pref_store->AddObserver(&registry_verifier_); 200 pref_store->AddObserver(&registry_verifier_);
201 PersistentPrefStore::PrefReadError error = pref_store->ReadPrefs(); 201 PersistentPrefStore::PrefReadError error = pref_store->ReadPrefs();
202 EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_NO_FILE, error); 202 EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_NO_FILE, error);
203 pref_store->SetValue(kTrackedAtomic, 203 pref_store->SetValue(kTrackedAtomic,
204 base::WrapUnique(new base::StringValue(kFoobar)), 204 base::MakeUnique<base::StringValue>(kFoobar),
205 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 205 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
206 pref_store->SetValue(kProtectedAtomic, 206 pref_store->SetValue(kProtectedAtomic,
207 base::WrapUnique(new base::StringValue(kHelloWorld)), 207 base::MakeUnique<base::StringValue>(kHelloWorld),
208 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 208 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
209 pref_store->SetValue(kUnprotectedPref, 209 pref_store->SetValue(kUnprotectedPref,
210 base::WrapUnique(new base::StringValue(kFoobar)), 210 base::MakeUnique<base::StringValue>(kFoobar),
211 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 211 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
212 pref_store->RemoveObserver(&registry_verifier_); 212 pref_store->RemoveObserver(&registry_verifier_);
213 pref_store->CommitPendingWrite(); 213 pref_store->CommitPendingWrite();
214 base::RunLoop().RunUntilIdle(); 214 base::RunLoop().RunUntilIdle();
215 } 215 }
216 216
217 void LoadExistingPrefs() { 217 void LoadExistingPrefs() {
218 DestroyPrefStore(); 218 DestroyPrefStore();
219 pref_store_ = manager_->CreateProfilePrefStore( 219 pref_store_ = manager_->CreateProfilePrefStore(
220 main_message_loop_.task_runner(), 220 main_message_loop_.task_runner(),
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 // Trigger the logic that migrates it back to the unprotected preferences 484 // Trigger the logic that migrates it back to the unprotected preferences
485 // file. 485 // file.
486 pref_store_->SetValue(kProtectedAtomic, 486 pref_store_->SetValue(kProtectedAtomic,
487 base::WrapUnique(new base::StringValue(kGoodbyeWorld)), 487 base::WrapUnique(new base::StringValue(kGoodbyeWorld)),
488 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 488 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
489 LoadExistingPrefs(); 489 LoadExistingPrefs();
490 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); 490 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld);
491 VerifyResetRecorded(false); 491 VerifyResetRecorded(false);
492 } 492 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.cc ('k') | chrome/browser/prefs/proxy_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698