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

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: Add unit and browser tests. GetType => GetUMASuffix Created 4 years, 4 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 ASSERT_TRUE(file_writer->HasPendingWrite()); 963 ASSERT_TRUE(file_writer->HasPendingWrite());
962 964
963 // Call CommitPendingWrite and check that the lossy pref is there with the 965 // Call CommitPendingWrite and check that the lossy pref is there with the
964 // last value set above. 966 // last value set above.
965 pref_store->CommitPendingWrite(); 967 pref_store->CommitPendingWrite();
966 ASSERT_FALSE(file_writer->HasPendingWrite()); 968 ASSERT_FALSE(file_writer->HasPendingWrite());
967 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); 969 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents());
968 } 970 }
969 971
970 } // namespace base 972 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698