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

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

Issue 2304573002: Add ComputeMac and ComputeSplitMacs methods to pref_hash_store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase-update'd Created 4 years, 3 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 | « no previous file | 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/components/user_prefs/tracked/pref_hash_filter_unittest.cc b/components/user_prefs/tracked/pref_hash_filter_unittest.cc
index 4c705367cad33391a7fd99affd2d15e07afd7306..c100c0cf239df0beebd46e2d59143c2a2fd4252b 100644
--- a/components/user_prefs/tracked/pref_hash_filter_unittest.cc
+++ b/components/user_prefs/tracked/pref_hash_filter_unittest.cc
@@ -158,6 +158,11 @@ class MockPrefHashStore : public PrefHashStore {
// PrefHashStore implementation.
std::unique_ptr<PrefHashStoreTransaction> BeginTransaction(
HashStoreContents* storage) override;
+ std::string ComputeMac(const std::string& path,
+ const base::Value* new_value) override;
+ std::unique_ptr<base::DictionaryValue> ComputeSplitMacs(
+ const std::string& path,
+ const base::DictionaryValue* split_values) override;
private:
// A MockPrefHashStoreTransaction is handed to the caller on
@@ -253,6 +258,23 @@ std::unique_ptr<PrefHashStoreTransaction> MockPrefHashStore::BeginTransaction(
new MockPrefHashStoreTransaction(this));
}
+std::string MockPrefHashStore::ComputeMac(const std::string& path,
+ const base::Value* new_value) {
+ return "atomic mac for: " + path;
+};
+
+std::unique_ptr<base::DictionaryValue> MockPrefHashStore::ComputeSplitMacs(
+ const std::string& path,
+ const base::DictionaryValue* split_values) {
+ std::unique_ptr<base::DictionaryValue> macs_dict(new base::DictionaryValue);
+ for (base::DictionaryValue::Iterator it(*split_values); !it.IsAtEnd();
+ it.Advance()) {
+ macs_dict->SetStringWithoutPathExpansion(
+ it.key(), "split mac for: " + path + "/" + it.key());
+ }
+ return macs_dict;
+};
+
PrefHashStoreTransaction::ValueState MockPrefHashStore::RecordCheckValue(
const std::string& path,
const base::Value* value,
« no previous file with comments | « no previous file | components/user_prefs/tracked/pref_hash_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698