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

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

Issue 2384213002: Send a TrackedPreference incident when registry pref validation fails. (Closed)
Patch Set: Improve split preference handling and address comments on #3 Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/user_prefs/tracked/mock_validation_delegate.cc
diff --git a/components/user_prefs/tracked/mock_validation_delegate.cc b/components/user_prefs/tracked/mock_validation_delegate.cc
index d2936af55be33e3d98ce79ae1c526791cbe9f6f1..e0e88283c48a3458bcef224f562278665c3dbb02 100644
--- a/components/user_prefs/tracked/mock_validation_delegate.cc
+++ b/components/user_prefs/tracked/mock_validation_delegate.cc
@@ -20,6 +20,16 @@ size_t MockValidationDelegate::CountValidationsOfState(
return count;
}
+size_t MockValidationDelegate::CountExternalValidationsOfState(
+ PrefHashStoreTransaction::ValueState value_state) const {
+ size_t count = 0;
+ for (size_t i = 0; i < validations_.size(); ++i) {
+ if (validations_[i].external_validation_value_state == value_state)
+ ++count;
+ }
+ return count;
+}
+
const MockValidationDelegate::ValidationEvent*
MockValidationDelegate::GetEventForPath(const std::string& pref_path) const {
for (size_t i = 0; i < validations_.size(); ++i) {
@@ -33,26 +43,31 @@ void MockValidationDelegate::OnAtomicPreferenceValidation(
const std::string& pref_path,
const base::Value* value,
PrefHashStoreTransaction::ValueState value_state,
+ PrefHashStoreTransaction::ValueState external_validation_value_state,
bool is_personal) {
- RecordValidation(pref_path, value_state, is_personal,
- PrefHashFilter::TRACKING_STRATEGY_ATOMIC);
+ RecordValidation(pref_path, value_state, external_validation_value_state,
+ is_personal, PrefHashFilter::TRACKING_STRATEGY_ATOMIC);
}
void MockValidationDelegate::OnSplitPreferenceValidation(
const std::string& pref_path,
const base::DictionaryValue* dict_value,
const std::vector<std::string>& invalid_keys,
+ const std::vector<std::string>& external_validation_invalid_keys,
PrefHashStoreTransaction::ValueState value_state,
+ PrefHashStoreTransaction::ValueState external_validation_value_state,
bool is_personal) {
- RecordValidation(pref_path, value_state, is_personal,
- PrefHashFilter::TRACKING_STRATEGY_SPLIT);
+ RecordValidation(pref_path, value_state, external_validation_value_state,
+ is_personal, PrefHashFilter::TRACKING_STRATEGY_SPLIT);
}
void MockValidationDelegate::RecordValidation(
const std::string& pref_path,
PrefHashStoreTransaction::ValueState value_state,
+ PrefHashStoreTransaction::ValueState external_validation_value_state,
bool is_personal,
PrefHashFilter::PrefTrackingStrategy strategy) {
- validations_.push_back(
- ValidationEvent(pref_path, value_state, is_personal, strategy));
+ validations_.push_back(ValidationEvent(pref_path, value_state,
+ external_validation_value_state,
+ is_personal, strategy));
}

Powered by Google App Engine
This is Rietveld 408576698