| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSION_SERVICE_TEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void InitializeInstalledExtensionService( | 78 void InitializeInstalledExtensionService( |
| 79 const base::FilePath& prefs_file, | 79 const base::FilePath& prefs_file, |
| 80 const base::FilePath& source_install_dir); | 80 const base::FilePath& source_install_dir); |
| 81 | 81 |
| 82 // Initialize an ExtensionService with a few already-installed extensions. | 82 // Initialize an ExtensionService with a few already-installed extensions. |
| 83 void InitializeGoodInstalledExtensionService(); | 83 void InitializeGoodInstalledExtensionService(); |
| 84 | 84 |
| 85 // Initialize an ExtensionService with autoupdate enabled. | 85 // Initialize an ExtensionService with autoupdate enabled. |
| 86 void InitializeExtensionServiceWithUpdater(); | 86 void InitializeExtensionServiceWithUpdater(); |
| 87 | 87 |
| 88 // Resets the browser thread bundle to one with |options|. |
| 89 void ResetThreadBundle(int options); |
| 90 |
| 88 // TODO(rdevlin.cronin): Pull out more methods from ExtensionServiceTest that | 91 // TODO(rdevlin.cronin): Pull out more methods from ExtensionServiceTest that |
| 89 // are commonly used and/or reimplemented. For instance, methods to install | 92 // are commonly used and/or reimplemented. For instance, methods to install |
| 90 // extensions from various locations, etc. | 93 // extensions from various locations, etc. |
| 91 | 94 |
| 92 content::BrowserContext* browser_context(); | 95 content::BrowserContext* browser_context(); |
| 93 Profile* profile(); | 96 Profile* profile(); |
| 94 ExtensionService* service() { return service_; } | 97 ExtensionService* service() { return service_; } |
| 95 ExtensionRegistry* registry() { return registry_; } | 98 ExtensionRegistry* registry() { return registry_; } |
| 96 const base::FilePath& extensions_install_dir() const { | 99 const base::FilePath& extensions_install_dir() const { |
| 97 return extensions_install_dir_; | 100 return extensions_install_dir_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 113 private: | 116 private: |
| 114 void CreateExtensionService(const ExtensionServiceInitParams& params); | 117 void CreateExtensionService(const ExtensionServiceInitParams& params); |
| 115 | 118 |
| 116 // Destroy temp_dir_ after thread_bundle_ so clean-up tasks can still use the | 119 // Destroy temp_dir_ after thread_bundle_ so clean-up tasks can still use the |
| 117 // directory. | 120 // directory. |
| 118 base::ScopedTempDir temp_dir_; | 121 base::ScopedTempDir temp_dir_; |
| 119 | 122 |
| 120 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come | 123 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come |
| 121 // after thread_bundle_ in the destruction order. | 124 // after thread_bundle_ in the destruction order. |
| 122 base::ShadowingAtExitManager at_exit_manager_; | 125 base::ShadowingAtExitManager at_exit_manager_; |
| 123 content::TestBrowserThreadBundle thread_bundle_; | 126 scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_; |
| 127 |
| 128 // Whether or not the thread bundle was reset in the test. |
| 129 bool did_reset_thread_bundle_; |
| 124 | 130 |
| 125 // The directory into which extensions are installed. | 131 // The directory into which extensions are installed. |
| 126 base::FilePath extensions_install_dir_; | 132 base::FilePath extensions_install_dir_; |
| 127 | 133 |
| 128 // chrome/test/data/extensions/ | 134 // chrome/test/data/extensions/ |
| 129 base::FilePath data_dir_; | 135 base::FilePath data_dir_; |
| 130 | 136 |
| 131 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; | 137 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; |
| 132 | 138 |
| 133 // The associated ExtensionRegistry, for convenience. | 139 // The associated ExtensionRegistry, for convenience. |
| 134 extensions::ExtensionRegistry* registry_; | 140 extensions::ExtensionRegistry* registry_; |
| 135 | 141 |
| 136 #if defined OS_CHROMEOS | 142 #if defined OS_CHROMEOS |
| 137 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 143 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 138 chromeos::ScopedTestCrosSettings test_cros_settings_; | 144 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 139 chromeos::ScopedTestUserManager test_user_manager_; | 145 chromeos::ScopedTestUserManager test_user_manager_; |
| 140 #endif | 146 #endif |
| 141 }; | 147 }; |
| 142 | 148 |
| 143 } // namespace extensions | 149 } // namespace extensions |
| 144 | 150 |
| 145 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ | 151 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
| OLD | NEW |