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 "components/user_prefs/tracked/tracked_preferences_migration.h" | 5 #include "components/user_prefs/tracked/tracked_preferences_migration.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 29 matching lines...) Expand all Loading... |
40 const char kProtectedPrefValue[] = "protected_value"; | 40 const char kProtectedPrefValue[] = "protected_value"; |
41 const char kPreviouslyUnprotectedPrefValue[] = "previously_unprotected_value"; | 41 const char kPreviouslyUnprotectedPrefValue[] = "previously_unprotected_value"; |
42 const char kPreviouslyProtectedPrefValue[] = "previously_protected_value"; | 42 const char kPreviouslyProtectedPrefValue[] = "previously_protected_value"; |
43 | 43 |
44 // A simple InterceptablePrefFilter which doesn't do anything but hand the prefs | 44 // A simple InterceptablePrefFilter which doesn't do anything but hand the prefs |
45 // back downstream in FinalizeFilterOnLoad. | 45 // back downstream in FinalizeFilterOnLoad. |
46 class SimpleInterceptablePrefFilter : public InterceptablePrefFilter { | 46 class SimpleInterceptablePrefFilter : public InterceptablePrefFilter { |
47 public: | 47 public: |
48 // PrefFilter remaining implementation. | 48 // PrefFilter remaining implementation. |
49 void FilterUpdate(const std::string& path) override { ADD_FAILURE(); } | 49 void FilterUpdate(const std::string& path) override { ADD_FAILURE(); } |
50 void FilterSerializeData( | 50 OnWriteCallbackPair FilterSerializeData( |
51 base::DictionaryValue* pref_store_contents) override { | 51 base::DictionaryValue* pref_store_contents) override { |
52 ADD_FAILURE(); | 52 ADD_FAILURE(); |
| 53 return std::make_pair(base::Closure(), |
| 54 base::Callback<void(bool success)>()); |
53 } | 55 } |
54 | 56 |
55 private: | 57 private: |
56 // InterceptablePrefFilter implementation. | 58 // InterceptablePrefFilter implementation. |
57 void FinalizeFilterOnLoad( | 59 void FinalizeFilterOnLoad( |
58 const PostFilterOnLoadCallback& post_filter_on_load_callback, | 60 const PostFilterOnLoadCallback& post_filter_on_load_callback, |
59 std::unique_ptr<base::DictionaryValue> pref_store_contents, | 61 std::unique_ptr<base::DictionaryValue> pref_store_contents, |
60 bool prefs_altered) override { | 62 bool prefs_altered) override { |
61 post_filter_on_load_callback.Run(std::move(pref_store_contents), | 63 post_filter_on_load_callback.Run(std::move(pref_store_contents), |
62 prefs_altered); | 64 prefs_altered); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 expected_unprotected_values); | 646 expected_unprotected_values); |
645 | 647 |
646 base::StringPairs expected_protected_values; | 648 base::StringPairs expected_protected_values; |
647 expected_protected_values.push_back(std::make_pair( | 649 expected_protected_values.push_back(std::make_pair( |
648 kProtectedPref, kProtectedPrefValue)); | 650 kProtectedPref, kProtectedPrefValue)); |
649 expected_protected_values.push_back(std::make_pair( | 651 expected_protected_values.push_back(std::make_pair( |
650 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); | 652 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); |
651 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); | 653 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); |
652 } | 654 } |
653 } | 655 } |
OLD | NEW |