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

Unified Diff: components/user_prefs/tracked/pref_hash_filter_unittest.cc

Issue 1227973003: Componentize //chrome/browser/prefs/tracked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 4 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 | « components/user_prefs/tracked/pref_hash_filter.cc ('k') | components/user_prefs/tracked/pref_hash_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/user_prefs/tracked/pref_hash_filter_unittest.cc
diff --git a/chrome/browser/prefs/tracked/pref_hash_filter_unittest.cc b/components/user_prefs/tracked/pref_hash_filter_unittest.cc
similarity index 87%
rename from chrome/browser/prefs/tracked/pref_hash_filter_unittest.cc
rename to components/user_prefs/tracked/pref_hash_filter_unittest.cc
index 9f5649369c7f8c46bf6c1ba34653444972d5c21f..2d1f4d34c31d7055106f681e7a353b08ee607991 100644
--- a/chrome/browser/prefs/tracked/pref_hash_filter_unittest.cc
+++ b/components/user_prefs/tracked/pref_hash_filter_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/prefs/tracked/pref_hash_filter.h"
+#include "components/user_prefs/tracked/pref_hash_filter.h"
#include <map>
#include <set>
@@ -22,11 +22,11 @@
#include "base/metrics/statistics_recorder.h"
#include "base/prefs/testing_pref_store.h"
#include "base/values.h"
-#include "chrome/browser/prefs/tracked/hash_store_contents.h"
-#include "chrome/browser/prefs/tracked/mock_validation_delegate.h"
-#include "chrome/browser/prefs/tracked/pref_hash_store.h"
-#include "chrome/browser/prefs/tracked/pref_hash_store_transaction.h"
-#include "chrome/common/pref_names.h"
+#include "components/user_prefs/tracked/hash_store_contents.h"
+#include "components/user_prefs/tracked/mock_validation_delegate.h"
+#include "components/user_prefs/tracked/pref_hash_store.h"
+#include "components/user_prefs/tracked/pref_hash_store_transaction.h"
+#include "components/user_prefs/tracked/pref_names.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -40,41 +40,41 @@ const char kReportOnlySplitPref[] = "report_only_split_pref";
const char kSplitPref[] = "split_pref";
const PrefHashFilter::TrackedPreferenceMetadata kTestTrackedPrefs[] = {
- {
- 0, kAtomicPref, PrefHashFilter::ENFORCE_ON_LOAD,
- PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
- PrefHashFilter::VALUE_PERSONAL
- },
- {
- 1, kReportOnlyPref, PrefHashFilter::NO_ENFORCEMENT,
- PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
- PrefHashFilter::VALUE_IMPERSONAL
- },
- {
- 2, kSplitPref, PrefHashFilter::ENFORCE_ON_LOAD,
- PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- PrefHashFilter::VALUE_IMPERSONAL
- },
- {
- 3, kReportOnlySplitPref, PrefHashFilter::NO_ENFORCEMENT,
- PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- PrefHashFilter::VALUE_IMPERSONAL
- },
- {
- 4, kAtomicPref2, PrefHashFilter::ENFORCE_ON_LOAD,
- PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
- PrefHashFilter::VALUE_IMPERSONAL
- },
- {
- 5, kAtomicPref3, PrefHashFilter::ENFORCE_ON_LOAD,
- PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
- PrefHashFilter::VALUE_IMPERSONAL
- },
- {
- 6, kAtomicPref4, PrefHashFilter::ENFORCE_ON_LOAD,
- PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
- PrefHashFilter::VALUE_IMPERSONAL
- },
+ {0,
+ kAtomicPref,
+ PrefHashFilter::ENFORCE_ON_LOAD,
+ PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
+ PrefHashFilter::VALUE_PERSONAL},
+ {1,
+ kReportOnlyPref,
+ PrefHashFilter::NO_ENFORCEMENT,
+ PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
+ PrefHashFilter::VALUE_IMPERSONAL},
+ {2,
+ kSplitPref,
+ PrefHashFilter::ENFORCE_ON_LOAD,
+ PrefHashFilter::TRACKING_STRATEGY_SPLIT,
+ PrefHashFilter::VALUE_IMPERSONAL},
+ {3,
+ kReportOnlySplitPref,
+ PrefHashFilter::NO_ENFORCEMENT,
+ PrefHashFilter::TRACKING_STRATEGY_SPLIT,
+ PrefHashFilter::VALUE_IMPERSONAL},
+ {4,
+ kAtomicPref2,
+ PrefHashFilter::ENFORCE_ON_LOAD,
+ PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
+ PrefHashFilter::VALUE_IMPERSONAL},
+ {5,
+ kAtomicPref3,
+ PrefHashFilter::ENFORCE_ON_LOAD,
+ PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
+ PrefHashFilter::VALUE_IMPERSONAL},
+ {6,
+ kAtomicPref4,
+ PrefHashFilter::ENFORCE_ON_LOAD,
+ PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
+ PrefHashFilter::VALUE_IMPERSONAL},
};
} // namespace
@@ -122,14 +122,10 @@ class MockPrefHashStore : public PrefHashStore {
size_t transactions_performed() { return transactions_performed_; }
// Returns the number of paths checked.
- size_t checked_paths_count() const {
- return checked_values_.size();
- }
+ size_t checked_paths_count() const { return checked_values_.size(); }
// Returns the number of paths stored.
- size_t stored_paths_count() const {
- return stored_values_.size();
- }
+ size_t stored_paths_count() const { return stored_values_.size(); }
// Returns the pointer value and strategy that was passed to
// |CheckHash/CheckSplitHash| for |path|. The returned pointer could since
@@ -140,8 +136,8 @@ class MockPrefHashStore : public PrefHashStore {
if (value != checked_values_.end())
return value->second;
return std::make_pair(
- reinterpret_cast<void*>(0xBAD),
- static_cast<PrefHashFilter::PrefTrackingStrategy>(-1));
+ reinterpret_cast<void*>(0xBAD),
+ static_cast<PrefHashFilter::PrefTrackingStrategy>(-1));
}
// Returns the pointer value that was passed to |StoreHash/StoreSplitHash| for
@@ -153,8 +149,8 @@ class MockPrefHashStore : public PrefHashStore {
if (value != stored_values_.end())
return value->second;
return std::make_pair(
- reinterpret_cast<void*>(0xBAD),
- static_cast<PrefHashFilter::PrefTrackingStrategy>(-1));
+ reinterpret_cast<void*>(0xBAD),
+ static_cast<PrefHashFilter::PrefTrackingStrategy>(-1));
}
// PrefHashStore implementation.
@@ -212,7 +208,7 @@ class MockPrefHashStore : public PrefHashStore {
PrefHashFilter::PrefTrackingStrategy strategy);
std::map<std::string, PrefHashStoreTransaction::ValueState> check_results_;
- std::map<std::string, std::vector<std::string> > invalid_keys_results_;
+ std::map<std::string, std::vector<std::string>> invalid_keys_results_;
bool stamp_super_mac_result_;
bool is_super_mac_valid_result_;
@@ -231,7 +227,8 @@ class MockPrefHashStore : public PrefHashStore {
};
void MockPrefHashStore::SetCheckResult(
- const std::string& path, PrefHashStoreTransaction::ValueState result) {
+ const std::string& path,
+ PrefHashStoreTransaction::ValueState result) {
check_results_.insert(std::make_pair(path, result));
}
@@ -239,9 +236,8 @@ void MockPrefHashStore::SetInvalidKeysResult(
const std::string& path,
const std::vector<std::string>& invalid_keys_result) {
// Ensure |check_results_| has a CHANGED entry for |path|.
- std::map<std::string,
- PrefHashStoreTransaction::ValueState>::const_iterator result =
- check_results_.find(path);
+ std::map<std::string, PrefHashStoreTransaction::ValueState>::const_iterator
+ result = check_results_.find(path);
ASSERT_TRUE(result != check_results_.end());
ASSERT_EQ(PrefHashStoreTransaction::CHANGED, result->second);
@@ -261,11 +257,11 @@ PrefHashStoreTransaction::ValueState MockPrefHashStore::RecordCheckValue(
PrefHashFilter::PrefTrackingStrategy strategy) {
// Record that |path| was checked and validate that it wasn't previously
// checked.
- EXPECT_TRUE(checked_values_.insert(
- std::make_pair(path, std::make_pair(value, strategy))).second);
- std::map<std::string,
- PrefHashStoreTransaction::ValueState>::const_iterator result =
- check_results_.find(path);
+ EXPECT_TRUE(checked_values_.insert(std::make_pair(
+ path, std::make_pair(value, strategy)))
+ .second);
+ std::map<std::string, PrefHashStoreTransaction::ValueState>::const_iterator
+ result = check_results_.find(path);
if (result != check_results_.end())
return result->second;
return PrefHashStoreTransaction::UNCHANGED;
@@ -275,13 +271,16 @@ void MockPrefHashStore::RecordStoreHash(
const std::string& path,
const base::Value* new_value,
PrefHashFilter::PrefTrackingStrategy strategy) {
- EXPECT_TRUE(stored_values_.insert(
- std::make_pair(path, std::make_pair(new_value, strategy))).second);
+ EXPECT_TRUE(
+ stored_values_.insert(std::make_pair(path,
+ std::make_pair(new_value, strategy)))
+ .second);
}
PrefHashStoreTransaction::ValueState
MockPrefHashStore::MockPrefHashStoreTransaction::CheckValue(
- const std::string& path, const base::Value* value) const {
+ const std::string& path,
+ const base::Value* value) const {
return outer_->RecordCheckValue(path, value,
PrefHashFilter::TRACKING_STRATEGY_ATOMIC);
}
@@ -300,7 +299,7 @@ MockPrefHashStore::MockPrefHashStoreTransaction::CheckSplitValue(
std::vector<std::string>* invalid_keys) const {
EXPECT_TRUE(invalid_keys && invalid_keys->empty());
- std::map<std::string, std::vector<std::string> >::const_iterator
+ std::map<std::string, std::vector<std::string>>::const_iterator
invalid_keys_result = outer_->invalid_keys_results_.find(path);
if (invalid_keys_result != outer_->invalid_keys_results_.end()) {
invalid_keys->insert(invalid_keys->begin(),
@@ -320,19 +319,19 @@ void MockPrefHashStore::MockPrefHashStoreTransaction::StoreSplitHash(
}
bool MockPrefHashStore::MockPrefHashStoreTransaction::HasHash(
- const std::string& path) const {
+ const std::string& path) const {
ADD_FAILURE() << "Unexpected call.";
return false;
}
void MockPrefHashStore::MockPrefHashStoreTransaction::ImportHash(
const std::string& path,
- const base::Value* hash) {
+ const base::Value* hash) {
ADD_FAILURE() << "Unexpected call.";
}
void MockPrefHashStore::MockPrefHashStoreTransaction::ClearHash(
- const std::string& path) {
+ const std::string& path) {
// Allow this to be called by PrefHashFilter's deprecated tracked prefs
// cleanup tasks.
}
@@ -351,8 +350,7 @@ std::vector<PrefHashFilter::TrackedPreferenceMetadata> GetConfiguration(
kTestTrackedPrefs, kTestTrackedPrefs + arraysize(kTestTrackedPrefs));
for (std::vector<PrefHashFilter::TrackedPreferenceMetadata>::iterator it =
configuration.begin();
- it != configuration.end();
- ++it) {
+ it != configuration.end(); ++it) {
if (it->enforcement_level > max_enforcement_level)
it->enforcement_level = max_enforcement_level;
}
@@ -362,9 +360,10 @@ std::vector<PrefHashFilter::TrackedPreferenceMetadata> GetConfiguration(
class PrefHashFilterTest
: public testing::TestWithParam<PrefHashFilter::EnforcementLevel> {
public:
- PrefHashFilterTest() : mock_pref_hash_store_(NULL),
- pref_store_contents_(new base::DictionaryValue),
- reset_recorded_(false) {}
+ PrefHashFilterTest()
+ : mock_pref_hash_store_(NULL),
+ pref_store_contents_(new base::DictionaryValue),
+ reset_recorded_(false) {}
void SetUp() override {
base::StatisticsRecorder::Initialize();
@@ -387,12 +386,9 @@ class PrefHashFilterTest
new MockPrefHashStore);
mock_pref_hash_store_ = temp_mock_pref_hash_store.get();
pref_hash_filter_.reset(new PrefHashFilter(
- temp_mock_pref_hash_store.Pass(),
- configuration,
+ temp_mock_pref_hash_store.Pass(), configuration,
base::Bind(&PrefHashFilterTest::RecordReset, base::Unretained(this)),
- &mock_validation_delegate_,
- arraysize(kTestTrackedPrefs),
- true));
+ &mock_validation_delegate_, arraysize(kTestTrackedPrefs), true));
}
// Verifies whether a reset was reported by the PrefHashFiler. Also verifies
@@ -400,7 +396,8 @@ class PrefHashFilterTest
void VerifyRecordedReset(bool reset_expected) {
EXPECT_EQ(reset_expected, reset_recorded_);
EXPECT_EQ(reset_expected,
- pref_store_contents_->Get(prefs::kPreferenceResetTime, NULL));
+ pref_store_contents_->Get(
+ user_prefs::kPreferenceResetTime, NULL));
}
// Calls FilterOnLoad() on |pref_hash_Filter_|. |pref_store_contents_| is
@@ -452,8 +449,9 @@ TEST_P(PrefHashFilterTest, EmptyAndUnchanged) {
// Since there was nothing in |pref_store_contents_| the checked value should
// have been NULL for all tracked preferences.
for (size_t i = 0; i < arraysize(kTestTrackedPrefs); ++i) {
- ASSERT_EQ(NULL, mock_pref_hash_store_->checked_value(
- kTestTrackedPrefs[i].name).first);
+ ASSERT_EQ(
+ NULL,
+ mock_pref_hash_store_->checked_value(kTestTrackedPrefs[i].name).first);
}
ASSERT_EQ(1u, mock_pref_hash_store_->transactions_performed());
VerifyRecordedReset(false);
@@ -548,7 +546,7 @@ TEST_P(PrefHashFilterTest, FilterSplitPrefUpdate) {
pref_hash_filter_->FilterSerializeData(&root_dict);
ASSERT_EQ(1u, mock_pref_hash_store_->stored_paths_count());
MockPrefHashStore::ValuePtrStrategyPair stored_value =
- mock_pref_hash_store_->stored_value(kSplitPref);
+ mock_pref_hash_store_->stored_value(kSplitPref);
ASSERT_EQ(dict_value, stored_value.first);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_value.second);
@@ -617,7 +615,7 @@ TEST_P(PrefHashFilterTest, MultiplePrefsFilterSerializeData) {
stored_value_atomic3.second);
MockPrefHashStore::ValuePtrStrategyPair stored_value_split =
- mock_pref_hash_store_->stored_value(kSplitPref);
+ mock_pref_hash_store_->stored_value(kSplitPref);
ASSERT_EQ(dict_value, stored_value_split.first);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_value_split.second);
}
@@ -637,23 +635,21 @@ TEST_P(PrefHashFilterTest, UnknownNullValue) {
ASSERT_EQ(1u, mock_pref_hash_store_->transactions_performed());
MockPrefHashStore::ValuePtrStrategyPair stored_atomic_value =
- mock_pref_hash_store_->stored_value(kAtomicPref);
+ mock_pref_hash_store_->stored_value(kAtomicPref);
ASSERT_EQ(NULL, stored_atomic_value.first);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
stored_atomic_value.second);
MockPrefHashStore::ValuePtrStrategyPair stored_split_value =
- mock_pref_hash_store_->stored_value(kSplitPref);
+ mock_pref_hash_store_->stored_value(kSplitPref);
ASSERT_EQ(NULL, stored_split_value.first);
- ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- stored_split_value.second);
+ ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_split_value.second);
// Delegate saw all prefs, two of which had the expected value_state.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_validation_delegate_.recorded_validations_count());
- ASSERT_EQ(2u,
- mock_validation_delegate_.CountValidationsOfState(
- PrefHashStoreTransaction::TRUSTED_NULL_VALUE));
+ ASSERT_EQ(2u, mock_validation_delegate_.CountValidationsOfState(
+ PrefHashStoreTransaction::TRUSTED_NULL_VALUE));
ASSERT_EQ(arraysize(kTestTrackedPrefs) - 2u,
mock_validation_delegate_.CountValidationsOfState(
PrefHashStoreTransaction::UNCHANGED));
@@ -697,21 +693,19 @@ TEST_P(PrefHashFilterTest, InitialValueUnknown) {
// Delegate saw all prefs, two of which had the expected value_state.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_validation_delegate_.recorded_validations_count());
- ASSERT_EQ(2u,
- mock_validation_delegate_.CountValidationsOfState(
- PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE));
+ ASSERT_EQ(2u, mock_validation_delegate_.CountValidationsOfState(
+ PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE));
ASSERT_EQ(arraysize(kTestTrackedPrefs) - 2u,
mock_validation_delegate_.CountValidationsOfState(
PrefHashStoreTransaction::UNCHANGED));
MockPrefHashStore::ValuePtrStrategyPair stored_atomic_value =
- mock_pref_hash_store_->stored_value(kAtomicPref);
+ mock_pref_hash_store_->stored_value(kAtomicPref);
MockPrefHashStore::ValuePtrStrategyPair stored_split_value =
- mock_pref_hash_store_->stored_value(kSplitPref);
+ mock_pref_hash_store_->stored_value(kSplitPref);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
stored_atomic_value.second);
- ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- stored_split_value.second);
+ ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_split_value.second);
if (GetParam() == PrefHashFilter::ENFORCE_ON_LOAD) {
// Ensure the prefs were cleared and the hashes for NULL were restored if
// the current enforcement level denies seeding.
@@ -765,9 +759,8 @@ TEST_P(PrefHashFilterTest, InitialValueTrustedUnknown) {
// Delegate saw all prefs, two of which had the expected value_state.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_validation_delegate_.recorded_validations_count());
- ASSERT_EQ(2u,
- mock_validation_delegate_.CountValidationsOfState(
- PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE));
+ ASSERT_EQ(2u, mock_validation_delegate_.CountValidationsOfState(
+ PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE));
ASSERT_EQ(arraysize(kTestTrackedPrefs) - 2u,
mock_validation_delegate_.CountValidationsOfState(
PrefHashStoreTransaction::UNCHANGED));
@@ -777,7 +770,7 @@ TEST_P(PrefHashFilterTest, InitialValueTrustedUnknown) {
ASSERT_TRUE(pref_store_contents_->Get(kAtomicPref, &atomic_value_in_store));
ASSERT_EQ(string_value, atomic_value_in_store);
MockPrefHashStore::ValuePtrStrategyPair stored_atomic_value =
- mock_pref_hash_store_->stored_value(kAtomicPref);
+ mock_pref_hash_store_->stored_value(kAtomicPref);
ASSERT_EQ(string_value, stored_atomic_value.first);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
stored_atomic_value.second);
@@ -786,10 +779,9 @@ TEST_P(PrefHashFilterTest, InitialValueTrustedUnknown) {
ASSERT_TRUE(pref_store_contents_->Get(kSplitPref, &split_value_in_store));
ASSERT_EQ(dict_value, split_value_in_store);
MockPrefHashStore::ValuePtrStrategyPair stored_split_value =
- mock_pref_hash_store_->stored_value(kSplitPref);
+ mock_pref_hash_store_->stored_value(kSplitPref);
ASSERT_EQ(dict_value, stored_split_value.first);
- ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- stored_split_value.second);
+ ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_split_value.second);
}
TEST_P(PrefHashFilterTest, InitialValueChanged) {
@@ -824,13 +816,12 @@ TEST_P(PrefHashFilterTest, InitialValueChanged) {
ASSERT_EQ(1u, mock_pref_hash_store_->transactions_performed());
MockPrefHashStore::ValuePtrStrategyPair stored_atomic_value =
- mock_pref_hash_store_->stored_value(kAtomicPref);
+ mock_pref_hash_store_->stored_value(kAtomicPref);
MockPrefHashStore::ValuePtrStrategyPair stored_split_value =
- mock_pref_hash_store_->stored_value(kSplitPref);
+ mock_pref_hash_store_->stored_value(kSplitPref);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
stored_atomic_value.second);
- ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- stored_split_value.second);
+ ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_split_value.second);
if (GetParam() == PrefHashFilter::ENFORCE_ON_LOAD) {
// Ensure the atomic pref was cleared and the hash for NULL was restored if
// the current enforcement level prevents changes.
@@ -887,9 +878,8 @@ TEST_P(PrefHashFilterTest, EmptyCleared) {
// Delegate saw all prefs, two of which had the expected value_state.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_validation_delegate_.recorded_validations_count());
- ASSERT_EQ(2u,
- mock_validation_delegate_.CountValidationsOfState(
- PrefHashStoreTransaction::CLEARED));
+ ASSERT_EQ(2u, mock_validation_delegate_.CountValidationsOfState(
+ PrefHashStoreTransaction::CLEARED));
ASSERT_EQ(arraysize(kTestTrackedPrefs) - 2u,
mock_validation_delegate_.CountValidationsOfState(
PrefHashStoreTransaction::UNCHANGED));
@@ -898,17 +888,16 @@ TEST_P(PrefHashFilterTest, EmptyCleared) {
// to restore the hash for NULL. The value itself should still be NULL.
ASSERT_FALSE(pref_store_contents_->Get(kAtomicPref, NULL));
MockPrefHashStore::ValuePtrStrategyPair stored_atomic_value =
- mock_pref_hash_store_->stored_value(kAtomicPref);
+ mock_pref_hash_store_->stored_value(kAtomicPref);
ASSERT_EQ(NULL, stored_atomic_value.first);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
stored_atomic_value.second);
ASSERT_FALSE(pref_store_contents_->Get(kSplitPref, NULL));
MockPrefHashStore::ValuePtrStrategyPair stored_split_value =
- mock_pref_hash_store_->stored_value(kSplitPref);
+ mock_pref_hash_store_->stored_value(kSplitPref);
ASSERT_EQ(NULL, stored_split_value.first);
- ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- stored_split_value.second);
+ ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_split_value.second);
}
TEST_P(PrefHashFilterTest, InitialValueUnchangedLegacyId) {
@@ -936,9 +925,8 @@ TEST_P(PrefHashFilterTest, InitialValueUnchangedLegacyId) {
// Delegate saw all prefs, two of which had the expected value_state.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_validation_delegate_.recorded_validations_count());
- ASSERT_EQ(2u,
- mock_validation_delegate_.CountValidationsOfState(
- PrefHashStoreTransaction::SECURE_LEGACY));
+ ASSERT_EQ(2u, mock_validation_delegate_.CountValidationsOfState(
+ PrefHashStoreTransaction::SECURE_LEGACY));
ASSERT_EQ(arraysize(kTestTrackedPrefs) - 2u,
mock_validation_delegate_.CountValidationsOfState(
PrefHashStoreTransaction::UNCHANGED));
@@ -950,7 +938,7 @@ TEST_P(PrefHashFilterTest, InitialValueUnchangedLegacyId) {
// have been updated to match them.
MockPrefHashStore::ValuePtrStrategyPair stored_atomic_value =
- mock_pref_hash_store_->stored_value(kAtomicPref);
+ mock_pref_hash_store_->stored_value(kAtomicPref);
ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_ATOMIC,
stored_atomic_value.second);
const base::Value* atomic_value_in_store;
@@ -959,9 +947,8 @@ TEST_P(PrefHashFilterTest, InitialValueUnchangedLegacyId) {
ASSERT_EQ(string_value, stored_atomic_value.first);
MockPrefHashStore::ValuePtrStrategyPair stored_split_value =
- mock_pref_hash_store_->stored_value(kSplitPref);
- ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT,
- stored_split_value.second);
+ mock_pref_hash_store_->stored_value(kSplitPref);
+ ASSERT_EQ(PrefHashFilter::TRACKING_STRATEGY_SPLIT, stored_split_value.second);
const base::Value* split_value_in_store;
ASSERT_TRUE(pref_store_contents_->Get(kSplitPref, &split_value_in_store));
ASSERT_EQ(dict_value, split_value_in_store);
@@ -1007,9 +994,8 @@ TEST_P(PrefHashFilterTest, DontResetReportOnly) {
// Delegate saw all prefs, four of which had the expected value_state.
ASSERT_EQ(arraysize(kTestTrackedPrefs),
mock_validation_delegate_.recorded_validations_count());
- ASSERT_EQ(4u,
- mock_validation_delegate_.CountValidationsOfState(
- PrefHashStoreTransaction::CHANGED));
+ ASSERT_EQ(4u, mock_validation_delegate_.CountValidationsOfState(
+ PrefHashStoreTransaction::CHANGED));
ASSERT_EQ(arraysize(kTestTrackedPrefs) - 4u,
mock_validation_delegate_.CountValidationsOfState(
PrefHashStoreTransaction::UNCHANGED));
@@ -1047,7 +1033,7 @@ TEST_P(PrefHashFilterTest, DontResetReportOnly) {
}
}
-INSTANTIATE_TEST_CASE_P(
- PrefHashFilterTestInstance, PrefHashFilterTest,
- testing::Values(PrefHashFilter::NO_ENFORCEMENT,
- PrefHashFilter::ENFORCE_ON_LOAD));
+INSTANTIATE_TEST_CASE_P(PrefHashFilterTestInstance,
+ PrefHashFilterTest,
+ testing::Values(PrefHashFilter::NO_ENFORCEMENT,
+ PrefHashFilter::ENFORCE_ON_LOAD));
« no previous file with comments | « components/user_prefs/tracked/pref_hash_filter.cc ('k') | components/user_prefs/tracked/pref_hash_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698