| 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_EXTENSION_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // them for testing). | 44 // them for testing). |
| 45 kFlagAllowOldManifestVersions = 1 << 3, | 45 kFlagAllowOldManifestVersions = 1 << 3, |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 ExtensionBrowserTest(); | 48 ExtensionBrowserTest(); |
| 49 virtual ~ExtensionBrowserTest(); | 49 virtual ~ExtensionBrowserTest(); |
| 50 | 50 |
| 51 // InProcessBrowserTest | 51 // InProcessBrowserTest |
| 52 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 52 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| 53 | 53 |
| 54 const extensions::Extension* LoadExtension(const FilePath& path); | 54 static const extensions::Extension* LoadExtension( |
| 55 Browser* browser, NotificationObserver* observer, const FilePath& path); |
| 56 const extensions::Extension* LoadExtension(const FilePath& path) { |
| 57 return LoadExtension(browser(), this, path); |
| 58 } |
| 55 | 59 |
| 56 // Same as above, but enables the extension in incognito mode first. | 60 // Same as above, but enables the extension in incognito mode first. |
| 57 const extensions::Extension* LoadExtensionIncognito(const FilePath& path); | 61 const extensions::Extension* LoadExtensionIncognito(const FilePath& path); |
| 58 | 62 |
| 59 const extensions::Extension* LoadExtensionWithFlags( | 63 static const extensions::Extension* LoadExtensionWithFlags( |
| 64 Browser* browser, NotificationObserver* observer, |
| 60 const FilePath& path, int flags); | 65 const FilePath& path, int flags); |
| 61 | 66 |
| 67 const extensions::Extension* LoadExtensionWithFlags( |
| 68 const FilePath& path, int flags) { |
| 69 return LoadExtensionWithFlags(browser(), this, path, flags); |
| 70 } |
| 62 // Loads extension and imitates that it is a component extension. | 71 // Loads extension and imitates that it is a component extension. |
| 63 const extensions::Extension* LoadExtensionAsComponent(const FilePath& path); | 72 const extensions::Extension* LoadExtensionAsComponent(const FilePath& path); |
| 64 | 73 |
| 65 // Pack the extension in |dir_path| into a crx file and return its path. | 74 // Pack the extension in |dir_path| into a crx file and return its path. |
| 66 // Return an empty FilePath if there were errors. | 75 // Return an empty FilePath if there were errors. |
| 67 FilePath PackExtension(const FilePath& dir_path); | 76 FilePath PackExtension(const FilePath& dir_path); |
| 68 | 77 |
| 69 // Pack the extension in |dir_path| into a crx file at |crx_path|, using the | 78 // Pack the extension in |dir_path| into a crx file at |crx_path|, using the |
| 70 // key |pem_path|. If |pem_path| does not exist, create a new key at | 79 // key |pem_path|. If |pem_path| does not exist, create a new key at |
| 71 // |pem_out_path|. | 80 // |pem_out_path|. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 extensions::Extension::Location install_source); | 240 extensions::Extension::Location install_source); |
| 232 const extensions::Extension* InstallOrUpdateExtension( | 241 const extensions::Extension* InstallOrUpdateExtension( |
| 233 const std::string& id, | 242 const std::string& id, |
| 234 const FilePath& path, | 243 const FilePath& path, |
| 235 InstallUIType ui_type, | 244 InstallUIType ui_type, |
| 236 int expected_change, | 245 int expected_change, |
| 237 extensions::Extension::Location install_source, | 246 extensions::Extension::Location install_source, |
| 238 Browser* browser, | 247 Browser* browser, |
| 239 bool from_webstore); | 248 bool from_webstore); |
| 240 | 249 |
| 241 bool WaitForExtensionViewsToLoad(); | 250 static bool WaitForExtensionViewsToLoad( |
| 251 Browser* browser, NotificationObserver* observer); |
| 252 bool WaitForExtensionViewsToLoad() { |
| 253 return WaitForExtensionViewsToLoad(browser(), this); |
| 254 } |
| 242 | 255 |
| 243 // When waiting for page action count to change, we wait until it reaches this | 256 // When waiting for page action count to change, we wait until it reaches this |
| 244 // value. | 257 // value. |
| 245 int target_page_action_count_; | 258 int target_page_action_count_; |
| 246 | 259 |
| 247 // When waiting for visible page action count to change, we wait until it | 260 // When waiting for visible page action count to change, we wait until it |
| 248 // reaches this value. | 261 // reaches this value. |
| 249 int target_visible_page_action_count_; | 262 int target_visible_page_action_count_; |
| 250 | 263 |
| 251 // Make the current channel "dev" for the duration of the test. | 264 // Make the current channel "dev" for the duration of the test. |
| 252 extensions::Feature::ScopedCurrentChannel current_channel_; | 265 extensions::Feature::ScopedCurrentChannel current_channel_; |
| 253 | 266 |
| 254 // Disable external install UI. | 267 // Disable external install UI. |
| 255 extensions::FeatureSwitch::ScopedOverride | 268 extensions::FeatureSwitch::ScopedOverride |
| 256 override_prompt_for_external_extensions_; | 269 override_prompt_for_external_extensions_; |
| 257 }; | 270 }; |
| 258 | 271 |
| 259 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 272 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| OLD | NEW |