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 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/extensions/extension_event_router.h" | 13 #include "chrome/browser/extensions/extension_event_router.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/settings/settings_storage_factory.h" |
15 #include "chrome/browser/extensions/test_extension_service.h" | 16 #include "chrome/browser/extensions/test_extension_service.h" |
16 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
18 | 19 |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 | 22 |
22 class SettingsFrontend; | 23 class SettingsFrontend; |
23 class SettingsStorage; | 24 class SettingsStorage; |
24 | 25 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 MockExtensionService* GetMockExtensionService(); | 59 MockExtensionService* GetMockExtensionService(); |
59 | 60 |
60 virtual ExtensionService* GetExtensionService() OVERRIDE; | 61 virtual ExtensionService* GetExtensionService() OVERRIDE; |
61 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; | 62 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; |
62 | 63 |
63 private: | 64 private: |
64 MockExtensionService extension_service_; | 65 MockExtensionService extension_service_; |
65 scoped_ptr<ExtensionEventRouter> event_router_; | 66 scoped_ptr<ExtensionEventRouter> event_router_; |
66 }; | 67 }; |
67 | 68 |
| 69 // SettingsStorageFactory which acts as a wrapper for other factories. |
| 70 class ScopedSettingsStorageFactory : public SettingsStorageFactory { |
| 71 public: |
| 72 explicit ScopedSettingsStorageFactory(SettingsStorageFactory* delegate); |
| 73 |
| 74 virtual ~ScopedSettingsStorageFactory(); |
| 75 |
| 76 // Sets the delegate factory (equivalent to scoped_ptr::reset). |
| 77 void Reset(SettingsStorageFactory* delegate); |
| 78 |
| 79 // SettingsStorageFactory implementation. |
| 80 virtual SettingsStorage* Create( |
| 81 const FilePath& base_path, const std::string& extension_id) OVERRIDE; |
| 82 |
| 83 private: |
| 84 scoped_ptr<SettingsStorageFactory> delegate_; |
| 85 }; |
| 86 |
68 } // namespace settings_test_util | 87 } // namespace settings_test_util |
69 | 88 |
70 } // namespace extensions | 89 } // namespace extensions |
71 | 90 |
72 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ | 91 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ |
OLD | NEW |