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/api/storage/settings_test_util.h" | 5 #include "chrome/browser/extensions/api/storage/settings_test_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
9 #include "chrome/browser/extensions/extension_system_factory.h" | 9 #include "chrome/browser/extensions/extension_system_factory.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 namespace settings_test_util { | 14 namespace settings_test_util { |
15 | 15 |
16 // Intended as a StorageCallback from GetStorage. | 16 // Intended as a StorageCallback from GetStorage. |
17 static void AssignStorage(ValueStore** dst, ValueStore* src) { | 17 static void AssignStorage(ValueStore** dst, ValueStore* src) { |
18 *dst = src; | 18 *dst = src; |
19 } | 19 } |
20 | 20 |
21 ValueStore* GetStorage( | 21 ValueStore* GetStorage( |
22 const std::string& extension_id, | 22 const std::string& extension_id, |
23 settings_namespace::Namespace settings_namespace, | 23 settings_namespace::Namespace settings_namespace, |
24 SettingsFrontend* frontend) { | 24 SettingsFrontend* frontend) { |
25 ValueStore* storage = NULL; | 25 ValueStore* storage = NULL; |
26 frontend->RunWithStorage( | 26 frontend->RunWithStorage( |
27 extension_id, | 27 extension_id, |
28 settings_namespace, | 28 settings_namespace, |
29 base::Bind(&AssignStorage, &storage)); | 29 base::Bind(&AssignStorage, &storage)); |
30 MessageLoop::current()->RunUntilIdle(); | 30 base::MessageLoop::current()->RunUntilIdle(); |
31 return storage; | 31 return storage; |
32 } | 32 } |
33 | 33 |
34 ValueStore* GetStorage( | 34 ValueStore* GetStorage( |
35 const std::string& extension_id, SettingsFrontend* frontend) { | 35 const std::string& extension_id, SettingsFrontend* frontend) { |
36 return GetStorage(extension_id, settings_namespace::SYNC, frontend); | 36 return GetStorage(extension_id, settings_namespace::SYNC, frontend); |
37 } | 37 } |
38 | 38 |
39 // MockExtensionService | 39 // MockExtensionService |
40 | 40 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 ValueStore* ScopedSettingsStorageFactory::Create( | 157 ValueStore* ScopedSettingsStorageFactory::Create( |
158 const base::FilePath& base_path, | 158 const base::FilePath& base_path, |
159 const std::string& extension_id) { | 159 const std::string& extension_id) { |
160 DCHECK(delegate_.get()); | 160 DCHECK(delegate_.get()); |
161 return delegate_->Create(base_path, extension_id); | 161 return delegate_->Create(base_path, extension_id); |
162 } | 162 } |
163 | 163 |
164 } // namespace settings_test_util | 164 } // namespace settings_test_util |
165 | 165 |
166 } // namespace extensions | 166 } // namespace extensions |
OLD | NEW |