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

Side by Side Diff: components/prefs/pref_service_unittest.cc

Issue 2784513002: Move PrefRegistrySimple to use unique_ptr<Value> (Closed)
Patch Set: Android Created 3 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 (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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG}, 308 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG},
309 {"custom", 309 {"custom",
310 kCustomRegistrationFlag, 310 kCustomRegistrationFlag,
311 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS}, 311 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS},
312 {"lossyandcustom", 312 {"lossyandcustom",
313 PrefRegistry::LOSSY_PREF | kCustomRegistrationFlag, 313 PrefRegistry::LOSSY_PREF | kCustomRegistrationFlag,
314 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG}}; 314 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG}};
315 315
316 for (size_t i = 0; i < arraysize(kRegistrationToWriteFlags); ++i) { 316 for (size_t i = 0; i < arraysize(kRegistrationToWriteFlags); ++i) {
317 RegistrationToWriteFlags entry = kRegistrationToWriteFlags[i]; 317 RegistrationToWriteFlags entry = kRegistrationToWriteFlags[i];
318 registry->RegisterDictionaryPref( 318 registry->RegisterDictionaryPref(entry.pref_name,
319 entry.pref_name, new base::DictionaryValue(), entry.registration_flags); 319 base::MakeUnique<base::DictionaryValue>(),
320 entry.registration_flags);
320 321
321 SCOPED_TRACE("Currently testing pref with name: " + 322 SCOPED_TRACE("Currently testing pref with name: " +
322 std::string(entry.pref_name)); 323 std::string(entry.pref_name));
323 324
324 prefs->GetMutableUserPref(entry.pref_name, base::Value::Type::DICTIONARY); 325 prefs->GetMutableUserPref(entry.pref_name, base::Value::Type::DICTIONARY);
325 EXPECT_TRUE(flag_checker->last_write_flags_set()); 326 EXPECT_TRUE(flag_checker->last_write_flags_set());
326 EXPECT_EQ(entry.write_flags, flag_checker->GetLastFlagsAndClear()); 327 EXPECT_EQ(entry.write_flags, flag_checker->GetLastFlagsAndClear());
327 328
328 prefs->ReportUserPrefChanged(entry.pref_name); 329 prefs->ReportUserPrefChanged(entry.pref_name);
329 EXPECT_TRUE(flag_checker->last_write_flags_set()); 330 EXPECT_TRUE(flag_checker->last_write_flags_set());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 423
423 EXPECT_CALL(observer_, OnPreferenceChanged(_)).Times(0); 424 EXPECT_CALL(observer_, OnPreferenceChanged(_)).Times(0);
424 prefs_.Set(kName, new_value); 425 prefs_.Set(kName, new_value);
425 Mock::VerifyAndClearExpectations(&observer_); 426 Mock::VerifyAndClearExpectations(&observer_);
426 427
427 base::ListValue empty; 428 base::ListValue empty;
428 observer_.Expect(kName, &empty); 429 observer_.Expect(kName, &empty);
429 prefs_.Set(kName, empty); 430 prefs_.Set(kName, empty);
430 Mock::VerifyAndClearExpectations(&observer_); 431 Mock::VerifyAndClearExpectations(&observer_);
431 } 432 }
OLDNEW
« no previous file with comments | « components/prefs/pref_registry_simple.cc ('k') | components/proxy_config/pref_proxy_config_tracker_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698