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

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

Issue 1132493004: Enable extensions error button test that was failing on stable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply Feedback Created 5 years, 7 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 // The id of the extension from |InstallGoodExtension|.
11 // ExtensionSettingsUIBrowserTest::InstallGoodExtension() in some of the tests. 11 var GOOD_EXTENSION_ID = 'ldnnhddmnhbkjipkidpdiheffobcpfmf';
12 var GOOD_CRX_ID = 'ldnnhddmnhbkjipkidpdiheffobcpfmf'; 12 // The id of the extension from |InstallErrorsExtension|.
13 var ERROR_EXTENSION_ID = 'pdlpifnclfacjobnmbpngemkalkjamnf';
13 14
14 /** 15 /**
15 * Test C++ fixture for settings WebUI testing. 16 * Test C++ fixture for settings WebUI testing.
16 * @constructor 17 * @constructor
17 * @extends {testing.Test} 18 * @extends {testing.Test}
18 */ 19 */
19 function ExtensionSettingsUIBrowserTest() {} 20 function ExtensionSettingsUIBrowserTest() {}
20 21
21 /** 22 /**
22 * TestFixture for extension settings WebUI testing. 23 * TestFixture for extension settings WebUI testing.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 GEN(' InstallPackagedApp();'); 193 GEN(' InstallPackagedApp();');
193 194
194 GEN(' SetAutoConfirmUninstall();'); 195 GEN(' SetAutoConfirmUninstall();');
195 }, 196 },
196 197
197 /** @protected */ 198 /** @protected */
198 verifyDisabledWorks: function() { 199 verifyDisabledWorks: function() {
199 var listener = new UpdateListener( 200 var listener = new UpdateListener(
200 chrome.developerPrivate.EventType.UNLOADED, 201 chrome.developerPrivate.EventType.UNLOADED,
201 function() { 202 function() {
202 var node = getRequiredElement(GOOD_CRX_ID); 203 var node = getRequiredElement(GOOD_EXTENSION_ID);
203 assertTrue(node.classList.contains('inactive-extension')); 204 assertTrue(node.classList.contains('inactive-extension'));
204 this.nextStep(); 205 this.nextStep();
205 }.bind(this)); 206 }.bind(this));
206 chrome.management.setEnabled(GOOD_CRX_ID, false); 207 chrome.management.setEnabled(GOOD_EXTENSION_ID, false);
207 }, 208 },
208 209
209 /** @protected */ 210 /** @protected */
210 verifyEnabledWorks: function() { 211 verifyEnabledWorks: function() {
211 var listener = new UpdateListener( 212 var listener = new UpdateListener(
212 chrome.developerPrivate.EventType.LOADED, 213 chrome.developerPrivate.EventType.LOADED,
213 function() { 214 function() {
214 var node = getRequiredElement(GOOD_CRX_ID); 215 var node = getRequiredElement(GOOD_EXTENSION_ID);
215 assertFalse(node.classList.contains('inactive-extension')); 216 assertFalse(node.classList.contains('inactive-extension'));
216 this.nextStep(); 217 this.nextStep();
217 }.bind(this)); 218 }.bind(this));
218 chrome.management.setEnabled(GOOD_CRX_ID, true); 219 chrome.management.setEnabled(GOOD_EXTENSION_ID, true);
219 }, 220 },
220 221
221 /** @protected */ 222 /** @protected */
222 verifyUninstallWorks: function() { 223 verifyUninstallWorks: function() {
223 var listener = new UpdateListener( 224 var listener = new UpdateListener(
224 chrome.developerPrivate.EventType.UNINSTALLED, 225 chrome.developerPrivate.EventType.UNINSTALLED,
225 function() { 226 function() {
226 assertEquals(null, $(GOOD_CRX_ID)); 227 assertEquals(null, $(GOOD_EXTENSION_ID));
227 this.nextStep(); 228 this.nextStep();
228 }.bind(this)); 229 }.bind(this));
229 chrome.test.runWithUserGesture(function() { 230 chrome.test.runWithUserGesture(function() {
230 chrome.management.uninstall(GOOD_CRX_ID); 231 chrome.management.uninstall(GOOD_EXTENSION_ID);
231 }); 232 });
232 }, 233 },
233 }; 234 };
234 235
235 // Verify that developer mode doesn't change behavior when the number of 236 // Verify that developer mode doesn't change behavior when the number of
236 // extensions changes. 237 // extensions changes.
237 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperModeManyExtensions', 238 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperModeManyExtensions',
238 function() { 239 function() {
239 this.testDeveloperMode(); 240 this.testDeveloperMode();
240 }); 241 });
(...skipping 23 matching lines...) Expand all
264 assertFalse($('extension-list-wrapper').hidden); 265 assertFalse($('extension-list-wrapper').hidden);
265 assertTrue($('no-extensions').hidden); 266 assertTrue($('no-extensions').hidden);
266 assertGT($('extension-settings-list').childNodes.length, 0); 267 assertGT($('extension-settings-list').childNodes.length, 0);
267 this.nextStep(); 268 this.nextStep();
268 }; 269 };
269 270
270 this.steps = [this.waitForPageLoad, verifyListIsNotHiddenAndEmpty, testDone]; 271 this.steps = [this.waitForPageLoad, verifyListIsNotHiddenAndEmpty, testDone];
271 this.nextStep(); 272 this.nextStep();
272 }); 273 });
273 274
274 function AsyncExtensionSettingsWebUITest() {} 275 function DisableErrorButtonExtensionSettingsWebUITest() {}
275 276
276 AsyncExtensionSettingsWebUITest.prototype = { 277 DisableErrorButtonExtensionSettingsWebUITest.prototype = {
277 __proto__: ExtensionSettingsWebUITest.prototype, 278 __proto__: ExtensionSettingsWebUITest.prototype,
278 279
279 /** @override */ 280 /** @override */
280 testGenPreamble: function() { 281 testGenPreamble: function() {
282 GEN(' DisableErrorConsole();');
283
281 GEN(' InstallGoodExtension();'); 284 GEN(' InstallGoodExtension();');
282 GEN(' InstallErrorsExtension();'); 285 GEN(' InstallErrorsExtension();');
283 }, 286 },
284 }; 287 };
285 288
286 // Still fails on CrWinClang tester. BUG=463245 289 TEST_F('DisableErrorButtonExtensionSettingsWebUITest',
287 TEST_F('AsyncExtensionSettingsWebUITest', 290 'errorListButtonsHiddenIfNotDev', function() {
288 'DISABLED_testErrorListButtonVisibility',
289 function() {
290 var testButtonVisibility = function() { 291 var testButtonVisibility = function() {
291 var extensionList = $('extension-list-wrapper'); 292 var extensionList = $('extension-list-wrapper');
292 293
293 // 2 extensions are loaded: 294 var visibleButtons = extensionList.querySelectorAll(
294 // The 'good' extension will have 0 errors wich means no error button. 295 '.errors-link:not([hidden])');
295 // The 'bad' extension will have >3 manifest errors and <3 runtime errors. 296 expectEquals(0, visibleButtons.length);
296 // This means there will be a single error button. 297
298 var hiddenButtons = extensionList.querySelectorAll('.errors-link[hidden]');
299 expectEquals(2, hiddenButtons.length);
300
301 this.nextStep();
302 };
303
304 this.steps = [this.waitForPageLoad,
305 this.enableDeveloperMode,
306 testButtonVisibility,
307 testDone];
308 this.nextStep();
309 });
310
311 function EnableErrorButtonExtensionSettingsWebUITest() {}
312
313 EnableErrorButtonExtensionSettingsWebUITest.prototype = {
314 __proto__: ExtensionSettingsWebUITest.prototype,
315
316 /** @override */
317 testGenPreamble: function() {
318 GEN(' EnableErrorConsole();');
319
320 GEN(' InstallGoodExtension();');
321 GEN(' InstallErrorsExtension();');
322 },
323 };
324
325 TEST_F('EnableErrorButtonExtensionSettingsWebUITest',
326 'testErrorListButtonVisibility', function() {
327 var testButtonVisibility = function() {
328 var extensionList = $('extension-list-wrapper');
329
297 var visibleButtons = extensionList.querySelectorAll( 330 var visibleButtons = extensionList.querySelectorAll(
298 '.errors-link:not([hidden])'); 331 '.errors-link:not([hidden])');
299 expectEquals(1, visibleButtons.length); 332 expectEquals(1, visibleButtons.length);
300 333
334 if (visibleButtons.length > 0) {
335 var errorLink = $(ERROR_EXTENSION_ID).querySelector('.errors-link');
336 expectEquals(visibleButtons[0], errorLink);
337
338 var errorIcon = errorLink.querySelector('img');
339 expectTrue(errorIcon.classList.contains('extension-error-warning-icon'));
340 }
341
301 var hiddenButtons = extensionList.querySelectorAll('.errors-link[hidden]'); 342 var hiddenButtons = extensionList.querySelectorAll('.errors-link[hidden]');
302 expectEquals(1, hiddenButtons.length); 343 expectEquals(1, hiddenButtons.length);
303 344
304 this.nextStep(); 345 this.nextStep();
305 }; 346 };
306 347
307 this.steps = [this.waitForPageLoad, 348 this.steps = [this.waitForPageLoad,
308 this.enableDeveloperMode, 349 this.enableDeveloperMode,
309 testButtonVisibility, 350 testButtonVisibility,
310 testDone]; 351 testDone];
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 }; 403 };
363 404
364 TEST_F('InstallGoodExtensionSettingsWebUITest', 'testAccessibility', 405 TEST_F('InstallGoodExtensionSettingsWebUITest', 'testAccessibility',
365 function() { 406 function() {
366 this.emptyTestForAccessibility(); 407 this.emptyTestForAccessibility();
367 }); 408 });
368 409
369 TEST_F('InstallGoodExtensionSettingsWebUITest', 'showOptions', function() { 410 TEST_F('InstallGoodExtensionSettingsWebUITest', 'showOptions', function() {
370 var showExtensionOptions = function() { 411 var showExtensionOptions = function() {
371 var optionsOverlay = extensions.ExtensionOptionsOverlay.getInstance(); 412 var optionsOverlay = extensions.ExtensionOptionsOverlay.getInstance();
372 optionsOverlay.setExtensionAndShowOverlay(GOOD_CRX_ID, 'GOOD!', '', 413 optionsOverlay.setExtensionAndShowOverlay(GOOD_EXTENSION_ID, 'GOOD!', '',
373 this.nextStep.bind(this)); 414 this.nextStep.bind(this));
374 415
375 // Preferred size changes don't happen in browser tests. Just fake it. 416 // Preferred size changes don't happen in browser tests. Just fake it.
376 document.querySelector('extensionoptions').onpreferredsizechanged( 417 document.querySelector('extensionoptions').onpreferredsizechanged(
377 {width: 500, height: 500}); 418 {width: 500, height: 500});
378 }; 419 };
379 420
380 this.steps = [this.waitForPageLoad, showExtensionOptions, testDone]; 421 this.steps = [this.waitForPageLoad, showExtensionOptions, testDone];
381 this.nextStep(); 422 this.nextStep();
382 }); 423 });
(...skipping 22 matching lines...) Expand all
405 * @constructor 446 * @constructor
406 * @extends {InstallGoodExtensionSettingsWebUITest} 447 * @extends {InstallGoodExtensionSettingsWebUITest}
407 */ 448 */
408 function OptionsDialogExtensionSettingsWebUITest() {} 449 function OptionsDialogExtensionSettingsWebUITest() {}
409 450
410 OptionsDialogExtensionSettingsWebUITest.prototype = { 451 OptionsDialogExtensionSettingsWebUITest.prototype = {
411 __proto__: InstallGoodExtensionSettingsWebUITest.prototype, 452 __proto__: InstallGoodExtensionSettingsWebUITest.prototype,
412 453
413 /** @override */ 454 /** @override */
414 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + 455 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload +
415 '?options=' + GOOD_CRX_ID, 456 '?options=' + GOOD_EXTENSION_ID,
416 }; 457 };
417 458
418 TEST_F('OptionsDialogExtensionSettingsWebUITest', 'testAccessibility', 459 TEST_F('OptionsDialogExtensionSettingsWebUITest', 'testAccessibility',
419 function() { 460 function() {
420 this.emptyTestForAccessibility(); 461 this.emptyTestForAccessibility();
421 }); 462 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698