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