| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prefs/json_pref_store.h" | 5 #include "components/prefs/json_pref_store.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // PrefFilter implementation: | 76 // PrefFilter implementation: |
| 77 void FilterOnLoad( | 77 void FilterOnLoad( |
| 78 const PostFilterOnLoadCallback& post_filter_on_load_callback, | 78 const PostFilterOnLoadCallback& post_filter_on_load_callback, |
| 79 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; | 79 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; |
| 80 void FilterUpdate(const std::string& path) override {} | 80 void FilterUpdate(const std::string& path) override {} |
| 81 OnWriteCallbackPair FilterSerializeData( | 81 OnWriteCallbackPair FilterSerializeData( |
| 82 base::DictionaryValue* pref_store_contents) override { | 82 base::DictionaryValue* pref_store_contents) override { |
| 83 return on_write_callback_pair_; | 83 return on_write_callback_pair_; |
| 84 } | 84 } |
| 85 void OnStoreDeletionFromDisk() override {} |
| 85 | 86 |
| 86 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } | 87 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } |
| 87 | 88 |
| 88 // Finalize an intercepted read, handing |intercepted_prefs_| back to its | 89 // Finalize an intercepted read, handing |intercepted_prefs_| back to its |
| 89 // JsonPrefStore. | 90 // JsonPrefStore. |
| 90 void ReleasePrefs(); | 91 void ReleasePrefs(); |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 PostFilterOnLoadCallback post_filter_on_load_callback_; | 94 PostFilterOnLoadCallback post_filter_on_load_callback_; |
| 94 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; | 95 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 file_writer->WriteNow(MakeUnique<std::string>("foo")); | 1084 file_writer->WriteNow(MakeUnique<std::string>("foo")); |
| 1084 } | 1085 } |
| 1085 scoped_task_environment_.RunUntilIdle(); | 1086 scoped_task_environment_.RunUntilIdle(); |
| 1086 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); | 1087 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); |
| 1087 EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); | 1088 EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); |
| 1088 EXPECT_EQ(CALLED_WITH_SUCCESS, | 1089 EXPECT_EQ(CALLED_WITH_SUCCESS, |
| 1089 write_callback_observer_.GetAndResetPostWriteObservationState()); | 1090 write_callback_observer_.GetAndResetPostWriteObservationState()); |
| 1090 } | 1091 } |
| 1091 | 1092 |
| 1092 } // namespace base | 1093 } // namespace base |
| OLD | NEW |