| Index: chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
|
| diff --git a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
|
| index 9f1b86756ae5586369cfbfdc861291ad541839e9..0608ba481c8be33af50ecc0fd449c1abfe801fae 100644
|
| --- a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
|
| +++ b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
|
| @@ -56,6 +56,108 @@ TEST_F('ExtensionSettingsWebUITest', 'testChromeSendHandled', function() {
|
| assertTrue($('pack-extension-overlay').classList.contains('showing'));
|
| });
|
|
|
| +function BasicExtensionSettingsWebUITest() {}
|
| +
|
| +BasicExtensionSettingsWebUITest.prototype = {
|
| + __proto__: ExtensionSettingsWebUITest.prototype,
|
| +
|
| + /** @override */
|
| + isAsync: true,
|
| +
|
| + /** @override */
|
| + testGenPreamble: function() {
|
| + // Install multiple types of extensions to ensure we handle each type.
|
| + // TODO(devlin): There are more types to add here.
|
| + GEN(' InstallGoodExtension();');
|
| + GEN(' InstallErrorsExtension();');
|
| + GEN(' InstallSharedModule();');
|
| + GEN(' InstallPackagedApp();');
|
| +
|
| + GEN(' SetAutoConfirmUninstall();');
|
| + },
|
| +
|
| + /** @protected {Array<!Function>} */
|
| + steps: [],
|
| +
|
| + /** @protected */
|
| + nextStep: function() {
|
| + assertTrue(this.steps.length > 0);
|
| + this.steps.shift().call(this);
|
| + },
|
| +
|
| + /** @protected */
|
| + waitForPageLoad: function() {
|
| + var extensionList = getRequiredElement('extension-settings-list');
|
| + extensionList.extensionsUpdated_.then(this.nextStep.bind(this));
|
| + },
|
| +
|
| + /**
|
| + * A silly hack because we re-fetch extension data after every event, which is
|
| + * asynchronous. This will be unneeded once we transition to observing events
|
| + * on the developerPrivate API.
|
| + * @param {Function} after The function to run after the pending requests.
|
| + * @protected
|
| + */
|
| + runPendingRequests: function(after) {
|
| + window.setTimeout(function() {
|
| + chrome.developerPrivate.getExtensionsInfo(after);
|
| + }, 0);
|
| + },
|
| +
|
| + /** @protected */
|
| + verifyDisabledWorks: function() {
|
| + chrome.management.setEnabled(GOOD_CRX_ID, false,
|
| + this.runPendingRequests.bind(this, function() {
|
| + var node = getRequiredElement(GOOD_CRX_ID);
|
| + assertTrue(node.classList.contains('inactive-extension'));
|
| + this.nextStep();
|
| + }.bind(this)));
|
| + },
|
| +
|
| + /** @protected */
|
| + verifyEnabledWorks: function() {
|
| + chrome.management.setEnabled(GOOD_CRX_ID, true,
|
| + this.runPendingRequests.bind(this, function() {
|
| + var node = getRequiredElement(GOOD_CRX_ID);
|
| + assertFalse(node.classList.contains('inactive-extension'));
|
| + this.nextStep();
|
| + }.bind(this)));
|
| + },
|
| +
|
| + /** @protected */
|
| + verifyUninstallWorks: function() {
|
| + chrome.test.runWithUserGesture(function() {
|
| + chrome.management.uninstall(GOOD_CRX_ID,
|
| + this.runPendingRequests.bind(this, function() {
|
| + assertEquals(null, $(GOOD_CRX_ID));
|
| + this.nextStep();
|
| + }.bind(this)));
|
| + }.bind(this));
|
| + },
|
| +};
|
| +
|
| +TEST_F('BasicExtensionSettingsWebUITest', 'testDisable', function() {
|
| + this.steps = [this.waitForPageLoad,
|
| + this.verifyDisabledWorks,
|
| + testDone];
|
| + this.nextStep();
|
| +});
|
| +
|
| +TEST_F('BasicExtensionSettingsWebUITest', 'testEnable', function() {
|
| + this.steps = [this.waitForPageLoad,
|
| + this.verifyDisabledWorks,
|
| + this.verifyEnabledWorks,
|
| + testDone];
|
| + this.nextStep();
|
| +});
|
| +
|
| +TEST_F('BasicExtensionSettingsWebUITest', 'testUninstall', function() {
|
| + this.steps = [this.waitForPageLoad,
|
| + this.verifyUninstallWorks,
|
| + testDone];
|
| + this.nextStep();
|
| +});
|
| +
|
| function AsyncExtensionSettingsWebUITest() {}
|
|
|
| AsyncExtensionSettingsWebUITest.prototype = {
|
|
|