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 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "extensions/browser/extension_system.h" | 10 #include "extensions/browser/extension_system.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 class BrowserContext; | 23 class BrowserContext; |
24 } | 24 } |
25 | 25 |
26 namespace extensions { | 26 namespace extensions { |
27 class ExtensionPrefs; | 27 class ExtensionPrefs; |
28 class InstallVerifier; | 28 class InstallVerifier; |
29 class RuntimeData; | 29 class RuntimeData; |
30 class SharedUserScriptMaster; | 30 class SharedUserScriptMaster; |
31 class StandardManagementPolicyProvider; | 31 class StandardManagementPolicyProvider; |
not at google - send to devlin
2015/08/03 21:12:08
Cleanup: InstallVerifier and StandardManagementPol
Marc Treib
2015/08/04 08:36:28
And ExtensionPrefs also isn't used :)
Done.
| |
32 | 32 |
33 // Test ExtensionSystem, for use with TestingProfile. | 33 // Test ExtensionSystem, for use with TestingProfile. |
34 class TestExtensionSystem : public ExtensionSystem { | 34 class TestExtensionSystem : public ExtensionSystem { |
35 public: | 35 public: |
36 explicit TestExtensionSystem(Profile* profile); | 36 explicit TestExtensionSystem(Profile* profile); |
37 ~TestExtensionSystem() override; | 37 ~TestExtensionSystem() override; |
38 | 38 |
39 // KeyedService implementation. | 39 // KeyedService implementation. |
40 void Shutdown() override; | 40 void Shutdown() override; |
41 | 41 |
42 // Creates an ExtensionPrefs with the testing profile and returns it. | |
43 // Useful for tests that need to modify prefs before creating the | |
44 // ExtensionService. | |
45 scoped_ptr<ExtensionPrefs> CreateExtensionPrefs( | |
46 const base::CommandLine* command_line, | |
47 const base::FilePath& install_directory); | |
48 | |
49 // Creates an ExtensionService initialized with the testing profile and | 42 // Creates an ExtensionService initialized with the testing profile and |
50 // returns it, and creates ExtensionPrefs if it hasn't been created yet. | 43 // returns it, and creates ExtensionPrefs if it hasn't been created yet. |
51 ExtensionService* CreateExtensionService( | 44 ExtensionService* CreateExtensionService( |
52 const base::CommandLine* command_line, | 45 const base::CommandLine* command_line, |
53 const base::FilePath& install_directory, | 46 const base::FilePath& install_directory, |
54 bool autoupdate_enabled); | 47 bool autoupdate_enabled); |
55 | 48 |
56 void CreateSocketManager(); | 49 void CreateSocketManager(); |
57 | 50 |
58 void InitForRegularProfile(bool extensions_enabled) override {} | 51 void InitForRegularProfile(bool extensions_enabled) override {} |
59 void SetExtensionService(ExtensionService* service); | 52 void SetExtensionService(ExtensionService* service); |
60 ExtensionService* extension_service() override; | 53 ExtensionService* extension_service() override; |
61 RuntimeData* runtime_data() override; | 54 RuntimeData* runtime_data() override; |
62 ManagementPolicy* management_policy() override; | 55 ManagementPolicy* management_policy() override; |
63 SharedUserScriptMaster* shared_user_script_master() override; | 56 SharedUserScriptMaster* shared_user_script_master() override; |
64 StateStore* state_store() override; | 57 StateStore* state_store() override; |
65 StateStore* rules_store() override; | 58 StateStore* rules_store() override; |
66 TestingValueStore* value_store() { return value_store_; } | 59 TestingValueStore* value_store() { return value_store_; } |
67 InfoMap* info_map() override; | 60 InfoMap* info_map() override; |
68 QuotaService* quota_service() override; | 61 QuotaService* quota_service() override; |
62 AppSorting* app_sorting() override; | |
69 const OneShotEvent& ready() const override; | 63 const OneShotEvent& ready() const override; |
70 ContentVerifier* content_verifier() override; | 64 ContentVerifier* content_verifier() override; |
71 scoped_ptr<ExtensionSet> GetDependentExtensions( | 65 scoped_ptr<ExtensionSet> GetDependentExtensions( |
72 const Extension* extension) override; | 66 const Extension* extension) override; |
73 | 67 |
74 // Note that you probably want to use base::RunLoop().RunUntilIdle() right | 68 // Note that you probably want to use base::RunLoop().RunUntilIdle() right |
75 // after this to run all the accumulated tasks. | 69 // after this to run all the accumulated tasks. |
76 void SetReady() { ready_.Signal(); } | 70 void SetReady() { ready_.Signal(); } |
77 | 71 |
78 // Factory method for tests to use with SetTestingProfile. | 72 // Factory method for tests to use with SetTestingProfile. |
79 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile); | 73 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile); |
80 | 74 |
75 // Used by ExtensionPrefsTest to re-create the AppSorting after it has | |
76 // re-created the ExtensionPrefs instance (this can never happen in non-test | |
77 // code). | |
78 void RecreateAppSorting(); | |
79 | |
81 protected: | 80 protected: |
82 Profile* profile_; | 81 Profile* profile_; |
83 | 82 |
84 private: | 83 private: |
85 scoped_ptr<StateStore> state_store_; | 84 scoped_ptr<StateStore> state_store_; |
86 // A pointer to the TestingValueStore owned by |state_store_|. | 85 // A pointer to the TestingValueStore owned by |state_store_|. |
87 TestingValueStore* value_store_; | 86 TestingValueStore* value_store_; |
88 scoped_ptr<ManagementPolicy> management_policy_; | 87 scoped_ptr<ManagementPolicy> management_policy_; |
89 scoped_ptr<RuntimeData> runtime_data_; | 88 scoped_ptr<RuntimeData> runtime_data_; |
90 scoped_ptr<ExtensionService> extension_service_; | 89 scoped_ptr<ExtensionService> extension_service_; |
91 scoped_refptr<InfoMap> info_map_; | 90 scoped_refptr<InfoMap> info_map_; |
92 scoped_ptr<QuotaService> quota_service_; | 91 scoped_ptr<QuotaService> quota_service_; |
92 scoped_ptr<AppSorting> app_sorting_; | |
93 OneShotEvent ready_; | 93 OneShotEvent ready_; |
94 }; | 94 }; |
95 | 95 |
96 } // namespace extensions | 96 } // namespace extensions |
97 | 97 |
98 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 98 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
OLD | NEW |