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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 assertEquals(this.browsePreload, document.location.href); | 49 assertEquals(this.browsePreload, document.location.href); |
| 50 | 50 |
| 51 // This dialog should be hidden at first. | 51 // This dialog should be hidden at first. |
| 52 assertFalse($('pack-extension-overlay').classList.contains('showing')); | 52 assertFalse($('pack-extension-overlay').classList.contains('showing')); |
| 53 | 53 |
| 54 // Show the dialog, which triggers a chrome.send() for metrics purposes. | 54 // Show the dialog, which triggers a chrome.send() for metrics purposes. |
| 55 cr.dispatchSimpleEvent($('pack-extension'), 'click'); | 55 cr.dispatchSimpleEvent($('pack-extension'), 'click'); |
| 56 assertTrue($('pack-extension-overlay').classList.contains('showing')); | 56 assertTrue($('pack-extension-overlay').classList.contains('showing')); |
| 57 }); | 57 }); |
| 58 | 58 |
| 59 function BasicExtensionSettingsWebUITest() {} | |
| 60 | |
| 61 BasicExtensionSettingsWebUITest.prototype = { | |
| 62 __proto__: ExtensionSettingsWebUITest.prototype, | |
| 63 | |
| 64 /** @override */ | |
| 65 isAsync: true, | |
| 66 | |
| 67 /** @override */ | |
| 68 testGenPreamble: function() { | |
| 69 // Install different types of extensions to try and exercise as many code | |
| 70 // paths as possible. | |
|
Dan Beam
2015/04/01 23:12:04
this generally sounds like a recipe for flakiness.
Devlin
2015/04/02 00:01:39
Fair enough. I try to avoid it when possible, bec
| |
| 71 // TODO(devlin): There are more types to add here. | |
| 72 GEN(' InstallGoodExtension();'); | |
| 73 GEN(' InstallErrorsExtension();'); | |
| 74 GEN(' InstallSharedModule();'); | |
| 75 | |
| 76 GEN(' SetAutoConfirmUninstall();'); | |
| 77 }, | |
| 78 | |
|
Dan Beam
2015/04/01 23:12:04
/** @protected {Array<!Function>} */
Devlin
2015/04/02 00:01:38
Done.
| |
| 79 steps: [], | |
| 80 | |
|
Dan Beam
2015/04/01 23:12:04
all these should be @protected
Devlin
2015/04/02 00:01:39
Done.
| |
| 81 nextStep: function() { | |
| 82 assertTrue(this.steps.length > 0); | |
| 83 this.steps.shift().bind(this)(); | |
| 84 }, | |
| 85 | |
| 86 waitForPageLoad: function() { | |
| 87 extensionList = $('extension-settings-list'); | |
| 88 extensionList.extensionsUpdated.then(this.nextStep.bind(this)); | |
| 89 }, | |
| 90 | |
| 91 verifyDisabledWorks: function() { | |
| 92 chrome.management.setEnabled(GOOD_CRX_ID, false, function() { | |
| 93 var node = $(GOOD_CRX_ID); | |
| 94 assertTrue(node != null); | |
| 95 assertTrue(node.classList.contains('inactive-extension')); | |
| 96 this.nextStep(); | |
| 97 }.bind(this)); | |
| 98 }, | |
| 99 | |
| 100 verifyEnabledWorks: function() { | |
| 101 chrome.management.setEnabled(GOOD_CRX_ID, true, function() { | |
| 102 var node = $(GOOD_CRX_ID); | |
| 103 assertTrue(node != null); | |
| 104 assertFalse(node.classList.contains('inactive-extension')); | |
| 105 this.nextStep(); | |
| 106 }.bind(this)); | |
| 107 }, | |
| 108 | |
| 109 verifyUninstallWorks: function() { | |
| 110 var next = this.nextStep.bind(this); | |
| 111 chrome.test.runWithUserGesture(function() { | |
| 112 chrome.management.uninstall(GOOD_CRX_ID, function() { | |
| 113 assertTrue($(GOOD_CRX_ID) == null); | |
| 114 next(); | |
| 115 }); | |
| 116 }); | |
| 117 }, | |
| 118 }; | |
| 119 | |
| 120 TEST_F('BasicExtensionSettingsWebUITest', 'testBasic', function() { | |
| 121 this.steps = [this.waitForPageLoad, | |
| 122 this.verifyDisabledWorks, | |
| 123 this.verifyEnabledWorks, | |
| 124 this.verifyUninstallWorks, | |
| 125 testDone]; | |
| 126 this.nextStep(); | |
| 127 }); | |
| 128 | |
| 59 function AsyncExtensionSettingsWebUITest() {} | 129 function AsyncExtensionSettingsWebUITest() {} |
| 60 | 130 |
| 61 AsyncExtensionSettingsWebUITest.prototype = { | 131 AsyncExtensionSettingsWebUITest.prototype = { |
| 62 __proto__: ExtensionSettingsWebUITest.prototype, | 132 __proto__: ExtensionSettingsWebUITest.prototype, |
| 63 | 133 |
| 64 /** @override */ | 134 /** @override */ |
| 65 isAsync: true, | 135 isAsync: true, |
| 66 | 136 |
| 67 /** @override */ | 137 /** @override */ |
| 68 testGenPreamble: function() { | 138 testGenPreamble: function() { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 | 296 |
| 227 ExtensionOptionsDialogWebUITest.prototype = { | 297 ExtensionOptionsDialogWebUITest.prototype = { |
| 228 __proto__: InstalledExtensionSettingsWebUITest.prototype, | 298 __proto__: InstalledExtensionSettingsWebUITest.prototype, |
| 229 | 299 |
| 230 /** @override */ | 300 /** @override */ |
| 231 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + | 301 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + |
| 232 '?options=' + GOOD_CRX_ID, | 302 '?options=' + GOOD_CRX_ID, |
| 233 }; | 303 }; |
| 234 | 304 |
| 235 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); | 305 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); |
| OLD | NEW |