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

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

Issue 1049483003: [Extensions] Update extensions UI to observe events and add test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dan's Created 5 years, 9 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
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..90e8a8c78e52cf707e4b0e897dc930378efdf187 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
+++ b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
@@ -56,6 +56,100 @@ 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();');
Dan Beam 2015/04/02 01:34:54 why do we need to install all types for this test?
Devlin 2015/04/02 21:50:05 It's not so much that we need all types for any of
+
+ GEN(' SetAutoConfirmUninstall();');
+ },
+
+ /** @protected {Array<!Function>} */
+ steps: [],
+
+ /** @protected */
+ nextStep: function() {
+ assertTrue(this.steps.length > 0);
+ this.steps.shift().bind(this)();
+ },
+
+ /** @protected */
+ waitForPageLoad: function() {
+ extensionList = $('extension-settings-list');
+ extensionList.extensionsUpdated.then(this.nextStep.bind(this));
+ },
+
+ /** @protected */
+ verifyDisabledWorks: function() {
+ chrome.management.setEnabled(GOOD_CRX_ID, false, function() {
+ var node = $(GOOD_CRX_ID);
+ assertTrue(node != null);
+ assertTrue(node.classList.contains('inactive-extension'));
+ this.nextStep();
+ }.bind(this));
+ },
+
+ /** @protected */
+ verifyEnabledWorks: function() {
+ chrome.management.setEnabled(GOOD_CRX_ID, true, function() {
+ var node = $(GOOD_CRX_ID);
+ assertTrue(node != null);
+ assertFalse(node.classList.contains('inactive-extension'));
+ this.nextStep();
+ }.bind(this));
+ },
+
+ /** @protected */
+ verifyUninstallWorks: function() {
+ var next = this.nextStep.bind(this);
+ chrome.test.runWithUserGesture(function() {
+ chrome.management.uninstall(GOOD_CRX_ID, function() {
+ assertTrue($(GOOD_CRX_ID) == null);
Dan Beam 2015/04/02 01:34:54 assertEQ(null, $(GOOD_CRX_ID)) or assertFalse($(
Devlin 2015/04/02 21:50:05 Done.
+ next();
+ });
+ });
+ },
+};
+
+TEST_F('BasicExtensionSettingsWebUITest', 'testDisable', function() {
+ this.steps = [this.waitForPageLoad,
+ this.verifyDisabledWorks,
+ testDone];
+ this.nextStep();
+});
+
+TEST_F('BasicExtensionSettingsWebUITest', 'testEnable', function() {
+ var disable = function() {
+ chrome.management.setEnabled(GOOD_CRX_ID, false, function() {
Dan Beam 2015/04/02 01:34:54 , this.nextStep.bind(this));
Devlin 2015/04/02 21:50:05 Obselete.
+ this.nextStep();
+ }.bind(this));
+ }.bind(this);
+ this.steps = [this.waitForPageLoad,
+ disable,
Dan Beam 2015/04/02 01:34:54 can't this just be this.verifyDisableWorks in this
Devlin 2015/04/02 21:50:05 Yeah, can be - wasn't sure if that was too much ov
+ this.verifyEnabledWorks,
+ testDone];
+ this.nextStep();
+});
+
+TEST_F('BasicExtensionSettingsWebUITest', 'testUninstall', function() {
+ this.steps = [this.waitForPageLoad,
+ this.verifyUninstallWorks,
+ testDone];
+ this.nextStep();
+});
+
function AsyncExtensionSettingsWebUITest() {}
AsyncExtensionSettingsWebUITest.prototype = {

Powered by Google App Engine
This is Rietveld 408576698