Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: chrome/browser/ui/webui/extensions/extension_settings_browsertest.js

Issue 1063863004: [Extensions UI] Add tests for disabling/enabling/uninstalling extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dan's Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = {
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698