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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const base::FilePath& crx_path, | 105 const base::FilePath& crx_path, |
106 const base::FilePath& pem_path, | 106 const base::FilePath& pem_path, |
107 const base::FilePath& pem_out_path); | 107 const base::FilePath& pem_out_path); |
108 | 108 |
109 // |expected_change| indicates how many extensions should be installed (or | 109 // |expected_change| indicates how many extensions should be installed (or |
110 // disabled, if negative). | 110 // disabled, if negative). |
111 // 1 means you expect a new install, 0 means you expect an upgrade, -1 means | 111 // 1 means you expect a new install, 0 means you expect an upgrade, -1 means |
112 // you expect a failed upgrade. | 112 // you expect a failed upgrade. |
113 const extensions::Extension* InstallExtension(const base::FilePath& path, | 113 const extensions::Extension* InstallExtension(const base::FilePath& path, |
114 int expected_change) { | 114 int expected_change) { |
115 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, | 115 return InstallOrUpdateExtension( |
116 expected_change); | 116 std::string(), path, INSTALL_UI_TYPE_NONE, expected_change); |
117 } | 117 } |
118 | 118 |
119 // Same as above, but an install source other than Manifest::INTERNAL can be | 119 // Same as above, but an install source other than Manifest::INTERNAL can be |
120 // specified. | 120 // specified. |
121 const extensions::Extension* InstallExtension( | 121 const extensions::Extension* InstallExtension( |
122 const base::FilePath& path, | 122 const base::FilePath& path, |
123 int expected_change, | 123 int expected_change, |
124 extensions::Manifest::Location install_source) { | 124 extensions::Manifest::Location install_source) { |
125 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, | 125 return InstallOrUpdateExtension(std::string(), |
126 expected_change, install_source); | 126 path, |
| 127 INSTALL_UI_TYPE_NONE, |
| 128 expected_change, |
| 129 install_source); |
127 } | 130 } |
128 | 131 |
129 // Installs extension as if it came from the Chrome Webstore. | 132 // Installs extension as if it came from the Chrome Webstore. |
130 const extensions::Extension* InstallExtensionFromWebstore( | 133 const extensions::Extension* InstallExtensionFromWebstore( |
131 const base::FilePath& path, int expected_change); | 134 const base::FilePath& path, int expected_change); |
132 | 135 |
133 // Same as above but passes an id to CrxInstaller and does not allow a | 136 // Same as above but passes an id to CrxInstaller and does not allow a |
134 // privilege increase. | 137 // privilege increase. |
135 const extensions::Extension* UpdateExtension(const std::string& id, | 138 const extensions::Extension* UpdateExtension(const std::string& id, |
136 const base::FilePath& path, | 139 const base::FilePath& path, |
137 int expected_change) { | 140 int expected_change) { |
138 return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, | 141 return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, |
139 expected_change); | 142 expected_change); |
140 } | 143 } |
141 | 144 |
142 // Same as |InstallExtension| but with the normal extension UI showing up | 145 // Same as |InstallExtension| but with the normal extension UI showing up |
143 // (for e.g. info bar on success). | 146 // (for e.g. info bar on success). |
144 const extensions::Extension* InstallExtensionWithUI( | 147 const extensions::Extension* InstallExtensionWithUI( |
145 const base::FilePath& path, | 148 const base::FilePath& path, |
146 int expected_change) { | 149 int expected_change) { |
147 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, | 150 return InstallOrUpdateExtension( |
148 expected_change); | 151 std::string(), path, INSTALL_UI_TYPE_NORMAL, expected_change); |
149 } | 152 } |
150 | 153 |
151 const extensions::Extension* InstallExtensionWithUIAutoConfirm( | 154 const extensions::Extension* InstallExtensionWithUIAutoConfirm( |
152 const base::FilePath& path, | 155 const base::FilePath& path, |
153 int expected_change, | 156 int expected_change, |
154 Browser* browser) { | 157 Browser* browser) { |
155 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, | 158 return InstallOrUpdateExtension(std::string(), |
156 expected_change, browser, false); | 159 path, |
| 160 INSTALL_UI_TYPE_AUTO_CONFIRM, |
| 161 expected_change, |
| 162 browser, |
| 163 false); |
157 } | 164 } |
158 | 165 |
159 // Begins install process but simulates a user cancel. | 166 // Begins install process but simulates a user cancel. |
160 const extensions::Extension* StartInstallButCancel( | 167 const extensions::Extension* StartInstallButCancel( |
161 const base::FilePath& path) { | 168 const base::FilePath& path) { |
162 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); | 169 return InstallOrUpdateExtension( |
| 170 std::string(), path, INSTALL_UI_TYPE_CANCEL, 0); |
163 } | 171 } |
164 | 172 |
165 void ReloadExtension(const std::string& extension_id); | 173 void ReloadExtension(const std::string& extension_id); |
166 | 174 |
167 void UnloadExtension(const std::string& extension_id); | 175 void UnloadExtension(const std::string& extension_id); |
168 | 176 |
169 void UninstallExtension(const std::string& extension_id); | 177 void UninstallExtension(const std::string& extension_id); |
170 | 178 |
171 void DisableExtension(const std::string& extension_id); | 179 void DisableExtension(const std::string& extension_id); |
172 | 180 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 300 |
293 // Disable the sideload wipeout UI. | 301 // Disable the sideload wipeout UI. |
294 extensions::FeatureSwitch::ScopedOverride | 302 extensions::FeatureSwitch::ScopedOverride |
295 override_sideload_wipeout_; | 303 override_sideload_wipeout_; |
296 | 304 |
297 // The default profile to be used. | 305 // The default profile to be used. |
298 Profile* profile_; | 306 Profile* profile_; |
299 }; | 307 }; |
300 | 308 |
301 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ | 309 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSERTEST_H_ |
OLD | NEW |