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

Unified Diff: chrome/browser/prefs/profile_pref_store_manager_unittest.cc

Issue 220203011: Changes requested by gab for previously committed CLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't commit if we didn't make any changes. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/profile_pref_store_manager_unittest.cc
diff --git a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
index 064cab0e9088b476a34ef8343cebe03b02d5a5dd..cca594799c2f82e2e6aa4bdfbd05afcac7a59e16 100644
--- a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
+++ b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc
@@ -62,7 +62,7 @@ class RegistryVerifier : public PrefStore::Observer {
scoped_refptr<PrefRegistry> pref_registry_;
};
-const char kUnprotectedAtomic[] = "unprotected_atomic";
+const char kUnprotectedPref[] = "unprotected_pref";
const char kTrackedAtomic[] = "tracked_atomic";
const char kProtectedAtomic[] = "protected_atomic";
@@ -98,14 +98,16 @@ class ProfilePrefStoreManagerTest : public testing::Test {
++it) {
if (it->strategy == PrefHashFilter::TRACKING_STRATEGY_ATOMIC) {
profile_pref_registry_->RegisterStringPref(
- it->name, "", user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+ it->name,
+ std::string(),
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
} else {
profile_pref_registry_->RegisterDictionaryPref(
it->name, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
}
}
profile_pref_registry_->RegisterStringPref(
- kUnprotectedAtomic,
+ kUnprotectedPref,
std::string(),
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
@@ -176,7 +178,7 @@ class ProfilePrefStoreManagerTest : public testing::Test {
EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_NO_FILE, error);
pref_store->SetValue(kTrackedAtomic, new base::StringValue(kFoobar));
pref_store->SetValue(kProtectedAtomic, new base::StringValue(kHelloWorld));
- pref_store->SetValue(kUnprotectedAtomic, new base::StringValue(kFoobar));
+ pref_store->SetValue(kUnprotectedPref, new base::StringValue(kFoobar));
pref_store->RemoveObserver(&registry_verifier_);
pref_store->CommitPendingWrite();
base::RunLoop().RunUntilIdle();
@@ -280,8 +282,8 @@ TEST_F(ProfilePrefStoreManagerTest, ResetPrefHashStore) {
// kTrackedAtomic is loaded as it appears on disk.
ExpectStringValueEquals(kTrackedAtomic, kFoobar);
- // If preference tracking is supported, the tampered value of kProtectedAtomic
- // will be discarded at load time, leaving this preference undefined.
+ // If preference tracking is supported, kProtectedAtomic will be undefined
+ // because the value was discarded due to loss of the hash store contents.
EXPECT_NE(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
pref_store_->GetValue(kProtectedAtomic, NULL));
EXPECT_EQ(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
@@ -342,12 +344,10 @@ TEST_F(ProfilePrefStoreManagerTest, UpdateProfileHashStoreIfRequired) {
}
TEST_F(ProfilePrefStoreManagerTest, InitializePrefsFromMasterPrefs) {
- scoped_ptr<base::DictionaryValue> master_prefs(
- new base::DictionaryValue);
- master_prefs->Set(kTrackedAtomic, new base::StringValue(kFoobar));
- master_prefs->Set(kProtectedAtomic, new base::StringValue(kHelloWorld));
- EXPECT_TRUE(
- manager_->InitializePrefsFromMasterPrefs(*master_prefs));
+ base::DictionaryValue master_prefs;
+ master_prefs.Set(kTrackedAtomic, new base::StringValue(kFoobar));
+ master_prefs.Set(kProtectedAtomic, new base::StringValue(kHelloWorld));
+ EXPECT_TRUE(manager_->InitializePrefsFromMasterPrefs(master_prefs));
LoadExistingPrefs();
@@ -361,7 +361,7 @@ TEST_F(ProfilePrefStoreManagerTest, InitializePrefsFromMasterPrefs) {
TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtected) {
InitializePrefs();
LoadExistingPrefs();
- ExpectStringValueEquals(kUnprotectedAtomic, kFoobar);
+ ExpectStringValueEquals(kUnprotectedPref, kFoobar);
// Ensure everything is written out to disk.
DestroyPrefStore();
@@ -370,11 +370,11 @@ TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtected) {
// It's unprotected, so we can load the modified value.
LoadExistingPrefs();
- ExpectStringValueEquals(kUnprotectedAtomic, kBarfoo);
+ ExpectStringValueEquals(kUnprotectedPref, kBarfoo);
// Now update the configuration to protect it.
PrefHashFilter::TrackedPreferenceMetadata new_protected = {
- kExtraReportingId, kUnprotectedAtomic, PrefHashFilter::ENFORCE_ON_LOAD,
+ kExtraReportingId, kUnprotectedPref, PrefHashFilter::ENFORCE_ON_LOAD,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC};
configuration_.push_back(new_protected);
ReloadConfiguration();
@@ -384,7 +384,7 @@ TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtected) {
// Since there was a valid super MAC we were able to extend the existing trust
// to the newly proteted preference.
- ExpectStringValueEquals(kUnprotectedAtomic, kBarfoo);
+ ExpectStringValueEquals(kUnprotectedPref, kBarfoo);
EXPECT_FALSE(WasResetRecorded());
// Ensure everything is written out to disk.
@@ -395,7 +395,7 @@ TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtected) {
ReplaceStringInPrefs(kBarfoo, kFoobar);
LoadExistingPrefs();
EXPECT_NE(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
- pref_store_->GetValue(kUnprotectedAtomic, NULL));
+ pref_store_->GetValue(kUnprotectedPref, NULL));
EXPECT_EQ(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
WasResetRecorded());
}
@@ -405,7 +405,7 @@ TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtectedWithoutTrust) {
// Now update the configuration to protect it.
PrefHashFilter::TrackedPreferenceMetadata new_protected = {
- kExtraReportingId, kUnprotectedAtomic, PrefHashFilter::ENFORCE_ON_LOAD,
+ kExtraReportingId, kUnprotectedPref, PrefHashFilter::ENFORCE_ON_LOAD,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC};
configuration_.push_back(new_protected);
ReloadConfiguration();
@@ -414,10 +414,10 @@ TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtectedWithoutTrust) {
// And try loading with the new configuration.
LoadExistingPrefs();
- // If preference tracking is supported, kUnprotectedAtomic will have been
+ // If preference tracking is supported, kUnprotectedPref will have been
// discarded because new values are not accepted without a valid super MAC.
EXPECT_NE(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
- pref_store_->GetValue(kUnprotectedAtomic, NULL));
+ pref_store_->GetValue(kUnprotectedPref, NULL));
EXPECT_EQ(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking,
WasResetRecorded());
}
« no previous file with comments | « chrome/browser/prefs/profile_pref_store_manager.cc ('k') | chrome/browser/prefs/tracked/segregated_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698