| 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 |
| 11 // ExtensionSettingsUIBrowserTest::InstallGoodExtension() in some of the tests. |
| 12 var GOOD_CRX_ID = 'ldnnhddmnhbkjipkidpdiheffobcpfmf'; |
| 13 |
| 10 /** | 14 /** |
| 11 * Test C++ fixture for settings WebUI testing. | 15 * Test C++ fixture for settings WebUI testing. |
| 12 * @constructor | 16 * @constructor |
| 13 * @extends {testing.Test} | 17 * @extends {testing.Test} |
| 14 */ | 18 */ |
| 15 function ExtensionSettingsUIBrowserTest() {} | 19 function ExtensionSettingsUIBrowserTest() {} |
| 16 | 20 |
| 17 /** | 21 /** |
| 18 * TestFixture for extension settings WebUI testing. | 22 * TestFixture for extension settings WebUI testing. |
| 19 * @extends {testing.Test} | 23 * @extends {testing.Test} |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 function() { | 112 function() { |
| 109 // Just navigating to the page should trigger the chrome.send(). | 113 // Just navigating to the page should trigger the chrome.send(). |
| 110 assertEquals(this.browsePreload, document.location.href); | 114 assertEquals(this.browsePreload, document.location.href); |
| 111 assertTrue($('extension-commands-overlay').classList.contains('showing')); | 115 assertTrue($('extension-commands-overlay').classList.contains('showing')); |
| 112 }); | 116 }); |
| 113 | 117 |
| 114 /** | 118 /** |
| 115 * @constructor | 119 * @constructor |
| 116 * @extends {ExtensionSettingsWebUITest} | 120 * @extends {ExtensionSettingsWebUITest} |
| 117 */ | 121 */ |
| 118 function ExtensionSettingsWebUITestWithExtensionInstalled() {} | 122 function InstalledExtensionSettingsWebUITest() {} |
| 119 | 123 |
| 120 ExtensionSettingsWebUITestWithExtensionInstalled.prototype = { | 124 InstalledExtensionSettingsWebUITest.prototype = { |
| 121 __proto__: ExtensionSettingsWebUITest.prototype, | 125 __proto__: ExtensionSettingsWebUITest.prototype, |
| 122 | 126 |
| 123 /** @override */ | 127 /** @override */ |
| 124 typedefCppFixture: 'ExtensionSettingsUIBrowserTest', | 128 typedefCppFixture: 'ExtensionSettingsUIBrowserTest', |
| 125 | 129 |
| 126 /** @override */ | 130 /** @override */ |
| 127 testGenPreamble: function() { | 131 testGenPreamble: function() { |
| 128 GEN(' InstallGoodExtension();'); | 132 GEN(' InstallGoodExtension();'); |
| 129 } | 133 }, |
| 130 }; | 134 }; |
| 131 | 135 |
| 132 /** @this {ExtensionSettingsWebUITestWithExtensionInstalled} */ | 136 /** @this {InstalledExtensionSettingsWebUITest} */ |
| 133 function runAudit() { | 137 function runAudit() { |
| 134 assertEquals(this.browsePreload, document.location.href); | 138 assertEquals(this.browsePreload, document.location.href); |
| 135 this.runAccessibilityAudit(); | 139 this.runAccessibilityAudit(); |
| 136 } | 140 } |
| 137 | 141 |
| 138 TEST_F('ExtensionSettingsWebUITestWithExtensionInstalled', | 142 TEST_F('InstalledExtensionSettingsWebUITest', 'baseAccessibilityOk', runAudit); |
| 139 'baseAccessibilityIsOk', runAudit); | |
| 140 | 143 |
| 141 /** | 144 /** |
| 142 * @constructor | 145 * @constructor |
| 143 * @extends {ExtensionSettingsWebUITestWithExtensionInstalled} | 146 * @extends {InstalledExtensionSettingsWebUITest} |
| 147 */ |
| 148 function AsyncInstalledExtensionSettingsWebUITest() {} |
| 149 |
| 150 AsyncInstalledExtensionSettingsWebUITest.prototype = { |
| 151 __proto__: InstalledExtensionSettingsWebUITest.prototype, |
| 152 |
| 153 /** @override */ |
| 154 isAsync: true, |
| 155 }; |
| 156 |
| 157 TEST_F('AsyncInstalledExtensionSettingsWebUITest', 'showOptions', function() { |
| 158 var optionsOverlay = extensions.ExtensionOptionsOverlay.getInstance(); |
| 159 optionsOverlay.setExtensionAndShowOverlay(GOOD_CRX_ID, 'GOOD!', '', testDone); |
| 160 |
| 161 // Preferred size changes don't happen in browser tests. Just fake it. |
| 162 var size = {width: 500, height: 500}; |
| 163 document.querySelector('extensionoptions').onpreferredsizechanged(size); |
| 164 }); |
| 165 |
| 166 /** |
| 167 * @constructor |
| 168 * @extends {InstalledExtensionSettingsWebUITest} |
| 144 */ | 169 */ |
| 145 function ManagedExtensionSettingsWebUITest() {} | 170 function ManagedExtensionSettingsWebUITest() {} |
| 146 | 171 |
| 147 ManagedExtensionSettingsWebUITest.prototype = { | 172 ManagedExtensionSettingsWebUITest.prototype = { |
| 148 __proto__: ExtensionSettingsWebUITestWithExtensionInstalled.prototype, | 173 __proto__: InstalledExtensionSettingsWebUITest.prototype, |
| 149 | 174 |
| 150 /** @override */ | 175 /** @override */ |
| 151 testGenPreamble: function() { | 176 testGenPreamble: function() { |
| 152 GEN(' AddManagedPolicyProvider();'); | 177 GEN(' AddManagedPolicyProvider();'); |
| 153 ExtensionSettingsWebUITestWithExtensionInstalled.prototype.testGenPreamble. | 178 InstalledExtensionSettingsWebUITest.prototype.testGenPreamble.call(this); |
| 154 call(this); | |
| 155 }, | 179 }, |
| 156 }; | 180 }; |
| 157 | 181 |
| 158 TEST_F('ManagedExtensionSettingsWebUITest', 'testAccessibility', runAudit); | 182 TEST_F('ManagedExtensionSettingsWebUITest', 'testAccessibility', runAudit); |
| 159 | 183 |
| 160 /** | 184 /** |
| 161 * @constructor | 185 * @constructor |
| 162 * @extends {ExtensionSettingsWebUITestWithExtensionInstalled} | 186 * @extends {InstalledExtensionSettingsWebUITest} |
| 163 */ | 187 */ |
| 164 function ExtensionOptionsDialogsWebUITest() {} | 188 function ExtensionOptionsDialogWebUITest() {} |
| 165 | 189 |
| 166 ExtensionOptionsDialogsWebUITest.prototype = { | 190 ExtensionOptionsDialogWebUITest.prototype = { |
| 167 __proto__: ExtensionSettingsWebUITestWithExtensionInstalled.prototype, | 191 __proto__: InstalledExtensionSettingsWebUITest.prototype, |
| 168 | 192 |
| 169 /** @override */ | 193 /** @override */ |
| 170 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + | 194 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + |
| 171 '?options=ldnnhddmnhbkjipkidpdiheffobcpfmf', | 195 '?options=' + GOOD_CRX_ID, |
| 172 }; | 196 }; |
| 173 | 197 |
| 174 TEST_F('ExtensionOptionsDialogsWebUITest', 'testAccessibility', runAudit); | 198 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); |
| OLD | NEW |