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 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
10 | 10 |
11 class CommandLine; | 11 class CommandLine; |
12 class FilePath; | 12 class FilePath; |
13 namespace base { | 13 namespace base { |
14 class Time; | 14 class Time; |
15 } | 15 } |
16 | 16 |
| 17 namespace extensions { |
| 18 |
17 // Test ExtensionSystem, for use with TestingProfile. | 19 // Test ExtensionSystem, for use with TestingProfile. |
18 class TestExtensionSystem : public ExtensionSystem { | 20 class TestExtensionSystem : public ExtensionSystem { |
19 public: | 21 public: |
20 explicit TestExtensionSystem(Profile* profile); | 22 explicit TestExtensionSystem(Profile* profile); |
21 virtual ~TestExtensionSystem(); | 23 virtual ~TestExtensionSystem(); |
22 | 24 |
23 // ProfileKeyedService implementation. | 25 // ProfileKeyedService implementation. |
24 virtual void Shutdown() OVERRIDE; | 26 virtual void Shutdown() OVERRIDE; |
25 | 27 |
26 // Creates an ExtensionService initialized with the testing profile and | 28 // Creates an ExtensionService initialized with the testing profile and |
27 // returns it. | 29 // returns it. |
28 ExtensionService* CreateExtensionService(const CommandLine* command_line, | 30 ExtensionService* CreateExtensionService(const CommandLine* command_line, |
29 const FilePath& install_directory, | 31 const FilePath& install_directory, |
30 bool autoupdate_enabled); | 32 bool autoupdate_enabled); |
31 | 33 |
32 // Creates and returns a ManagementPolicy with the ExtensionService and | 34 // Creates and returns a ManagementPolicy with the ExtensionService and |
33 // ExtensionPrefs registered. If not invoked, the ManagementPolicy is NULL. | 35 // ExtensionPrefs registered. If not invoked, the ManagementPolicy is NULL. |
34 extensions::ManagementPolicy* CreateManagementPolicy(); | 36 ManagementPolicy* CreateManagementPolicy(); |
35 | 37 |
36 // Creates an ExtensionProcessManager. If not invoked, the | 38 // Creates an ExtensionProcessManager. If not invoked, the |
37 // ExtensionProcessManager is NULL. | 39 // ExtensionProcessManager is NULL. |
38 void CreateExtensionProcessManager(); | 40 void CreateExtensionProcessManager(); |
39 | 41 |
40 // Creates an AlarmManager. Will be NULL otherwise. | 42 // Creates an AlarmManager. Will be NULL otherwise. |
41 void CreateAlarmManager(base::Time (*now)()); | 43 void CreateAlarmManager(base::Time (*now)()); |
42 | 44 |
43 virtual void Init(bool extensions_enabled) OVERRIDE {} | 45 virtual void Init(bool extensions_enabled) OVERRIDE {} |
44 virtual ExtensionService* extension_service() OVERRIDE; | 46 virtual ExtensionService* extension_service() OVERRIDE; |
45 virtual extensions::ManagementPolicy* management_policy() OVERRIDE; | 47 virtual ManagementPolicy* management_policy() OVERRIDE; |
46 void SetExtensionService(ExtensionService* service); | 48 void SetExtensionService(ExtensionService* service); |
47 virtual UserScriptMaster* user_script_master() OVERRIDE; | 49 virtual UserScriptMaster* user_script_master() OVERRIDE; |
48 virtual ExtensionDevToolsManager* devtools_manager() OVERRIDE; | 50 virtual ExtensionDevToolsManager* devtools_manager() OVERRIDE; |
49 virtual ExtensionProcessManager* process_manager() OVERRIDE; | 51 virtual ExtensionProcessManager* process_manager() OVERRIDE; |
50 virtual extensions::AlarmManager* alarm_manager() OVERRIDE; | 52 virtual AlarmManager* alarm_manager() OVERRIDE; |
51 virtual extensions::StateStore* state_store() OVERRIDE; | 53 virtual StateStore* state_store() OVERRIDE; |
52 virtual ExtensionInfoMap* info_map() OVERRIDE; | 54 virtual ExtensionInfoMap* info_map() OVERRIDE; |
53 virtual extensions::LazyBackgroundTaskQueue* | 55 virtual LazyBackgroundTaskQueue* |
54 lazy_background_task_queue() OVERRIDE; | 56 lazy_background_task_queue() OVERRIDE; |
55 virtual ExtensionMessageService* message_service() OVERRIDE; | 57 virtual ExtensionMessageService* message_service() OVERRIDE; |
56 virtual ExtensionEventRouter* event_router() OVERRIDE; | 58 virtual ExtensionEventRouter* event_router() OVERRIDE; |
57 virtual extensions::RulesRegistryService* rules_registry_service() | 59 virtual RulesRegistryService* rules_registry_service() |
58 OVERRIDE; | 60 OVERRIDE; |
59 | 61 |
60 // Factory method for tests to use with SetTestingProfile. | 62 // Factory method for tests to use with SetTestingProfile. |
61 static ProfileKeyedService* Build(Profile* profile); | 63 static ProfileKeyedService* Build(Profile* profile); |
62 | 64 |
63 private: | 65 private: |
64 Profile* profile_; | 66 Profile* profile_; |
65 | 67 |
66 // The Extension Preferences. Only created if CreateExtensionService is | 68 // The Extension Preferences. Only created if CreateExtensionService is |
67 // invoked. | 69 // invoked. |
68 scoped_ptr<extensions::ExtensionPrefs> extension_prefs_; | 70 scoped_ptr<ExtensionPrefs> extension_prefs_; |
69 scoped_ptr<extensions::StateStore> state_store_; | 71 scoped_ptr<StateStore> state_store_; |
70 scoped_ptr<ExtensionService> extension_service_; | 72 scoped_ptr<ExtensionService> extension_service_; |
71 scoped_ptr<extensions::ManagementPolicy> management_policy_; | 73 scoped_ptr<ManagementPolicy> management_policy_; |
72 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | 74 scoped_ptr<ExtensionProcessManager> extension_process_manager_; |
73 scoped_ptr<extensions::AlarmManager> alarm_manager_; | 75 scoped_ptr<AlarmManager> alarm_manager_; |
74 scoped_refptr<ExtensionInfoMap> info_map_; | 76 scoped_refptr<ExtensionInfoMap> info_map_; |
75 }; | 77 }; |
76 | 78 |
| 79 } // namespace extensions |
| 80 |
77 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 81 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
OLD | NEW |