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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_
6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_
8 #include "chrome/browser/extensions/extension_system.h"
11 class TestingValueStore;
22 namespace extensions {
26 // Test ExtensionSystem, for use with TestingProfile.
27 class TestExtensionSystem : public ExtensionSystem {
29 explicit TestExtensionSystem(Profile* profile);
30 virtual ~TestExtensionSystem();
32 // BrowserContextKeyedService implementation.
33 virtual void Shutdown() OVERRIDE;
35 // Creates an ExtensionPrefs with the testing profile and returns it.
36 // Useful for tests that need to modify prefs before creating the
38 ExtensionPrefs* CreateExtensionPrefs(const CommandLine* command_line,
39 const base::FilePath& install_directory);
41 // Creates an ExtensionService initialized with the testing profile and
42 // returns it, and creates ExtensionPrefs if it hasn't been created yet.
43 ExtensionService* CreateExtensionService(
44 const CommandLine* command_line,
45 const base::FilePath& install_directory,
46 bool autoupdate_enabled);
48 // Creates a ProcessManager. If not invoked, the ProcessManager is NULL.
49 void CreateProcessManager();
51 // Allows the ProcessManager to be overriden, for example by a stub
52 // implementation. Takes ownership of |manager|.
53 void SetProcessManager(ProcessManager* manager);
55 void CreateSocketManager();
57 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE {}
58 void SetExtensionService(ExtensionService* service);
59 virtual ExtensionService* extension_service() OVERRIDE;
60 virtual RuntimeData* runtime_data() OVERRIDE;
61 virtual ManagementPolicy* management_policy() OVERRIDE;
62 virtual UserScriptMaster* user_script_master() OVERRIDE;
63 virtual ProcessManager* process_manager() OVERRIDE;
64 virtual StateStore* state_store() OVERRIDE;
65 virtual StateStore* rules_store() OVERRIDE;
66 TestingValueStore* value_store() { return value_store_; }
67 virtual InfoMap* info_map() OVERRIDE;
68 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() OVERRIDE;
69 virtual EventRouter* event_router() OVERRIDE;
70 virtual ExtensionWarningService* warning_service() OVERRIDE;
71 virtual Blacklist* blacklist() OVERRIDE;
72 virtual const OneShotEvent& ready() const OVERRIDE;
73 virtual ErrorConsole* error_console() OVERRIDE;
74 virtual InstallVerifier* install_verifier() OVERRIDE;
77 LOG(INFO) << "SetReady()";
81 // Factory method for tests to use with SetTestingProfile.
82 static BrowserContextKeyedService* Build(content::BrowserContext* profile);
88 scoped_ptr<StateStore> state_store_;
89 // A pointer to the TestingValueStore owned by |state_store_|.
90 TestingValueStore* value_store_;
91 scoped_ptr<Blacklist> blacklist_;
92 scoped_ptr<StandardManagementPolicyProvider>
93 standard_management_policy_provider_;
94 scoped_ptr<ManagementPolicy> management_policy_;
95 scoped_ptr<RuntimeData> runtime_data_;
96 scoped_ptr<ExtensionService> extension_service_;
97 scoped_ptr<ProcessManager> process_manager_;
98 scoped_refptr<InfoMap> info_map_;
99 scoped_ptr<ErrorConsole> error_console_;
100 scoped_ptr<InstallVerifier> install_verifier_;
104 } // namespace extensions
106 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_