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

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

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 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 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 <vector> 7 #include <vector>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 }; 44 };
45 45
46 // Observes changes to the PrefStore and verifies that only registered prefs are 46 // Observes changes to the PrefStore and verifies that only registered prefs are
47 // written. 47 // written.
48 class RegistryVerifier : public PrefStore::Observer { 48 class RegistryVerifier : public PrefStore::Observer {
49 public: 49 public:
50 explicit RegistryVerifier(PrefRegistry* pref_registry) 50 explicit RegistryVerifier(PrefRegistry* pref_registry)
51 : pref_registry_(pref_registry) {} 51 : pref_registry_(pref_registry) {}
52 52
53 // PrefStore::Observer implementation 53 // PrefStore::Observer implementation
54 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE { 54 virtual void OnPrefValueChanged(const std::string& key) override {
55 EXPECT_TRUE(pref_registry_->end() != 55 EXPECT_TRUE(pref_registry_->end() !=
56 std::find_if(pref_registry_->begin(), 56 std::find_if(pref_registry_->begin(),
57 pref_registry_->end(), 57 pref_registry_->end(),
58 FirstEqualsPredicate(key))) 58 FirstEqualsPredicate(key)))
59 << "Unregistered key " << key << " was changed."; 59 << "Unregistered key " << key << " was changed.";
60 } 60 }
61 61
62 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE {} 62 virtual void OnInitializationCompleted(bool succeeded) override {}
63 63
64 private: 64 private:
65 scoped_refptr<PrefRegistry> pref_registry_; 65 scoped_refptr<PrefRegistry> pref_registry_;
66 }; 66 };
67 67
68 const char kUnprotectedPref[] = "unprotected_pref"; 68 const char kUnprotectedPref[] = "unprotected_pref";
69 const char kTrackedAtomic[] = "tracked_atomic"; 69 const char kTrackedAtomic[] = "tracked_atomic";
70 const char kProtectedAtomic[] = "protected_atomic"; 70 const char kProtectedAtomic[] = "protected_atomic";
71 71
72 const char kFoobar[] = "FOOBAR"; 72 const char kFoobar[] = "FOOBAR";
(...skipping 15 matching lines...) Expand all
88 class ProfilePrefStoreManagerTest : public testing::Test { 88 class ProfilePrefStoreManagerTest : public testing::Test {
89 public: 89 public:
90 ProfilePrefStoreManagerTest() 90 ProfilePrefStoreManagerTest()
91 : configuration_(kConfiguration, 91 : configuration_(kConfiguration,
92 kConfiguration + arraysize(kConfiguration)), 92 kConfiguration + arraysize(kConfiguration)),
93 profile_pref_registry_(new user_prefs::PrefRegistrySyncable), 93 profile_pref_registry_(new user_prefs::PrefRegistrySyncable),
94 registry_verifier_(profile_pref_registry_.get()), 94 registry_verifier_(profile_pref_registry_.get()),
95 seed_("seed"), 95 seed_("seed"),
96 reset_recorded_(false) {} 96 reset_recorded_(false) {}
97 97
98 virtual void SetUp() OVERRIDE { 98 virtual void SetUp() override {
99 ProfilePrefStoreManager::RegisterPrefs(local_state_.registry()); 99 ProfilePrefStoreManager::RegisterPrefs(local_state_.registry());
100 ProfilePrefStoreManager::RegisterProfilePrefs(profile_pref_registry_.get()); 100 ProfilePrefStoreManager::RegisterProfilePrefs(profile_pref_registry_.get());
101 for (const PrefHashFilter::TrackedPreferenceMetadata* it = kConfiguration; 101 for (const PrefHashFilter::TrackedPreferenceMetadata* it = kConfiguration;
102 it != kConfiguration + arraysize(kConfiguration); 102 it != kConfiguration + arraysize(kConfiguration);
103 ++it) { 103 ++it) {
104 if (it->strategy == PrefHashFilter::TRACKING_STRATEGY_ATOMIC) { 104 if (it->strategy == PrefHashFilter::TRACKING_STRATEGY_ATOMIC) {
105 profile_pref_registry_->RegisterStringPref( 105 profile_pref_registry_->RegisterStringPref(
106 it->name, 106 it->name,
107 std::string(), 107 std::string(),
108 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 108 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
(...skipping 24 matching lines...) Expand all
133 133
134 void ReloadConfiguration() { 134 void ReloadConfiguration() {
135 manager_.reset(new ProfilePrefStoreManager(profile_dir_.path(), 135 manager_.reset(new ProfilePrefStoreManager(profile_dir_.path(),
136 configuration_, 136 configuration_,
137 kReportingIdCount, 137 kReportingIdCount,
138 seed_, 138 seed_,
139 "device_id", 139 "device_id",
140 &local_state_)); 140 &local_state_));
141 } 141 }
142 142
143 virtual void TearDown() OVERRIDE { DestroyPrefStore(); } 143 virtual void TearDown() override { DestroyPrefStore(); }
144 144
145 protected: 145 protected:
146 // Verifies whether a reset was reported via the RecordReset() hook. Also 146 // Verifies whether a reset was reported via the RecordReset() hook. Also
147 // verifies that GetResetTime() was set (or not) accordingly. 147 // verifies that GetResetTime() was set (or not) accordingly.
148 void VerifyResetRecorded(bool reset_expected) { 148 void VerifyResetRecorded(bool reset_expected) {
149 EXPECT_EQ(reset_expected, reset_recorded_); 149 EXPECT_EQ(reset_expected, reset_recorded_);
150 150
151 base::PrefServiceFactory pref_service_factory; 151 base::PrefServiceFactory pref_service_factory;
152 pref_service_factory.set_user_prefs(pref_store_); 152 pref_service_factory.set_user_prefs(pref_store_);
153 153
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 LoadExistingPrefs(); 578 LoadExistingPrefs();
579 ExpectStringValueEquals(kProtectedAtomic, kHelloWorld); 579 ExpectStringValueEquals(kProtectedAtomic, kHelloWorld);
580 580
581 // Trigger the logic that migrates it back to the unprotected preferences 581 // Trigger the logic that migrates it back to the unprotected preferences
582 // file. 582 // file.
583 pref_store_->SetValue(kProtectedAtomic, new base::StringValue(kGoodbyeWorld)); 583 pref_store_->SetValue(kProtectedAtomic, new base::StringValue(kGoodbyeWorld));
584 LoadExistingPrefs(); 584 LoadExistingPrefs();
585 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); 585 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld);
586 VerifyResetRecorded(false); 586 VerifyResetRecorded(false);
587 } 587 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/prefs_syncable_service_unittest.cc ('k') | chrome/browser/prefs/proxy_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698