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

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

Issue 226633002: Commit changes after a reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't commit, just schedule. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/pref_hash_filter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_hash_filter_unittest.cc
diff --git a/chrome/browser/prefs/pref_hash_filter_unittest.cc b/chrome/browser/prefs/pref_hash_filter_unittest.cc
index ce75d506af199397eebec4d01880ca2e78a0f080..e19f46c69a235c54245f0a9f12d1670d9a33e032 100644
--- a/chrome/browser/prefs/pref_hash_filter_unittest.cc
+++ b/chrome/browser/prefs/pref_hash_filter_unittest.cc
@@ -340,7 +340,7 @@ class PrefHashFilterTest
};
TEST_P(PrefHashFilterTest, EmptyAndUnchanged) {
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+ ASSERT_FALSE(pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
// All paths checked.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
@@ -476,7 +476,7 @@ TEST_P(PrefHashFilterTest, EmptyAndUnknown) {
kAtomicPref, PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE);
mock_pref_hash_store_->SetCheckResult(
kSplitPref, PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+ ASSERT_FALSE(pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
ASSERT_EQ(2u, mock_pref_hash_store_->stored_paths_count());
@@ -512,7 +512,9 @@ TEST_P(PrefHashFilterTest, InitialValueUnknown) {
kAtomicPref, PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE);
mock_pref_hash_store_->SetCheckResult(
kSplitPref, PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+ // If we are enforcing, expect this to report changes.
+ ASSERT_EQ(GetParam() >= PrefHashFilter::ENFORCE_ON_LOAD,
+ pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
ASSERT_EQ(2u, mock_pref_hash_store_->stored_paths_count());
@@ -570,7 +572,7 @@ TEST_P(PrefHashFilterTest, InitialValueTrustedUnknown) {
kAtomicPref, PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE);
mock_pref_hash_store_->SetCheckResult(
kSplitPref, PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+ ASSERT_FALSE(pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
ASSERT_EQ(2u, mock_pref_hash_store_->stored_paths_count());
@@ -621,7 +623,8 @@ TEST_P(PrefHashFilterTest, InitialValueChanged) {
mock_invalid_keys.push_back("c");
mock_pref_hash_store_->SetInvalidKeysResult(kSplitPref, mock_invalid_keys);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+ ASSERT_EQ(GetParam() >= PrefHashFilter::ENFORCE_ON_LOAD,
+ pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
ASSERT_EQ(2u, mock_pref_hash_store_->stored_paths_count());
@@ -682,7 +685,7 @@ TEST_P(PrefHashFilterTest, EmptyCleared) {
PrefHashStoreTransaction::CLEARED);
mock_pref_hash_store_->SetCheckResult(kSplitPref,
PrefHashStoreTransaction::CLEARED);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+ ASSERT_FALSE(pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
ASSERT_EQ(2u, mock_pref_hash_store_->stored_paths_count());
@@ -717,7 +720,9 @@ TEST_P(PrefHashFilterTest, InitialValueMigrated) {
mock_pref_hash_store_->SetCheckResult(kAtomicPref,
PrefHashStoreTransaction::WEAK_LEGACY);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+
+ ASSERT_EQ(GetParam() >= PrefHashFilter::ENFORCE_ON_LOAD,
+ pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
ASSERT_EQ(1u, mock_pref_hash_store_->stored_paths_count());
@@ -763,7 +768,7 @@ TEST_P(PrefHashFilterTest, InitialValueUnchangedLegacyId) {
kAtomicPref, PrefHashStoreTransaction::SECURE_LEGACY);
mock_pref_hash_store_->SetCheckResult(
kSplitPref, PrefHashStoreTransaction::SECURE_LEGACY);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+ ASSERT_FALSE(pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_pref_hash_store_->checked_paths_count());
ASSERT_EQ(1u, mock_pref_hash_store_->transactions_performed());
@@ -820,7 +825,9 @@ TEST_P(PrefHashFilterTest, DontResetReportOnly) {
PrefHashStoreTransaction::CHANGED);
mock_pref_hash_store_->SetCheckResult(kReportOnlySplitPref,
PrefHashStoreTransaction::CHANGED);
- pref_hash_filter_->FilterOnLoad(&pref_store_contents_);
+
+ ASSERT_EQ(GetParam() >= PrefHashFilter::ENFORCE_ON_LOAD,
+ pref_hash_filter_->FilterOnLoad(&pref_store_contents_));
// All prefs should be checked and a new hash should be stored for each tested
// pref.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
« no previous file with comments | « chrome/browser/prefs/pref_hash_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698