| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // |expected_change| indicates how many extensions should be installed (or | 45 // |expected_change| indicates how many extensions should be installed (or |
| 46 // disabled, if negative). | 46 // disabled, if negative). |
| 47 // 1 means you expect a new install, 0 means you expect an upgrade, -1 means | 47 // 1 means you expect a new install, 0 means you expect an upgrade, -1 means |
| 48 // you expect a failed upgrade. | 48 // you expect a failed upgrade. |
| 49 bool InstallExtension(const FilePath& path, int expected_change) { | 49 bool InstallExtension(const FilePath& path, int expected_change) { |
| 50 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, | 50 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, |
| 51 expected_change); | 51 expected_change); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Installs extension as if it came from the Chrome Webstore. |
| 55 bool InstallExtensionFromWebstore(const FilePath& path, int expected_change); |
| 56 |
| 54 // Same as above but passes an id to CrxInstaller and does not allow a | 57 // Same as above but passes an id to CrxInstaller and does not allow a |
| 55 // privilege increase. | 58 // privilege increase. |
| 56 bool UpdateExtension(const std::string& id, const FilePath& path, | 59 bool UpdateExtension(const std::string& id, const FilePath& path, |
| 57 int expected_change) { | 60 int expected_change) { |
| 58 return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, | 61 return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, |
| 59 expected_change); | 62 expected_change); |
| 60 } | 63 } |
| 61 | 64 |
| 62 // Same as |InstallExtension| but with the normal extension UI showing up | 65 // Same as |InstallExtension| but with the normal extension UI showing up |
| 63 // (for e.g. info bar on success). | 66 // (for e.g. info bar on success). |
| 64 bool InstallExtensionWithUI(const FilePath& path, int expected_change) { | 67 bool InstallExtensionWithUI(const FilePath& path, int expected_change) { |
| 65 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, | 68 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, |
| 66 expected_change); | 69 expected_change); |
| 67 } | 70 } |
| 68 bool InstallExtensionWithUIAutoConfirm(const FilePath& path, | 71 bool InstallExtensionWithUIAutoConfirm(const FilePath& path, |
| 69 int expected_change, | 72 int expected_change, |
| 70 Profile* profile) { | 73 Profile* profile) { |
| 71 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, | 74 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, |
| 72 expected_change, profile); | 75 expected_change, profile, false); |
| 73 } | 76 } |
| 74 | 77 |
| 75 // Begins install process but simulates a user cancel. | 78 // Begins install process but simulates a user cancel. |
| 76 bool StartInstallButCancel(const FilePath& path) { | 79 bool StartInstallButCancel(const FilePath& path) { |
| 77 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); | 80 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); |
| 78 } | 81 } |
| 79 | 82 |
| 80 void ReloadExtension(const std::string& extension_id); | 83 void ReloadExtension(const std::string& extension_id); |
| 81 | 84 |
| 82 void UnloadExtension(const std::string& extension_id); | 85 void UnloadExtension(const std::string& extension_id); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 INSTALL_UI_TYPE_NORMAL, | 136 INSTALL_UI_TYPE_NORMAL, |
| 134 INSTALL_UI_TYPE_AUTO_CONFIRM, | 137 INSTALL_UI_TYPE_AUTO_CONFIRM, |
| 135 }; | 138 }; |
| 136 | 139 |
| 137 bool InstallOrUpdateExtension(const std::string& id, const FilePath& path, | 140 bool InstallOrUpdateExtension(const std::string& id, const FilePath& path, |
| 138 InstallUIType ui_type, | 141 InstallUIType ui_type, |
| 139 int expected_change); | 142 int expected_change); |
| 140 bool InstallOrUpdateExtension(const std::string& id, const FilePath& path, | 143 bool InstallOrUpdateExtension(const std::string& id, const FilePath& path, |
| 141 InstallUIType ui_type, | 144 InstallUIType ui_type, |
| 142 int expected_change, | 145 int expected_change, |
| 143 Profile* profile); | 146 Profile* profile, |
| 147 bool from_webstore); |
| 144 | 148 |
| 145 bool WaitForExtensionHostsToLoad(); | 149 bool WaitForExtensionHostsToLoad(); |
| 146 | 150 |
| 147 // When waiting for page action count to change, we wait until it reaches this | 151 // When waiting for page action count to change, we wait until it reaches this |
| 148 // value. | 152 // value. |
| 149 int target_page_action_count_; | 153 int target_page_action_count_; |
| 150 | 154 |
| 151 // When waiting for visible page action count to change, we wait until it | 155 // When waiting for visible page action count to change, we wait until it |
| 152 // reaches this value. | 156 // reaches this value. |
| 153 int target_visible_page_action_count_; | 157 int target_visible_page_action_count_; |
| 154 }; | 158 }; |
| 155 | 159 |
| 156 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 160 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
| OLD | NEW |