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 // 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 Loading... |
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();'); |
| 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. |
| 106 var visibleButtons = document.querySelectorAll( |
| 107 '.extension-error-list-show-more > a:not([hidden])'); |
| 108 assertEquals(1, visibleButtons.length); |
| 109 // Visible buttons must be part of the focusRow. |
| 110 assertTrue(visibleButtons[0].hasAttribute('column-type')); |
74 | 111 |
75 document.addEventListener('webkitTransitionEnd', function f(e) { | 112 var hiddenButtons = document.querySelectorAll( |
76 if (e.target == devControls) { | 113 '.extension-error-list-show-more > a[hidden]'); |
77 // Make sure developer controls are not hidden after checkbox is clicked. | 114 assertEquals(1, hiddenButtons.length); |
78 assertGT(devControls.offsetHeight, 0); | 115 // Hidden buttons must NOT be part of the focusRow. |
| 116 assertFalse(hiddenButtons[0].hasAttribute('column-type')); |
79 | 117 |
80 document.removeEventListener(f, 'webkitTransitionEnd'); | 118 testDone(); |
81 testDone(); | |
82 } | |
83 }); | 119 }); |
84 ensureTransitionEndEvent(devControls, 4000); | |
85 }); | 120 }); |
86 | 121 |
87 /** | 122 /** |
88 * TestFixture for extension settings WebUI testing (commands config edition). | 123 * TestFixture for extension settings WebUI testing (commands config edition). |
89 * @extends {testing.Test} | 124 * @extends {testing.Test} |
90 * @constructor | 125 * @constructor |
91 */ | 126 */ |
92 function ExtensionSettingsCommandsConfigWebUITest() {} | 127 function ExtensionSettingsCommandsConfigWebUITest() {} |
93 | 128 |
94 ExtensionSettingsCommandsConfigWebUITest.prototype = { | 129 ExtensionSettingsCommandsConfigWebUITest.prototype = { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 224 |
190 ExtensionOptionsDialogWebUITest.prototype = { | 225 ExtensionOptionsDialogWebUITest.prototype = { |
191 __proto__: InstalledExtensionSettingsWebUITest.prototype, | 226 __proto__: InstalledExtensionSettingsWebUITest.prototype, |
192 | 227 |
193 /** @override */ | 228 /** @override */ |
194 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + | 229 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + |
195 '?options=' + GOOD_CRX_ID, | 230 '?options=' + GOOD_CRX_ID, |
196 }; | 231 }; |
197 | 232 |
198 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); | 233 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); |
OLD | NEW |