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