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

Side by Side Diff: components/prefs/json_pref_store_unittest.cc

Issue 2204943002: Integrate registry_hash_store_contents with the rest of tracked prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and added important_file_writer CL as dependent patchset Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 class InterceptingPrefFilter : public PrefFilter { 68 class InterceptingPrefFilter : public PrefFilter {
69 public: 69 public:
70 InterceptingPrefFilter(); 70 InterceptingPrefFilter();
71 ~InterceptingPrefFilter() override; 71 ~InterceptingPrefFilter() override;
72 72
73 // PrefFilter implementation: 73 // PrefFilter implementation:
74 void FilterOnLoad( 74 void FilterOnLoad(
75 const PostFilterOnLoadCallback& post_filter_on_load_callback, 75 const PostFilterOnLoadCallback& post_filter_on_load_callback,
76 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; 76 std::unique_ptr<base::DictionaryValue> pref_store_contents) override;
77 void FilterUpdate(const std::string& path) override {} 77 void FilterUpdate(const std::string& path) override {}
78 void FilterSerializeData( 78 base::Callback<void(bool)> FilterSerializeData(
79 base::DictionaryValue* pref_store_contents) override {} 79 base::DictionaryValue* pref_store_contents) override {
80 return base::Callback<void(bool)>();
81 }
80 82
81 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } 83 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; }
82 84
83 // Finalize an intercepted read, handing |intercepted_prefs_| back to its 85 // Finalize an intercepted read, handing |intercepted_prefs_| back to its
84 // JsonPrefStore. 86 // JsonPrefStore.
85 void ReleasePrefs(); 87 void ReleasePrefs();
86 88
87 private: 89 private:
88 PostFilterOnLoadCallback post_filter_on_load_callback_; 90 PostFilterOnLoadCallback post_filter_on_load_callback_;
89 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; 91 std::unique_ptr<base::DictionaryValue> intercepted_prefs_;
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 ASSERT_TRUE(file_writer->HasPendingWrite()); 954 ASSERT_TRUE(file_writer->HasPendingWrite());
953 955
954 // Call CommitPendingWrite and check that the lossy pref is there with the 956 // Call CommitPendingWrite and check that the lossy pref is there with the
955 // last value set above. 957 // last value set above.
956 pref_store->CommitPendingWrite(); 958 pref_store->CommitPendingWrite();
957 ASSERT_FALSE(file_writer->HasPendingWrite()); 959 ASSERT_FALSE(file_writer->HasPendingWrite());
958 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); 960 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents());
959 } 961 }
960 962
961 } // namespace base 963 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698