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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
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
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 multiple types of extensions to ensure we handle each type.
70 // TODO(devlin): There are more types to add here.
71 GEN(' InstallGoodExtension();');
72 GEN(' InstallErrorsExtension();');
73 GEN(' InstallSharedModule();');
74 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
75
76 GEN(' SetAutoConfirmUninstall();');
77 },
78
79 /** @protected {Array<!Function>} */
80 steps: [],
81
82 /** @protected */
83 nextStep: function() {
84 assertTrue(this.steps.length > 0);
85 this.steps.shift().bind(this)();
86 },
87
88 /** @protected */
89 waitForPageLoad: function() {
90 extensionList = $('extension-settings-list');
91 extensionList.extensionsUpdated.then(this.nextStep.bind(this));
92 },
93
94 /** @protected */
95 verifyDisabledWorks: function() {
96 chrome.management.setEnabled(GOOD_CRX_ID, false, function() {
97 var node = $(GOOD_CRX_ID);
98 assertTrue(node != null);
99 assertTrue(node.classList.contains('inactive-extension'));
100 this.nextStep();
101 }.bind(this));
102 },
103
104 /** @protected */
105 verifyEnabledWorks: function() {
106 chrome.management.setEnabled(GOOD_CRX_ID, true, function() {
107 var node = $(GOOD_CRX_ID);
108 assertTrue(node != null);
109 assertFalse(node.classList.contains('inactive-extension'));
110 this.nextStep();
111 }.bind(this));
112 },
113
114 /** @protected */
115 verifyUninstallWorks: function() {
116 var next = this.nextStep.bind(this);
117 chrome.test.runWithUserGesture(function() {
118 chrome.management.uninstall(GOOD_CRX_ID, function() {
119 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.
120 next();
121 });
122 });
123 },
124 };
125
126 TEST_F('BasicExtensionSettingsWebUITest', 'testDisable', function() {
127 this.steps = [this.waitForPageLoad,
128 this.verifyDisabledWorks,
129 testDone];
130 this.nextStep();
131 });
132
133 TEST_F('BasicExtensionSettingsWebUITest', 'testEnable', function() {
134 var disable = function() {
135 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.
136 this.nextStep();
137 }.bind(this));
138 }.bind(this);
139 this.steps = [this.waitForPageLoad,
140 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
141 this.verifyEnabledWorks,
142 testDone];
143 this.nextStep();
144 });
145
146 TEST_F('BasicExtensionSettingsWebUITest', 'testUninstall', function() {
147 this.steps = [this.waitForPageLoad,
148 this.verifyUninstallWorks,
149 testDone];
150 this.nextStep();
151 });
152
59 function AsyncExtensionSettingsWebUITest() {} 153 function AsyncExtensionSettingsWebUITest() {}
60 154
61 AsyncExtensionSettingsWebUITest.prototype = { 155 AsyncExtensionSettingsWebUITest.prototype = {
62 __proto__: ExtensionSettingsWebUITest.prototype, 156 __proto__: ExtensionSettingsWebUITest.prototype,
63 157
64 /** @override */ 158 /** @override */
65 isAsync: true, 159 isAsync: true,
66 160
67 /** @override */ 161 /** @override */
68 testGenPreamble: function() { 162 testGenPreamble: function() {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 320
227 ExtensionOptionsDialogWebUITest.prototype = { 321 ExtensionOptionsDialogWebUITest.prototype = {
228 __proto__: InstalledExtensionSettingsWebUITest.prototype, 322 __proto__: InstalledExtensionSettingsWebUITest.prototype,
229 323
230 /** @override */ 324 /** @override */
231 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + 325 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload +
232 '?options=' + GOOD_CRX_ID, 326 '?options=' + GOOD_CRX_ID,
233 }; 327 };
234 328
235 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); 329 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698