Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 * TestFixture for extension settings WebUI testing. | 22 * TestFixture for extension settings WebUI testing. |
| 23 * @extends {testing.Test} | 23 * @extends {testing.Test} |
| 24 * @constructor | 24 * @constructor |
| 25 */ | 25 */ |
| 26 function ExtensionSettingsWebUITest() {} | 26 function ExtensionSettingsWebUITest() {} |
| 27 | 27 |
| 28 ExtensionSettingsWebUITest.prototype = { | 28 ExtensionSettingsWebUITest.prototype = { |
| 29 __proto__: testing.Test.prototype, | 29 __proto__: testing.Test.prototype, |
| 30 | 30 |
| 31 /** @override */ | 31 /** @override */ |
| 32 isAsync: true, | |
| 33 | |
| 34 /** @override */ | |
| 32 runAccessibilityChecks: true, | 35 runAccessibilityChecks: true, |
| 33 | 36 |
| 34 /** @override */ | 37 /** @override */ |
| 35 accessibilityIssuesAreErrors: true, | 38 accessibilityIssuesAreErrors: true, |
| 36 | 39 |
| 37 /** | 40 /** |
| 38 * A URL to load before starting each test. | 41 * A URL to load before starting each test. |
| 39 * @type {string} | 42 * @type {string} |
| 40 * @const | 43 * @const |
| 41 */ | 44 */ |
| 42 browsePreload: 'chrome://extensions-frame/', | 45 browsePreload: 'chrome://extensions-frame/', |
| 43 | 46 |
| 44 /** @override */ | 47 /** @override */ |
| 45 typedefCppFixture: 'ExtensionSettingsUIBrowserTest', | 48 typedefCppFixture: 'ExtensionSettingsUIBrowserTest', |
| 49 | |
| 50 /** @override */ | |
| 51 setUp: function() { | |
| 52 // Make all transitions take 0ms for testing purposes. | |
| 53 var noTransitionStyle = document.createElement('style'); | |
| 54 noTransitionStyle.textContent = | |
| 55 '* {' + | |
| 56 ' -webkit-transition-duration: 0ms !important;' + | |
| 57 ' -webkit-transition-delay: 0ms !important;' + | |
| 58 '}'; | |
| 59 document.querySelector('head').appendChild(noTransitionStyle); | |
| 60 }, | |
| 61 | |
| 62 /** | |
| 63 * Holds an array of steps that should happen in order during a test. | |
| 64 * The last step should be |testDone|. | |
| 65 * @protected {Array<!Function>} | |
| 66 * */ | |
| 67 steps: [], | |
| 68 | |
| 69 /** | |
| 70 * Advances to the next step in the test. Every step should call this. | |
| 71 * @protected | |
| 72 * */ | |
| 73 nextStep: function() { | |
| 74 assertTrue(this.steps.length > 0); | |
| 75 this.steps.shift().call(this); | |
| 76 }, | |
| 77 | |
| 78 /** | |
| 79 * Will wait for the page to load before calling the next step. This should be | |
| 80 * the first step in every test. | |
| 81 * @protected | |
| 82 * */ | |
| 83 waitForPageLoad: function() { | |
| 84 assertEquals(this.browsePreload, document.location.href); | |
| 85 var extensionList = getRequiredElement('extension-settings-list'); | |
| 86 extensionList.loadFinished.then(this.nextStep.bind(this)); | |
| 87 }, | |
| 88 | |
| 89 /** @protected */ | |
| 90 verifyDeveloperModeWorks: function() { | |
| 91 var extensionSettings = getRequiredElement('extension-settings'); | |
| 92 assertFalse(extensionSettings.classList.contains('dev-mode')); | |
| 93 $('toggle-dev-on').click(); | |
| 94 assertTrue(extensionSettings.classList.contains('dev-mode')); | |
| 95 chrome.developerPrivate.getProfileConfiguration(function(profileInfo) { | |
| 96 assertTrue(profileInfo.inDeveloperMode); | |
| 97 | |
| 98 // A 0ms timeout is necessary so that all the transitions can finish. | |
| 99 window.setTimeout(this.nextStep.bind(this), 0); | |
| 100 }.bind(this)); | |
| 101 }, | |
| 102 | |
| 103 /** @protected */ | |
| 104 testDeveloperMode: function() { | |
| 105 var next = this.nextStep.bind(this); | |
| 106 var checkDevModeIsOff = function() { | |
| 107 chrome.developerPrivate.getProfileConfiguration(function(profileInfo) { | |
| 108 assertFalse(profileInfo.inDeveloperMode); | |
| 109 next(); | |
| 110 }); | |
| 111 }; | |
| 112 this.steps = [this.waitForPageLoad, | |
| 113 checkDevModeIsOff, | |
| 114 this.verifyDeveloperModeWorks, | |
| 115 testDone]; | |
| 116 this.nextStep(); | |
| 117 } | |
| 46 }; | 118 }; |
| 47 | 119 |
| 120 // Verify that developer mode doesn't change behavior when the number of | |
| 121 // extensions changes. | |
| 122 TEST_F('ExtensionSettingsWebUITest', 'testDeveloperModeNoExtensions', | |
| 123 function() { | |
| 124 this.testDeveloperMode(); | |
| 125 }); | |
| 126 | |
| 127 TEST_F('ExtensionSettingsWebUITest', 'testEmptyExtensionList', function() { | |
| 128 var verifyListIsHiddenAndEmpty = function() { | |
| 129 assertTrue($('extension-list-wrapper').hidden); | |
| 130 assertFalse($('no-extensions').hidden); | |
| 131 assertEquals(0, $('extension-settings-list').childNodes.length); | |
| 132 this.nextStep(); | |
| 133 }; | |
| 134 | |
| 135 this.steps = [this.waitForPageLoad, verifyListIsHiddenAndEmpty, testDone]; | |
| 136 this.nextStep(); | |
| 137 }); | |
| 138 | |
| 48 TEST_F('ExtensionSettingsWebUITest', 'testChromeSendHandled', function() { | 139 TEST_F('ExtensionSettingsWebUITest', 'testChromeSendHandled', function() { |
| 49 assertEquals(this.browsePreload, document.location.href); | 140 var testPackExtenion = function() { |
| 141 // This dialog should be hidden at first. | |
| 142 assertFalse($('pack-extension-overlay').classList.contains('showing')); | |
| 50 | 143 |
| 51 // This dialog should be hidden at first. | 144 // Show the dialog, which triggers a chrome.send() for metrics purposes. |
| 52 assertFalse($('pack-extension-overlay').classList.contains('showing')); | 145 cr.dispatchSimpleEvent($('pack-extension'), 'click'); |
| 146 assertTrue($('pack-extension-overlay').classList.contains('showing')); | |
| 147 this.nextStep(); | |
| 148 }; | |
| 53 | 149 |
| 54 // Show the dialog, which triggers a chrome.send() for metrics purposes. | 150 this.steps = [this.waitForPageLoad, testPackExtenion, testDone]; |
| 55 cr.dispatchSimpleEvent($('pack-extension'), 'click'); | 151 this.nextStep(); |
| 56 assertTrue($('pack-extension-overlay').classList.contains('showing')); | |
| 57 }); | 152 }); |
| 58 | 153 |
| 59 function BasicExtensionSettingsWebUITest() {} | 154 function BasicExtensionSettingsWebUITest() {} |
| 60 | 155 |
| 61 BasicExtensionSettingsWebUITest.prototype = { | 156 BasicExtensionSettingsWebUITest.prototype = { |
| 62 __proto__: ExtensionSettingsWebUITest.prototype, | 157 __proto__: ExtensionSettingsWebUITest.prototype, |
| 63 | 158 |
| 64 /** @override */ | 159 /** @override */ |
| 65 isAsync: true, | |
| 66 | |
| 67 /** @override */ | |
| 68 testGenPreamble: function() { | 160 testGenPreamble: function() { |
| 69 // Install multiple types of extensions to ensure we handle each type. | 161 // Install multiple types of extensions to ensure we handle each type. |
| 70 // TODO(devlin): There are more types to add here. | 162 // TODO(devlin): There are more types to add here. |
| 71 GEN(' InstallGoodExtension();'); | 163 GEN(' InstallGoodExtension();'); |
| 72 GEN(' InstallErrorsExtension();'); | 164 GEN(' InstallErrorsExtension();'); |
| 73 GEN(' InstallSharedModule();'); | 165 GEN(' InstallSharedModule();'); |
| 74 GEN(' InstallPackagedApp();'); | 166 GEN(' InstallPackagedApp();'); |
| 75 | 167 |
| 76 GEN(' SetAutoConfirmUninstall();'); | 168 GEN(' SetAutoConfirmUninstall();'); |
| 77 }, | 169 }, |
| 78 | 170 |
| 79 /** @protected {Array<!Function>} */ | |
| 80 steps: [], | |
| 81 | |
| 82 /** @protected */ | |
| 83 nextStep: function() { | |
| 84 assertTrue(this.steps.length > 0); | |
| 85 this.steps.shift().call(this); | |
| 86 }, | |
| 87 | |
| 88 /** @protected */ | |
| 89 waitForPageLoad: function() { | |
| 90 var extensionList = getRequiredElement('extension-settings-list'); | |
| 91 extensionList.extensionsUpdated_.then(this.nextStep.bind(this)); | |
| 92 }, | |
| 93 | |
| 94 /** @protected */ | 171 /** @protected */ |
| 95 verifyDisabledWorks: function() { | 172 verifyDisabledWorks: function() { |
| 96 chrome.management.setEnabled(GOOD_CRX_ID, false, function() { | 173 chrome.management.setEnabled(GOOD_CRX_ID, false, function() { |
| 97 var node = getRequiredElement(GOOD_CRX_ID); | 174 var node = getRequiredElement(GOOD_CRX_ID); |
| 98 assertTrue(node.classList.contains('inactive-extension')); | 175 assertTrue(node.classList.contains('inactive-extension')); |
| 99 this.nextStep(); | 176 this.nextStep(); |
| 100 }.bind(this)); | 177 }.bind(this)); |
| 101 }, | 178 }, |
| 102 | 179 |
| 103 /** @protected */ | 180 /** @protected */ |
| 104 verifyEnabledWorks: function() { | 181 verifyEnabledWorks: function() { |
| 105 chrome.management.setEnabled(GOOD_CRX_ID, true, function() { | 182 chrome.management.setEnabled(GOOD_CRX_ID, true, function() { |
| 106 var node = getRequiredElement(GOOD_CRX_ID); | 183 var node = getRequiredElement(GOOD_CRX_ID); |
| 107 assertFalse(node.classList.contains('inactive-extension')); | 184 assertFalse(node.classList.contains('inactive-extension')); |
| 108 this.nextStep(); | 185 this.nextStep(); |
| 109 }.bind(this)); | 186 }.bind(this)); |
| 110 }, | 187 }, |
| 111 | 188 |
| 112 /** @protected */ | 189 /** @protected */ |
| 113 verifyUninstallWorks: function() { | 190 verifyUninstallWorks: function() { |
| 114 var next = this.nextStep.bind(this); | 191 var next = this.nextStep.bind(this); |
| 115 chrome.test.runWithUserGesture(function() { | 192 chrome.test.runWithUserGesture(function() { |
| 116 chrome.management.uninstall(GOOD_CRX_ID, function() { | 193 chrome.management.uninstall(GOOD_CRX_ID, function() { |
| 117 assertEquals(null, $(GOOD_CRX_ID)); | 194 assertEquals(null, $(GOOD_CRX_ID)); |
| 118 next(); | 195 next(); |
| 119 }); | 196 }); |
| 120 }); | 197 }); |
| 121 }, | 198 }, |
| 122 | |
| 123 /** @protected */ | |
| 124 verifyDeveloperModeWorks: function() { | |
| 125 var extensionSettings = getRequiredElement('extension-settings'); | |
| 126 assertFalse(extensionSettings.classList.contains('dev-mode')); | |
| 127 $('toggle-dev-on').click(); | |
| 128 assertTrue(extensionSettings.classList.contains('dev-mode')); | |
| 129 chrome.developerPrivate.getProfileConfiguration(function(profileInfo) { | |
| 130 assertTrue(profileInfo.inDeveloperMode); | |
| 131 this.nextStep(); | |
| 132 }.bind(this)); | |
| 133 }, | |
| 134 }; | 199 }; |
| 135 | 200 |
| 201 // Verify that developer mode doesn't change behavior when the number of | |
| 202 // extensions changes. | |
| 203 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperModeManyExtensions', | |
|
Nico
2015/04/24 23:04:55
This is failing on http://build.chromium.org/p/chr
| |
| 204 function() { | |
| 205 this.testDeveloperMode(); | |
| 206 }); | |
| 207 | |
| 208 | |
| 136 TEST_F('BasicExtensionSettingsWebUITest', 'testDisable', function() { | 209 TEST_F('BasicExtensionSettingsWebUITest', 'testDisable', function() { |
| 137 this.steps = [this.waitForPageLoad, | 210 this.steps = [this.waitForPageLoad, this.verifyDisabledWorks, testDone]; |
| 138 this.verifyDisabledWorks, | |
| 139 testDone]; | |
| 140 this.nextStep(); | 211 this.nextStep(); |
| 141 }); | 212 }); |
| 142 | 213 |
| 143 TEST_F('BasicExtensionSettingsWebUITest', 'testEnable', function() { | 214 TEST_F('BasicExtensionSettingsWebUITest', 'testEnable', function() { |
| 144 this.steps = [this.waitForPageLoad, | 215 this.steps = [this.waitForPageLoad, |
| 145 this.verifyDisabledWorks, | 216 this.verifyDisabledWorks, |
| 146 this.verifyEnabledWorks, | 217 this.verifyEnabledWorks, |
| 147 testDone]; | 218 testDone]; |
| 148 this.nextStep(); | 219 this.nextStep(); |
| 149 }); | 220 }); |
| 150 | 221 |
| 151 TEST_F('BasicExtensionSettingsWebUITest', 'testUninstall', function() { | 222 TEST_F('BasicExtensionSettingsWebUITest', 'testUninstall', function() { |
| 152 this.steps = [this.waitForPageLoad, | 223 this.steps = [this.waitForPageLoad, this.verifyUninstallWorks, testDone]; |
| 153 this.verifyUninstallWorks, | |
| 154 testDone]; | |
| 155 this.nextStep(); | 224 this.nextStep(); |
| 156 }); | 225 }); |
| 157 | 226 |
| 158 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperMode', function() { | 227 TEST_F('BasicExtensionSettingsWebUITest', 'testNonEmptyExtensionList', |
| 159 var next = this.nextStep.bind(this); | 228 function() { |
| 160 var checkDevModeIsOff = function() { | 229 var verifyListIsNotHiddenAndEmpty = function() { |
| 161 chrome.developerPrivate.getProfileConfiguration(function(profileInfo) { | 230 assertFalse($('extension-list-wrapper').hidden); |
| 162 assertFalse(profileInfo.inDeveloperMode); | 231 assertTrue($('no-extensions').hidden); |
| 163 next(); | 232 assertGT($('extension-settings-list').childNodes.length, 0); |
| 164 }); | 233 |
| 234 this.nextStep(); | |
| 165 }; | 235 }; |
| 166 this.steps = [checkDevModeIsOff, | 236 |
| 167 this.waitForPageLoad, | 237 this.steps = [this.waitForPageLoad, verifyListIsNotHiddenAndEmpty, testDone]; |
| 168 this.verifyDeveloperModeWorks, | |
| 169 testDone]; | |
| 170 this.nextStep(); | 238 this.nextStep(); |
| 171 }); | 239 }); |
| 172 | 240 |
| 173 function AsyncExtensionSettingsWebUITest() {} | 241 function AsyncExtensionSettingsWebUITest() {} |
| 174 | 242 |
| 175 AsyncExtensionSettingsWebUITest.prototype = { | 243 AsyncExtensionSettingsWebUITest.prototype = { |
| 176 __proto__: ExtensionSettingsWebUITest.prototype, | 244 __proto__: ExtensionSettingsWebUITest.prototype, |
| 177 | 245 |
| 178 /** @override */ | 246 /** @override */ |
| 179 isAsync: true, | |
| 180 | |
| 181 /** @override */ | |
| 182 testGenPreamble: function() { | 247 testGenPreamble: function() { |
| 183 GEN(' InstallGoodExtension();'); | 248 GEN(' InstallGoodExtension();'); |
| 184 GEN(' InstallErrorsExtension();'); | 249 GEN(' InstallErrorsExtension();'); |
| 185 }, | 250 }, |
| 186 | |
| 187 enableDeveloperMode: function(callback) { | |
| 188 var devControls = $('dev-controls'); | |
| 189 | |
| 190 // Make sure developer controls are hidden before checkbox is clicked. | |
| 191 assertEquals(0, devControls.offsetHeight); | |
| 192 $('toggle-dev-on').click(); | |
| 193 | |
| 194 document.addEventListener('webkitTransitionEnd', function f(e) { | |
| 195 if (e.target == devControls) { | |
| 196 // Make sure developer controls are not hidden after checkbox is | |
| 197 // clicked. | |
| 198 assertGT(devControls.offsetHeight, 0); | |
| 199 | |
| 200 document.removeEventListener(f, 'webkitTransitionEnd'); | |
| 201 callback(); | |
| 202 } | |
| 203 }); | |
| 204 ensureTransitionEndEvent(devControls, 4000); | |
| 205 }, | |
| 206 }; | 251 }; |
| 207 | 252 |
| 208 TEST_F('AsyncExtensionSettingsWebUITest', 'testDeveloperModeA11y', function() { | |
| 209 this.enableDeveloperMode(testDone); | |
| 210 }); | |
| 211 | |
| 212 // Often times out on all platforms: http://crbug.com/467528 | 253 // Often times out on all platforms: http://crbug.com/467528 |
| 213 TEST_F('AsyncExtensionSettingsWebUITest', | 254 TEST_F('AsyncExtensionSettingsWebUITest', |
| 214 'DISABLED_testErrorListButtonVisibility', | 255 'DISABLED_testErrorListButtonVisibility', |
| 215 function() { | 256 function() { |
| 216 this.enableDeveloperMode(function() { | 257 var testButtonVisibility = function() { |
| 217 // 2 extensions are loaded: | 258 // 2 extensions are loaded: |
| 218 // The 'good' extension will have 0 errors wich means no error list | 259 // The 'good' extension will have 0 errors wich means no error list |
| 219 // buttons. | 260 // buttons. |
| 220 // The 'bad' extension will have >3 manifest errors and <3 runtime errors. | 261 // The 'bad' extension will have >3 manifest errors and <3 runtime errors. |
| 221 // This means 2 buttons: 1 visible and 1 hidden. | 262 // This means 2 buttons: 1 visible and 1 hidden. |
| 222 var visibleButtons = document.querySelectorAll( | 263 var visibleButtons = document.querySelectorAll( |
| 223 '.extension-error-list-show-more > a:not([hidden])'); | 264 '.extension-error-list-show-more > a:not([hidden])'); |
| 224 assertEquals(1, visibleButtons.length); | 265 assertEquals(1, visibleButtons.length); |
| 225 // Visible buttons must be part of the focusRow. | 266 // Visible buttons must be part of the focusRow. |
| 226 assertTrue(visibleButtons[0].hasAttribute('column-type')); | 267 assertTrue(visibleButtons[0].hasAttribute('column-type')); |
| 227 | 268 |
| 228 var hiddenButtons = document.querySelectorAll( | 269 var hiddenButtons = document.querySelectorAll( |
| 229 '.extension-error-list-show-more > a[hidden]'); | 270 '.extension-error-list-show-more > a[hidden]'); |
| 230 assertEquals(1, hiddenButtons.length); | 271 assertEquals(1, hiddenButtons.length); |
| 231 // Hidden buttons must NOT be part of the focusRow. | 272 // Hidden buttons must NOT be part of the focusRow. |
| 232 assertFalse(hiddenButtons[0].hasAttribute('column-type')); | 273 assertFalse(hiddenButtons[0].hasAttribute('column-type')); |
| 233 | 274 |
| 234 testDone(); | 275 this.nextStep(); |
| 235 }); | 276 }; |
| 277 | |
| 278 this.steps = [this.waitForPageLoad, | |
| 279 this.verifyDeveloperModeWorks, | |
| 280 testButtonVisibility, | |
| 281 testDone]; | |
| 282 this.nextStep(); | |
| 236 }); | 283 }); |
| 237 | 284 |
| 238 /** | 285 /** |
| 239 * TestFixture for extension settings WebUI testing (commands config edition). | 286 * TestFixture for extension settings WebUI testing (commands config edition). |
| 240 * @extends {testing.Test} | 287 * @extends {testing.Test} |
| 241 * @constructor | 288 * @constructor |
| 242 */ | 289 */ |
| 243 function ExtensionSettingsCommandsConfigWebUITest() {} | 290 function SettingsCommandsExtensionSettingsWebUITest() {} |
| 244 | 291 |
| 245 ExtensionSettingsCommandsConfigWebUITest.prototype = { | 292 SettingsCommandsExtensionSettingsWebUITest.prototype = { |
| 246 __proto__: testing.Test.prototype, | 293 __proto__: ExtensionSettingsWebUITest.prototype, |
| 247 | |
| 248 /** @override */ | |
| 249 runAccessibilityChecks: true, | |
| 250 | |
| 251 /** @override */ | |
| 252 accessibilityIssuesAreErrors: true, | |
| 253 | 294 |
| 254 /** | 295 /** |
| 255 * A URL to load before starting each test. | 296 * A URL to load before starting each test. |
| 256 * @type {string} | 297 * @type {string} |
| 257 * @const | 298 * @const |
| 258 */ | 299 */ |
| 259 browsePreload: 'chrome://extensions-frame/configureCommands', | 300 browsePreload: 'chrome://extensions-frame/configureCommands', |
| 260 }; | 301 }; |
| 261 | 302 |
| 262 TEST_F('ExtensionSettingsCommandsConfigWebUITest', 'testChromeSendHandler', | 303 TEST_F('SettingsCommandsExtensionSettingsWebUITest', 'testChromeSendHandler', |
| 263 function() { | 304 function() { |
| 264 // Just navigating to the page should trigger the chrome.send(). | 305 // Just navigating to the page should trigger the chrome.send(). |
| 265 assertEquals(this.browsePreload, document.location.href); | 306 var assertOverlayVisible = function() { |
| 266 assertTrue($('extension-commands-overlay').classList.contains('showing')); | 307 assertTrue($('extension-commands-overlay').classList.contains('showing')); |
| 308 this.nextStep(); | |
| 309 }; | |
| 310 | |
| 311 this.steps = [this.waitForPageLoad, assertOverlayVisible, testDone]; | |
| 312 this.nextStep(); | |
| 267 }); | 313 }); |
| 268 | 314 |
| 269 /** | 315 /** |
| 270 * @constructor | 316 * @constructor |
| 271 * @extends {ExtensionSettingsWebUITest} | 317 * @extends {ExtensionSettingsWebUITest} |
| 272 */ | 318 */ |
| 273 function InstalledExtensionSettingsWebUITest() {} | 319 function InstallGoodExtensionSettingsWebUITest() {} |
| 274 | 320 |
| 275 InstalledExtensionSettingsWebUITest.prototype = { | 321 InstallGoodExtensionSettingsWebUITest.prototype = { |
| 276 __proto__: ExtensionSettingsWebUITest.prototype, | 322 __proto__: ExtensionSettingsWebUITest.prototype, |
| 277 | 323 |
| 278 /** @override */ | 324 /** @override */ |
| 279 typedefCppFixture: 'ExtensionSettingsUIBrowserTest', | |
| 280 | |
| 281 /** @override */ | |
| 282 testGenPreamble: function() { | 325 testGenPreamble: function() { |
| 283 GEN(' InstallGoodExtension();'); | 326 GEN(' InstallGoodExtension();'); |
| 284 }, | 327 }, |
| 328 | |
| 329 emptyTestForAccessibility() { | |
| 330 this.steps = [this.waitForPageLoad, testDone]; | |
| 331 this.nextStep(); | |
| 332 }, | |
| 285 }; | 333 }; |
| 286 | 334 |
| 287 /** @this {InstalledExtensionSettingsWebUITest} */ | 335 TEST_F('InstallGoodExtensionSettingsWebUITest', 'testAccessibility', |
| 288 function runAudit() { | 336 function() { |
| 289 assertEquals(this.browsePreload, document.location.href); | 337 this.emptyTestForAccessibility(); |
| 290 this.runAccessibilityAudit(); | 338 }); |
| 291 } | |
| 292 | 339 |
| 293 TEST_F('InstalledExtensionSettingsWebUITest', 'baseAccessibilityOk', runAudit); | 340 TEST_F('InstallGoodExtensionSettingsWebUITest', 'showOptions', function() { |
| 341 var showExtensionOptions = function() { | |
| 342 var optionsOverlay = extensions.ExtensionOptionsOverlay.getInstance(); | |
| 343 optionsOverlay.setExtensionAndShowOverlay(GOOD_CRX_ID, 'GOOD!', '', | |
| 344 this.nextStep.bind(this)); | |
| 294 | 345 |
| 295 /** | 346 // Preferred size changes don't happen in browser tests. Just fake it. |
| 296 * @constructor | 347 document.querySelector('extensionoptions').onpreferredsizechanged( |
| 297 * @extends {InstalledExtensionSettingsWebUITest} | 348 {width: 500, height: 500}); |
| 298 */ | 349 }; |
| 299 function AsyncInstalledExtensionSettingsWebUITest() {} | |
| 300 | 350 |
| 301 AsyncInstalledExtensionSettingsWebUITest.prototype = { | 351 this.steps = [this.waitForPageLoad, showExtensionOptions, testDone]; |
| 302 __proto__: InstalledExtensionSettingsWebUITest.prototype, | 352 this.nextStep(); |
| 303 | |
| 304 /** @override */ | |
| 305 isAsync: true, | |
| 306 }; | |
| 307 | |
| 308 TEST_F('AsyncInstalledExtensionSettingsWebUITest', 'showOptions', function() { | |
| 309 var optionsOverlay = extensions.ExtensionOptionsOverlay.getInstance(); | |
| 310 optionsOverlay.setExtensionAndShowOverlay(GOOD_CRX_ID, 'GOOD!', '', testDone); | |
| 311 | |
| 312 // Preferred size changes don't happen in browser tests. Just fake it. | |
| 313 var size = {width: 500, height: 500}; | |
| 314 document.querySelector('extensionoptions').onpreferredsizechanged(size); | |
| 315 }); | 353 }); |
| 316 | 354 |
| 317 /** | 355 /** |
| 318 * @constructor | 356 * @constructor |
| 319 * @extends {InstalledExtensionSettingsWebUITest} | 357 * @extends {InstallGoodExtensionSettingsWebUITest} |
| 320 */ | 358 */ |
| 321 function ManagedExtensionSettingsWebUITest() {} | 359 function ManagedExtensionSettingsWebUITest() {} |
| 322 | 360 |
| 323 ManagedExtensionSettingsWebUITest.prototype = { | 361 ManagedExtensionSettingsWebUITest.prototype = { |
| 324 __proto__: InstalledExtensionSettingsWebUITest.prototype, | 362 __proto__: InstallGoodExtensionSettingsWebUITest.prototype, |
| 325 | 363 |
| 326 /** @override */ | 364 /** @override */ |
| 327 testGenPreamble: function() { | 365 testGenPreamble: function() { |
| 328 GEN(' AddManagedPolicyProvider();'); | 366 GEN(' AddManagedPolicyProvider();'); |
| 329 InstalledExtensionSettingsWebUITest.prototype.testGenPreamble.call(this); | 367 InstallGoodExtensionSettingsWebUITest.prototype.testGenPreamble.call(this); |
| 330 }, | 368 }, |
| 331 }; | 369 }; |
| 332 | 370 |
| 333 TEST_F('ManagedExtensionSettingsWebUITest', 'testAccessibility', runAudit); | 371 TEST_F('ManagedExtensionSettingsWebUITest', 'testAccessibility', function() { |
| 372 this.emptyTestForAccessibility(); | |
| 373 }); | |
| 334 | 374 |
| 335 /** | 375 /** |
| 336 * @constructor | 376 * @constructor |
| 337 * @extends {InstalledExtensionSettingsWebUITest} | 377 * @extends {InstallGoodExtensionSettingsWebUITest} |
| 338 */ | 378 */ |
| 339 function ExtensionOptionsDialogWebUITest() {} | 379 function OptionsDialogExtensionSettingsWebUITest() {} |
| 340 | 380 |
| 341 ExtensionOptionsDialogWebUITest.prototype = { | 381 OptionsDialogExtensionSettingsWebUITest.prototype = { |
| 342 __proto__: InstalledExtensionSettingsWebUITest.prototype, | 382 __proto__: InstallGoodExtensionSettingsWebUITest.prototype, |
| 343 | 383 |
| 344 /** @override */ | 384 /** @override */ |
| 345 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + | 385 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + |
| 346 '?options=' + GOOD_CRX_ID, | 386 '?options=' + GOOD_CRX_ID, |
| 347 }; | 387 }; |
| 348 | 388 |
| 349 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); | 389 TEST_F('OptionsDialogExtensionSettingsWebUITest', 'testAccessibility', |
| 390 function() { | |
| 391 this.emptyTestForAccessibility(); | |
| 392 }); | |
| OLD | NEW |