Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_browsertest.js

Issue 1092953004: [Extensions] Update developerPrivate API to use base-64 data urls for icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // TODO(dbeam): test for loading upacked extensions? 5 // TODO(dbeam): test for loading upacked extensions?
6 6
7 GEN('#include "chrome/browser/ui/webui/extensions/' + 7 GEN('#include "chrome/browser/ui/webui/extensions/' +
8 'extension_settings_browsertest.h"'); 8 'extension_settings_browsertest.h"');
9 9
10 // chrome/test/data/extensions/good.crx's extension ID. good.crx is loaded by 10 // chrome/test/data/extensions/good.crx's extension ID. good.crx is loaded by
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // Show the dialog, which triggers a chrome.send() for metrics purposes. 144 // Show the dialog, which triggers a chrome.send() for metrics purposes.
145 cr.dispatchSimpleEvent($('pack-extension'), 'click'); 145 cr.dispatchSimpleEvent($('pack-extension'), 'click');
146 assertTrue($('pack-extension-overlay').classList.contains('showing')); 146 assertTrue($('pack-extension-overlay').classList.contains('showing'));
147 this.nextStep(); 147 this.nextStep();
148 }; 148 };
149 149
150 this.steps = [this.waitForPageLoad, testPackExtenion, testDone]; 150 this.steps = [this.waitForPageLoad, testPackExtenion, testDone];
151 this.nextStep(); 151 this.nextStep();
152 }); 152 });
153 153
154 /**
155 * @param {chrome.developerPrivate.EventType} eventType
156 * @param {function():void} callback
157 * @constructor
158 */
159 function UpdateListener(eventType, callback) {
160 this.callback_ = callback;
161 this.eventType_ = eventType;
162 this.onItemStateChangedListener_ = this.onItemStateChanged_.bind(this);
163 chrome.developerPrivate.onItemStateChanged.addListener(
164 this.onItemStateChangedListener_);
165 }
166
167 UpdateListener.prototype = {
168 /** @private */
169 onItemStateChanged_: function(data) {
170 if (this.eventType_ == data.event_type) {
171 window.setTimeout(function() {
172 chrome.developerPrivate.onItemStateChanged.removeListener(
173 this.onItemStateChangedListener_);
174 this.callback_();
175 }.bind(this), 0);
176 }
177 }
178 };
179
154 function BasicExtensionSettingsWebUITest() {} 180 function BasicExtensionSettingsWebUITest() {}
155 181
156 BasicExtensionSettingsWebUITest.prototype = { 182 BasicExtensionSettingsWebUITest.prototype = {
157 __proto__: ExtensionSettingsWebUITest.prototype, 183 __proto__: ExtensionSettingsWebUITest.prototype,
158 184
159 /** @override */ 185 /** @override */
160 testGenPreamble: function() { 186 testGenPreamble: function() {
161 // Install multiple types of extensions to ensure we handle each type. 187 // Install multiple types of extensions to ensure we handle each type.
162 // TODO(devlin): There are more types to add here. 188 // TODO(devlin): There are more types to add here.
163 GEN(' InstallGoodExtension();'); 189 GEN(' InstallGoodExtension();');
164 GEN(' InstallErrorsExtension();'); 190 GEN(' InstallErrorsExtension();');
165 GEN(' InstallSharedModule();'); 191 GEN(' InstallSharedModule();');
166 GEN(' InstallPackagedApp();'); 192 GEN(' InstallPackagedApp();');
167 193
168 GEN(' SetAutoConfirmUninstall();'); 194 GEN(' SetAutoConfirmUninstall();');
169 }, 195 },
170 196
171 /** @protected */ 197 /** @protected */
172 verifyDisabledWorks: function() { 198 verifyDisabledWorks: function() {
173 chrome.management.setEnabled(GOOD_CRX_ID, false, function() { 199 var listener = new UpdateListener(
200 chrome.developerPrivate.EventType.UNLOADED,
201 function() {
174 var node = getRequiredElement(GOOD_CRX_ID); 202 var node = getRequiredElement(GOOD_CRX_ID);
175 assertTrue(node.classList.contains('inactive-extension')); 203 assertTrue(node.classList.contains('inactive-extension'));
176 this.nextStep(); 204 this.nextStep();
177 }.bind(this)); 205 }.bind(this));
206 chrome.management.setEnabled(GOOD_CRX_ID, false);
178 }, 207 },
179 208
180 /** @protected */ 209 /** @protected */
181 verifyEnabledWorks: function() { 210 verifyEnabledWorks: function() {
182 chrome.management.setEnabled(GOOD_CRX_ID, true, function() { 211 var listener = new UpdateListener(
212 chrome.developerPrivate.EventType.LOADED,
213 function() {
183 var node = getRequiredElement(GOOD_CRX_ID); 214 var node = getRequiredElement(GOOD_CRX_ID);
184 assertFalse(node.classList.contains('inactive-extension')); 215 assertFalse(node.classList.contains('inactive-extension'));
185 this.nextStep(); 216 this.nextStep();
186 }.bind(this)); 217 }.bind(this));
218 chrome.management.setEnabled(GOOD_CRX_ID, true);
187 }, 219 },
188 220
189 /** @protected */ 221 /** @protected */
190 verifyUninstallWorks: function() { 222 verifyUninstallWorks: function() {
191 var next = this.nextStep.bind(this); 223 var listener = new UpdateListener(
224 chrome.developerPrivate.EventType.UNINSTALLED,
225 function() {
226 assertEquals(null, $(GOOD_CRX_ID));
227 this.nextStep();
228 }.bind(this));
192 chrome.test.runWithUserGesture(function() { 229 chrome.test.runWithUserGesture(function() {
193 chrome.management.uninstall(GOOD_CRX_ID, function() { 230 chrome.management.uninstall(GOOD_CRX_ID);
194 assertEquals(null, $(GOOD_CRX_ID));
195 next();
196 });
197 }); 231 });
198 }, 232 },
199 }; 233 };
200 234
201 // Verify that developer mode doesn't change behavior when the number of 235 // Verify that developer mode doesn't change behavior when the number of
202 // extensions changes. 236 // extensions changes.
203 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperModeManyExtensions', 237 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperModeManyExtensions',
204 function() { 238 function() {
205 this.testDeveloperMode(); 239 this.testDeveloperMode();
206 }); 240 });
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 417
384 /** @override */ 418 /** @override */
385 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + 419 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload +
386 '?options=' + GOOD_CRX_ID, 420 '?options=' + GOOD_CRX_ID,
387 }; 421 };
388 422
389 TEST_F('OptionsDialogExtensionSettingsWebUITest', 'testAccessibility', 423 TEST_F('OptionsDialogExtensionSettingsWebUITest', 'testAccessibility',
390 function() { 424 function() {
391 this.emptyTestForAccessibility(); 425 this.emptyTestForAccessibility();
392 }); 426 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698