| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/prefs/testing_pref_store.h" | 5 #include "chrome/browser/prefs/testing_pref_store.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 | 8 |
| 9 TestingPrefStore::TestingPrefStore() | 9 TestingPrefStore::TestingPrefStore() |
| 10 : read_only_(true), | 10 : read_only_(true), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (prefs_.RemoveValue(key)) | 48 if (prefs_.RemoveValue(key)) |
| 49 NotifyPrefValueChanged(key); | 49 NotifyPrefValueChanged(key); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool TestingPrefStore::ReadOnly() const { | 52 bool TestingPrefStore::ReadOnly() const { |
| 53 return read_only_; | 53 return read_only_; |
| 54 } | 54 } |
| 55 | 55 |
| 56 PersistentPrefStore::PrefReadError TestingPrefStore::ReadPrefs() { | 56 PersistentPrefStore::PrefReadError TestingPrefStore::ReadPrefs() { |
| 57 prefs_.Clear(); | 57 prefs_.Clear(); |
| 58 NotifyInitializationCompleted(); |
| 58 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 59 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 59 } | 60 } |
| 60 | 61 |
| 62 void TestingPrefStore::ReadPrefsAsync() { |
| 63 prefs_.Clear(); |
| 64 NotifyInitializationCompleted(); |
| 65 } |
| 66 |
| 67 void TestingPrefStore::GetErrors(PrefReadError* error, bool* is_fatal) { |
| 68 (*error) = PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 69 (*is_fatal) = false; |
| 70 } |
| 71 |
| 61 bool TestingPrefStore::WritePrefs() { | 72 bool TestingPrefStore::WritePrefs() { |
| 62 prefs_written_ = true; | 73 prefs_written_ = true; |
| 63 return prefs_written_; | 74 return prefs_written_; |
| 64 } | 75 } |
| 65 | 76 |
| 66 void TestingPrefStore::SetInitializationCompleted() { | 77 void TestingPrefStore::SetInitializationCompleted() { |
| 67 init_complete_ = true; | 78 init_complete_ = true; |
| 68 NotifyInitializationCompleted(); | 79 NotifyInitializationCompleted(); |
| 69 } | 80 } |
| 70 | 81 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 read_only_ = read_only; | 133 read_only_ = read_only; |
| 123 } | 134 } |
| 124 | 135 |
| 125 void TestingPrefStore::set_prefs_written(bool status) { | 136 void TestingPrefStore::set_prefs_written(bool status) { |
| 126 prefs_written_ = status; | 137 prefs_written_ = status; |
| 127 } | 138 } |
| 128 | 139 |
| 129 bool TestingPrefStore::get_prefs_written() { | 140 bool TestingPrefStore::get_prefs_written() { |
| 130 return prefs_written_; | 141 return prefs_written_; |
| 131 } | 142 } |
| OLD | NEW |