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

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

Issue 916243002: Enable keyboard shortcuts for chrome://extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply Feedback Created 5 years, 10 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 assertTrue($('pack-extension-overlay').classList.contains('showing')); 56 assertTrue($('pack-extension-overlay').classList.contains('showing'));
57 }); 57 });
58 58
59 function AsyncExtensionSettingsWebUITest() {} 59 function AsyncExtensionSettingsWebUITest() {}
60 60
61 AsyncExtensionSettingsWebUITest.prototype = { 61 AsyncExtensionSettingsWebUITest.prototype = {
62 __proto__: ExtensionSettingsWebUITest.prototype, 62 __proto__: ExtensionSettingsWebUITest.prototype,
63 63
64 /** @override */ 64 /** @override */
65 isAsync: true, 65 isAsync: true,
66
67 /** @override */
68 testGenPreamble: function() {
69 GEN(' InstallGoodExtension();');
70 GEN(' InstallErrorsExtension();');
Dan Beam 2015/02/20 23:36:43 doesn't care about the return value
hcarmona 2015/02/21 00:16:01 Acknowledged.
71 },
72
73 enableDeveloperMode: function(callback) {
74 var devControls = $('dev-controls');
75
76 // Make sure developer controls are hidden before checkbox is clicked.
77 assertEquals(0, devControls.offsetHeight);
78 $('toggle-dev-on').click();
79
80 document.addEventListener('webkitTransitionEnd', function f(e) {
81 if (e.target == devControls) {
82 // Make sure developer controls are not hidden after checkbox is
83 // clicked.
84 assertGT(devControls.offsetHeight, 0);
85
86 document.removeEventListener(f, 'webkitTransitionEnd');
87 callback();
88 }
89 });
90 ensureTransitionEndEvent(devControls, 4000);
91 },
66 }; 92 };
67 93
68 TEST_F('AsyncExtensionSettingsWebUITest', 'testDeveloperModeA11y', function() { 94 TEST_F('AsyncExtensionSettingsWebUITest', 'testDeveloperModeA11y', function() {
69 var devControls = $('dev-controls'); 95 this.enableDeveloperMode(testDone);
96 });
70 97
71 // Make sure developer controls are hidden before checkbox is clicked. 98 TEST_F('AsyncExtensionSettingsWebUITest', 'testErrorListButtonVisibility',
72 assertEquals(0, devControls.offsetHeight); 99 function() {
73 $('toggle-dev-on').click(); 100 this.enableDeveloperMode(function() {
101 // 2 extensions are loaded:
102 // The 'good' extension will have 0 errors wich means no error list
103 // buttons.
104 // The 'bad' extension will have >3 manifest errors and <3 runtime errors.
105 // This means 2 buttons: 1 visible and 1 hidden.
74 106
Dan Beam 2015/02/20 23:36:43 nit: remove \n
hcarmona 2015/02/21 00:16:01 Done.
75 document.addEventListener('webkitTransitionEnd', function f(e) { 107 var visibleButtons = document.querySelectorAll(
76 if (e.target == devControls) { 108 '.extension-error-list-show-more > a:not([hidden])');
77 // Make sure developer controls are not hidden after checkbox is clicked. 109 assertEquals(1, visibleButtons.length);
78 assertGT(devControls.offsetHeight, 0); 110 // Visible buttons must be part of the focusRow.
111 assertTrue(visibleButtons[0].hasAttribute('column-type'));
79 112
80 document.removeEventListener(f, 'webkitTransitionEnd'); 113 var hiddenButtons = document.querySelectorAll(
81 testDone(); 114 '.extension-error-list-show-more > a[hidden]');
82 } 115 assertEquals(1, hiddenButtons.length);
116 // Hidden buttons must NOT be part of the focusRow.
117 assertFalse(hiddenButtons[0].hasAttribute('column-type'));
118
119 testDone();
83 }); 120 });
84 ensureTransitionEndEvent(devControls, 4000);
85 }); 121 });
86 122
87 /** 123 /**
88 * TestFixture for extension settings WebUI testing (commands config edition). 124 * TestFixture for extension settings WebUI testing (commands config edition).
89 * @extends {testing.Test} 125 * @extends {testing.Test}
90 * @constructor 126 * @constructor
91 */ 127 */
92 function ExtensionSettingsCommandsConfigWebUITest() {} 128 function ExtensionSettingsCommandsConfigWebUITest() {}
93 129
94 ExtensionSettingsCommandsConfigWebUITest.prototype = { 130 ExtensionSettingsCommandsConfigWebUITest.prototype = {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 225
190 ExtensionOptionsDialogWebUITest.prototype = { 226 ExtensionOptionsDialogWebUITest.prototype = {
191 __proto__: InstalledExtensionSettingsWebUITest.prototype, 227 __proto__: InstalledExtensionSettingsWebUITest.prototype,
192 228
193 /** @override */ 229 /** @override */
194 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + 230 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload +
195 '?options=' + GOOD_CRX_ID, 231 '?options=' + GOOD_CRX_ID,
196 }; 232 };
197 233
198 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); 234 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698