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 "chrome/browser/extensions/test_extension_prefs.h" | 5 #include "chrome/browser/extensions/test_extension_prefs.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 void TestExtensionPrefs::ResetPrefRegistry() { | 84 void TestExtensionPrefs::ResetPrefRegistry() { |
85 pref_registry_ = new PrefRegistrySyncable; | 85 pref_registry_ = new PrefRegistrySyncable; |
86 ExtensionPrefs::RegisterUserPrefs(pref_registry_); | 86 ExtensionPrefs::RegisterUserPrefs(pref_registry_); |
87 } | 87 } |
88 | 88 |
89 void TestExtensionPrefs::RecreateExtensionPrefs() { | 89 void TestExtensionPrefs::RecreateExtensionPrefs() { |
90 // We persist and reload the PrefService's PrefStores because this process | 90 // We persist and reload the PrefService's PrefStores because this process |
91 // deletes all empty dictionaries. The ExtensionPrefs implementation | 91 // deletes all empty dictionaries. The ExtensionPrefs implementation |
92 // needs to be able to handle this situation. | 92 // needs to be able to handle this situation. |
93 if (pref_service_.get()) { | 93 if (pref_service_) { |
94 // Commit a pending write (which posts a task to task_runner_) and wait for | 94 // Commit a pending write (which posts a task to task_runner_) and wait for |
95 // it to finish. | 95 // it to finish. |
96 pref_service_->CommitPendingWrite(); | 96 pref_service_->CommitPendingWrite(); |
97 base::RunLoop run_loop; | 97 base::RunLoop run_loop; |
98 ASSERT_TRUE( | 98 ASSERT_TRUE( |
99 task_runner_->PostTaskAndReply( | 99 task_runner_->PostTaskAndReply( |
100 FROM_HERE, | 100 FROM_HERE, |
101 base::Bind(&base::DoNothing), | 101 base::Bind(&base::DoNothing), |
102 run_loop.QuitClosure())); | 102 run_loop.QuitClosure())); |
103 run_loop.Run(); | 103 run_loop.Run(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 173 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
174 return pref_service_->CreateIncognitoPrefService( | 174 return pref_service_->CreateIncognitoPrefService( |
175 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 175 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
176 } | 176 } |
177 | 177 |
178 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { | 178 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { |
179 extensions_disabled_ = extensions_disabled; | 179 extensions_disabled_ = extensions_disabled; |
180 } | 180 } |
181 | 181 |
182 } // namespace extensions | 182 } // namespace extensions |
OLD | NEW |