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

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

Issue 2782803002: Move tracked prefs into services/preferences/tracked. (Closed)
Patch Set: rebase Created 3 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: 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
deleted file mode 100644
index c82deb50a5f3cc981cc69895fb967f10768f7895..0000000000000000000000000000000000000000
--- a/components/user_prefs/tracked/mock_validation_delegate.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/user_prefs/tracked/mock_validation_delegate.h"
-
-MockValidationDelegateRecord::MockValidationDelegateRecord() = default;
-
-MockValidationDelegateRecord::~MockValidationDelegateRecord() = default;
-
-size_t MockValidationDelegateRecord::CountValidationsOfState(
- PrefHashStoreTransaction::ValueState value_state) const {
- size_t count = 0;
- for (size_t i = 0; i < validations_.size(); ++i) {
- if (validations_[i].value_state == value_state)
- ++count;
- }
- return count;
-}
-
-size_t MockValidationDelegateRecord::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 MockValidationDelegateRecord::ValidationEvent*
-MockValidationDelegateRecord::GetEventForPath(
- const std::string& pref_path) const {
- for (size_t i = 0; i < validations_.size(); ++i) {
- if (validations_[i].pref_path == pref_path)
- return &validations_[i];
- }
- return NULL;
-}
-
-void MockValidationDelegateRecord::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,
- external_validation_value_state,
- is_personal, strategy));
-}
-
-MockValidationDelegate::MockValidationDelegate(
- scoped_refptr<MockValidationDelegateRecord> record)
- : record_(std::move(record)) {}
-
-MockValidationDelegate::~MockValidationDelegate() = default;
-
-void MockValidationDelegate::OnAtomicPreferenceValidation(
- const std::string& pref_path,
- std::unique_ptr<base::Value> value,
- PrefHashStoreTransaction::ValueState value_state,
- PrefHashStoreTransaction::ValueState external_validation_value_state,
- bool is_personal) {
- record_->RecordValidation(pref_path, value_state,
- external_validation_value_state, is_personal,
- PrefHashFilter::PrefTrackingStrategy::ATOMIC);
-}
-
-void MockValidationDelegate::OnSplitPreferenceValidation(
- const std::string& pref_path,
- 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) {
- record_->RecordValidation(pref_path, value_state,
- external_validation_value_state, is_personal,
- PrefHashFilter::PrefTrackingStrategy::SPLIT);
-}
« no previous file with comments | « components/user_prefs/tracked/mock_validation_delegate.h ('k') | components/user_prefs/tracked/pref_hash_calculator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698