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