| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/prefs/profile_pref_store_manager.h" | 5 #include "chrome/browser/prefs/profile_pref_store_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "components/user_prefs/tracked/pref_hash_filter.h" | 30 #include "components/user_prefs/tracked/pref_hash_filter.h" |
| 31 #include "components/user_prefs/tracked/pref_names.h" | 31 #include "components/user_prefs/tracked/pref_names.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 class FirstEqualsPredicate { | 36 class FirstEqualsPredicate { |
| 37 public: | 37 public: |
| 38 explicit FirstEqualsPredicate(const std::string& expected) | 38 explicit FirstEqualsPredicate(const std::string& expected) |
| 39 : expected_(expected) {} | 39 : expected_(expected) {} |
| 40 bool operator()(const std::pair<std::string, base::Value*>& pair) { | 40 bool operator()(const PrefValueMap::Map::value_type& pair) { |
| 41 return pair.first == expected_; | 41 return pair.first == expected_; |
| 42 } | 42 } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 const std::string expected_; | 45 const std::string expected_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Observes changes to the PrefStore and verifies that only registered prefs are | 48 // Observes changes to the PrefStore and verifies that only registered prefs are |
| 49 // written. | 49 // written. |
| 50 class RegistryVerifier : public PrefStore::Observer { | 50 class RegistryVerifier : public PrefStore::Observer { |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 480 |
| 481 // Trigger the logic that migrates it back to the unprotected preferences | 481 // Trigger the logic that migrates it back to the unprotected preferences |
| 482 // file. | 482 // file. |
| 483 pref_store_->SetValue(kProtectedAtomic, | 483 pref_store_->SetValue(kProtectedAtomic, |
| 484 base::WrapUnique(new base::StringValue(kGoodbyeWorld)), | 484 base::WrapUnique(new base::StringValue(kGoodbyeWorld)), |
| 485 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 485 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
| 486 LoadExistingPrefs(); | 486 LoadExistingPrefs(); |
| 487 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); | 487 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); |
| 488 VerifyResetRecorded(false); | 488 VerifyResetRecorded(false); |
| 489 } | 489 } |
| OLD | NEW |