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

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: 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..06234b5952cc0798c83bc13af30ad8b1751a1543 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
+++ b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.js
@@ -56,6 +56,76 @@ 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 different types of extensions to try and exercise as many code
+ // 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
+ // TODO(devlin): There are more types to add here.
+ GEN(' InstallGoodExtension();');
+ GEN(' InstallErrorsExtension();');
+ GEN(' InstallSharedModule();');
+
+ GEN(' SetAutoConfirmUninstall();');
+ },
+
Dan Beam 2015/04/01 23:12:04 /** @protected {Array<!Function>} */
Devlin 2015/04/02 00:01:38 Done.
+ steps: [],
+
Dan Beam 2015/04/01 23:12:04 all these should be @protected
Devlin 2015/04/02 00:01:39 Done.
+ nextStep: function() {
+ assertTrue(this.steps.length > 0);
+ this.steps.shift().bind(this)();
+ },
+
+ waitForPageLoad: function() {
+ extensionList = $('extension-settings-list');
+ extensionList.extensionsUpdated.then(this.nextStep.bind(this));
+ },
+
+ 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));
+ },
+
+ 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));
+ },
+
+ verifyUninstallWorks: function() {
+ var next = this.nextStep.bind(this);
+ chrome.test.runWithUserGesture(function() {
+ chrome.management.uninstall(GOOD_CRX_ID, function() {
+ assertTrue($(GOOD_CRX_ID) == null);
+ next();
+ });
+ });
+ },
+};
+
+TEST_F('BasicExtensionSettingsWebUITest', 'testBasic', function() {
+ this.steps = [this.waitForPageLoad,
+ this.verifyDisabledWorks,
+ this.verifyEnabledWorks,
+ this.verifyUninstallWorks,
+ testDone];
+ this.nextStep();
+});
+
function AsyncExtensionSettingsWebUITest() {}
AsyncExtensionSettingsWebUITest.prototype = {

Powered by Google App Engine
This is Rietveld 408576698