| 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_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 9 #include "extensions/browser/extension_system.h" | 10 #include "extensions/browser/extension_system.h" |
| 10 #include "extensions/common/one_shot_event.h" | 11 #include "extensions/common/one_shot_event.h" |
| 11 | 12 |
| 12 class Profile; | 13 class Profile; |
| 13 class TestingValueStore; | 14 class TestingValueStore; |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class CommandLine; | 17 class CommandLine; |
| 17 class FilePath; | 18 class FilePath; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 public: | 35 public: |
| 35 explicit TestExtensionSystem(Profile* profile); | 36 explicit TestExtensionSystem(Profile* profile); |
| 36 ~TestExtensionSystem() override; | 37 ~TestExtensionSystem() override; |
| 37 | 38 |
| 38 // KeyedService implementation. | 39 // KeyedService implementation. |
| 39 void Shutdown() override; | 40 void Shutdown() override; |
| 40 | 41 |
| 41 // Creates an ExtensionPrefs with the testing profile and returns it. | 42 // Creates an ExtensionPrefs with the testing profile and returns it. |
| 42 // Useful for tests that need to modify prefs before creating the | 43 // Useful for tests that need to modify prefs before creating the |
| 43 // ExtensionService. | 44 // ExtensionService. |
| 44 ExtensionPrefs* CreateExtensionPrefs(const base::CommandLine* command_line, | 45 scoped_ptr<ExtensionPrefs> CreateExtensionPrefs( |
| 45 const base::FilePath& install_directory); | 46 const base::CommandLine* command_line, |
| 47 const base::FilePath& install_directory); |
| 46 | 48 |
| 47 // Creates an ExtensionService initialized with the testing profile and | 49 // Creates an ExtensionService initialized with the testing profile and |
| 48 // returns it, and creates ExtensionPrefs if it hasn't been created yet. | 50 // returns it, and creates ExtensionPrefs if it hasn't been created yet. |
| 49 ExtensionService* CreateExtensionService( | 51 ExtensionService* CreateExtensionService( |
| 50 const base::CommandLine* command_line, | 52 const base::CommandLine* command_line, |
| 51 const base::FilePath& install_directory, | 53 const base::FilePath& install_directory, |
| 52 bool autoupdate_enabled); | 54 bool autoupdate_enabled); |
| 53 | 55 |
| 54 void CreateSocketManager(); | 56 void CreateSocketManager(); |
| 55 | 57 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 67 const OneShotEvent& ready() const override; | 69 const OneShotEvent& ready() const override; |
| 68 ContentVerifier* content_verifier() override; | 70 ContentVerifier* content_verifier() override; |
| 69 scoped_ptr<ExtensionSet> GetDependentExtensions( | 71 scoped_ptr<ExtensionSet> GetDependentExtensions( |
| 70 const Extension* extension) override; | 72 const Extension* extension) override; |
| 71 | 73 |
| 72 // Note that you probably want to use base::RunLoop().RunUntilIdle() right | 74 // Note that you probably want to use base::RunLoop().RunUntilIdle() right |
| 73 // after this to run all the accumulated tasks. | 75 // after this to run all the accumulated tasks. |
| 74 void SetReady() { ready_.Signal(); } | 76 void SetReady() { ready_.Signal(); } |
| 75 | 77 |
| 76 // Factory method for tests to use with SetTestingProfile. | 78 // Factory method for tests to use with SetTestingProfile. |
| 77 static KeyedService* Build(content::BrowserContext* profile); | 79 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile); |
| 78 | 80 |
| 79 protected: | 81 protected: |
| 80 Profile* profile_; | 82 Profile* profile_; |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 scoped_ptr<StateStore> state_store_; | 85 scoped_ptr<StateStore> state_store_; |
| 84 // A pointer to the TestingValueStore owned by |state_store_|. | 86 // A pointer to the TestingValueStore owned by |state_store_|. |
| 85 TestingValueStore* value_store_; | 87 TestingValueStore* value_store_; |
| 86 scoped_ptr<ManagementPolicy> management_policy_; | 88 scoped_ptr<ManagementPolicy> management_policy_; |
| 87 scoped_ptr<RuntimeData> runtime_data_; | 89 scoped_ptr<RuntimeData> runtime_data_; |
| 88 scoped_ptr<ExtensionService> extension_service_; | 90 scoped_ptr<ExtensionService> extension_service_; |
| 89 scoped_refptr<InfoMap> info_map_; | 91 scoped_refptr<InfoMap> info_map_; |
| 90 scoped_ptr<QuotaService> quota_service_; | 92 scoped_ptr<QuotaService> quota_service_; |
| 91 OneShotEvent ready_; | 93 OneShotEvent ready_; |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 } // namespace extensions | 96 } // namespace extensions |
| 95 | 97 |
| 96 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 98 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
| OLD | NEW |