| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/preferences/tracked/pref_hash_filter.h" | 5 #include "services/preferences/tracked/pref_hash_filter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 // Records calls to this mock's SetMac/SetSplitMac methods. | 402 // Records calls to this mock's SetMac/SetSplitMac methods. |
| 403 void RecordSetMac(const std::string& path, const std::string& mac) { | 403 void RecordSetMac(const std::string& path, const std::string& mac) { |
| 404 dictionary_.SetStringWithoutPathExpansion(path, mac); | 404 dictionary_.SetStringWithoutPathExpansion(path, mac); |
| 405 } | 405 } |
| 406 void RecordSetSplitMac(const std::string& path, | 406 void RecordSetSplitMac(const std::string& path, |
| 407 const std::string& split_path, | 407 const std::string& split_path, |
| 408 const std::string& mac) { | 408 const std::string& mac) { |
| 409 base::DictionaryValue* mac_dict = nullptr; | 409 base::DictionaryValue* mac_dict = nullptr; |
| 410 dictionary_.GetDictionaryWithoutPathExpansion(path, &mac_dict); | 410 dictionary_.GetDictionaryWithoutPathExpansion(path, &mac_dict); |
| 411 if (!mac_dict) { | 411 if (!mac_dict) { |
| 412 mac_dict = new base::DictionaryValue; | 412 mac_dict = dictionary_.SetDictionaryWithoutPathExpansion( |
| 413 dictionary_.SetWithoutPathExpansion(path, mac_dict); | 413 path, base::MakeUnique<base::DictionaryValue>()); |
| 414 } | 414 } |
| 415 mac_dict->SetStringWithoutPathExpansion(split_path, mac); | 415 mac_dict->SetStringWithoutPathExpansion(split_path, mac); |
| 416 } | 416 } |
| 417 | 417 |
| 418 // Records a call to this mock's RemoveEntry method. | 418 // Records a call to this mock's RemoveEntry method. |
| 419 void RecordRemoveEntry(const std::string& path) { | 419 void RecordRemoveEntry(const std::string& path) { |
| 420 // Don't expect the same pref to be cleared more than once. | 420 // Don't expect the same pref to be cleared more than once. |
| 421 EXPECT_EQ(removed_entries_.end(), removed_entries_.find(path)); | 421 EXPECT_EQ(removed_entries_.end(), removed_entries_.find(path)); |
| 422 removed_entries_.insert(path); | 422 removed_entries_.insert(path); |
| 423 } | 423 } |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 ValueState::CHANGED)); | 1346 ValueState::CHANGED)); |
| 1347 ASSERT_EQ(arraysize(kTestTrackedPrefs) - 2u, | 1347 ASSERT_EQ(arraysize(kTestTrackedPrefs) - 2u, |
| 1348 mock_validation_delegate_record_->CountExternalValidationsOfState( | 1348 mock_validation_delegate_record_->CountExternalValidationsOfState( |
| 1349 ValueState::UNCHANGED)); | 1349 ValueState::UNCHANGED)); |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 INSTANTIATE_TEST_CASE_P(PrefHashFilterTestInstance, | 1352 INSTANTIATE_TEST_CASE_P(PrefHashFilterTestInstance, |
| 1353 PrefHashFilterTest, | 1353 PrefHashFilterTest, |
| 1354 testing::Values(EnforcementLevel::NO_ENFORCEMENT, | 1354 testing::Values(EnforcementLevel::NO_ENFORCEMENT, |
| 1355 EnforcementLevel::ENFORCE_ON_LOAD)); | 1355 EnforcementLevel::ENFORCE_ON_LOAD)); |
| OLD | NEW |