| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "chrome/browser/extensions/extension_host.h" | 14 #include "chrome/browser/extensions/extension_host.h" |
| 15 #include "chrome/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/feature_switch.h" | 18 #include "chrome/common/extensions/feature_switch.h" |
| 19 #include "chrome/common/extensions/features/feature.h" | 19 #include "chrome/common/extensions/features/feature.h" |
| 20 #include "chrome/common/extensions/manifest.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "content/public/browser/notification_details.h" | 22 #include "content/public/browser/notification_details.h" |
| 22 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
| 23 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 25 | 26 |
| 26 class ExtensionService; | 27 class ExtensionService; |
| 27 class ExtensionProcessManager; | 28 class ExtensionProcessManager; |
| 28 class Profile; | 29 class Profile; |
| 29 | 30 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // |expected_change| indicates how many extensions should be installed (or | 91 // |expected_change| indicates how many extensions should be installed (or |
| 91 // disabled, if negative). | 92 // disabled, if negative). |
| 92 // 1 means you expect a new install, 0 means you expect an upgrade, -1 means | 93 // 1 means you expect a new install, 0 means you expect an upgrade, -1 means |
| 93 // you expect a failed upgrade. | 94 // you expect a failed upgrade. |
| 94 const extensions::Extension* InstallExtension(const FilePath& path, | 95 const extensions::Extension* InstallExtension(const FilePath& path, |
| 95 int expected_change) { | 96 int expected_change) { |
| 96 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, | 97 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, |
| 97 expected_change); | 98 expected_change); |
| 98 } | 99 } |
| 99 | 100 |
| 100 // Same as above, but an install source other than Extension::INTERNAL can be | 101 // Same as above, but an install source other than Manifest::INTERNAL can be |
| 101 // specified. | 102 // specified. |
| 102 const extensions::Extension* InstallExtension( | 103 const extensions::Extension* InstallExtension( |
| 103 const FilePath& path, | 104 const FilePath& path, |
| 104 int expected_change, | 105 int expected_change, |
| 105 extensions::Extension::Location install_source) { | 106 extensions::Manifest::Location install_source) { |
| 106 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, | 107 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, |
| 107 expected_change, install_source); | 108 expected_change, install_source); |
| 108 } | 109 } |
| 109 | 110 |
| 110 // Installs extension as if it came from the Chrome Webstore. | 111 // Installs extension as if it came from the Chrome Webstore. |
| 111 const extensions::Extension* InstallExtensionFromWebstore( | 112 const extensions::Extension* InstallExtensionFromWebstore( |
| 112 const FilePath& path, int expected_change); | 113 const FilePath& path, int expected_change); |
| 113 | 114 |
| 114 // Same as above but passes an id to CrxInstaller and does not allow a | 115 // Same as above but passes an id to CrxInstaller and does not allow a |
| 115 // privilege increase. | 116 // privilege increase. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 const FilePath& path, | 234 const FilePath& path, |
| 234 InstallUIType ui_type, | 235 InstallUIType ui_type, |
| 235 int expected_change, | 236 int expected_change, |
| 236 Browser* browser, | 237 Browser* browser, |
| 237 bool from_webstore); | 238 bool from_webstore); |
| 238 const extensions::Extension* InstallOrUpdateExtension( | 239 const extensions::Extension* InstallOrUpdateExtension( |
| 239 const std::string& id, | 240 const std::string& id, |
| 240 const FilePath& path, | 241 const FilePath& path, |
| 241 InstallUIType ui_type, | 242 InstallUIType ui_type, |
| 242 int expected_change, | 243 int expected_change, |
| 243 extensions::Extension::Location install_source); | 244 extensions::Manifest::Location install_source); |
| 244 const extensions::Extension* InstallOrUpdateExtension( | 245 const extensions::Extension* InstallOrUpdateExtension( |
| 245 const std::string& id, | 246 const std::string& id, |
| 246 const FilePath& path, | 247 const FilePath& path, |
| 247 InstallUIType ui_type, | 248 InstallUIType ui_type, |
| 248 int expected_change, | 249 int expected_change, |
| 249 extensions::Extension::Location install_source, | 250 extensions::Manifest::Location install_source, |
| 250 Browser* browser, | 251 Browser* browser, |
| 251 bool from_webstore); | 252 bool from_webstore); |
| 252 | 253 |
| 253 bool WaitForExtensionViewsToLoad(); | 254 bool WaitForExtensionViewsToLoad(); |
| 254 | 255 |
| 255 // 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 |
| 256 // value. | 257 // value. |
| 257 int target_page_action_count_; | 258 int target_page_action_count_; |
| 258 | 259 |
| 259 // 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 |
| 260 // reaches this value. | 261 // reaches this value. |
| 261 int target_visible_page_action_count_; | 262 int target_visible_page_action_count_; |
| 262 | 263 |
| 263 // Make the current channel "dev" for the duration of the test. | 264 // Make the current channel "dev" for the duration of the test. |
| 264 extensions::Feature::ScopedCurrentChannel current_channel_; | 265 extensions::Feature::ScopedCurrentChannel current_channel_; |
| 265 | 266 |
| 266 // Disable external install UI. | 267 // Disable external install UI. |
| 267 extensions::FeatureSwitch::ScopedOverride | 268 extensions::FeatureSwitch::ScopedOverride |
| 268 override_prompt_for_external_extensions_; | 269 override_prompt_for_external_extensions_; |
| 269 | 270 |
| 270 // Disable the sideload wipeout UI. | 271 // Disable the sideload wipeout UI. |
| 271 extensions::FeatureSwitch::ScopedOverride | 272 extensions::FeatureSwitch::ScopedOverride |
| 272 override_sideload_wipeout_; | 273 override_sideload_wipeout_; |
| 273 }; | 274 }; |
| 274 | 275 |
| 275 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 276 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| OLD | NEW |