Chromium Code Reviews| 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/testing_pref_store.h" | 5 #include "components/prefs/testing_pref_store.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 DCHECK(!init_complete_); | 172 DCHECK(!init_complete_); |
| 173 block_async_read_ = block_async_read; | 173 block_async_read_ = block_async_read; |
| 174 if (pending_async_read_ && !block_async_read_) | 174 if (pending_async_read_ && !block_async_read_) |
| 175 NotifyInitializationCompleted(); | 175 NotifyInitializationCompleted(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void TestingPrefStore::ClearMutableValues() { | 178 void TestingPrefStore::ClearMutableValues() { |
| 179 NOTIMPLEMENTED(); | 179 NOTIMPLEMENTED(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void TestingPrefStore::OnStoreDeletionFromDisk() { | |
| 183 NOTIMPLEMENTED(); | |
|
gab
2017/06/08 16:14:28
That results in a log warning, in this case I thin
proberge
2017/06/08 18:32:59
Done.
| |
| 184 } | |
| 185 | |
| 182 void TestingPrefStore::set_read_only(bool read_only) { | 186 void TestingPrefStore::set_read_only(bool read_only) { |
| 183 read_only_ = read_only; | 187 read_only_ = read_only; |
| 184 } | 188 } |
| 185 | 189 |
| 186 void TestingPrefStore::set_read_success(bool read_success) { | 190 void TestingPrefStore::set_read_success(bool read_success) { |
| 187 DCHECK(!init_complete_); | 191 DCHECK(!init_complete_); |
| 188 read_success_ = read_success; | 192 read_success_ = read_success; |
| 189 } | 193 } |
| 190 | 194 |
| 191 void TestingPrefStore::set_read_error( | 195 void TestingPrefStore::set_read_error( |
| 192 PersistentPrefStore::PrefReadError read_error) { | 196 PersistentPrefStore::PrefReadError read_error) { |
| 193 DCHECK(!init_complete_); | 197 DCHECK(!init_complete_); |
| 194 read_error_ = read_error; | 198 read_error_ = read_error; |
| 195 } | 199 } |
| 196 | 200 |
| 197 TestingPrefStore::~TestingPrefStore() { | 201 TestingPrefStore::~TestingPrefStore() { |
| 198 for (auto& pref : prefs_) { | 202 for (auto& pref : prefs_) { |
| 199 CheckPrefIsSerializable(pref.first, *pref.second); | 203 CheckPrefIsSerializable(pref.first, *pref.second); |
| 200 } | 204 } |
| 201 } | 205 } |
| 202 | 206 |
| 203 void TestingPrefStore::CheckPrefIsSerializable(const std::string& key, | 207 void TestingPrefStore::CheckPrefIsSerializable(const std::string& key, |
| 204 const base::Value& value) { | 208 const base::Value& value) { |
| 205 std::string json; | 209 std::string json; |
| 206 EXPECT_TRUE(base::JSONWriter::Write(value, &json)) | 210 EXPECT_TRUE(base::JSONWriter::Write(value, &json)) |
| 207 << "Pref \"" << key << "\" is not serializable as JSON."; | 211 << "Pref \"" << key << "\" is not serializable as JSON."; |
| 208 } | 212 } |
| OLD | NEW |