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

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: 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 assertTrue(this.steps.length > 0); 84 assertTrue(this.steps.length > 0);
85 this.steps.shift().call(this); 85 this.steps.shift().call(this);
86 }, 86 },
87 87
88 /** @protected */ 88 /** @protected */
89 waitForPageLoad: function() { 89 waitForPageLoad: function() {
90 var extensionList = getRequiredElement('extension-settings-list'); 90 var extensionList = getRequiredElement('extension-settings-list');
91 extensionList.extensionsUpdated_.then(this.nextStep.bind(this)); 91 extensionList.extensionsUpdated_.then(this.nextStep.bind(this));
92 }, 92 },
93 93
94 /**
95 * A silly hack because we re-fetch extension data after every event, which is
96 * asynchronous. This will be unneeded once we transition to observing events
97 * on the developerPrivate API.
98 * @param {Function} after The function to run after the pending requests.
99 * @protected
100 */
101 runPendingRequests: function(after) {
102 window.setTimeout(function() {
103 chrome.developerPrivate.getExtensionsInfo(after);
104 }, 0);
105 },
106
107 /** @protected */ 94 /** @protected */
108 verifyDisabledWorks: function() { 95 verifyDisabledWorks: function() {
109 chrome.management.setEnabled(GOOD_CRX_ID, false, 96 chrome.management.setEnabled(GOOD_CRX_ID, false, function() {
110 this.runPendingRequests.bind(this, function() {
111 var node = getRequiredElement(GOOD_CRX_ID); 97 var node = getRequiredElement(GOOD_CRX_ID);
112 assertTrue(node.classList.contains('inactive-extension')); 98 assertTrue(node.classList.contains('inactive-extension'));
113 this.nextStep(); 99 this.nextStep();
114 }.bind(this))); 100 }.bind(this));
115 }, 101 },
116 102
117 /** @protected */ 103 /** @protected */
118 verifyEnabledWorks: function() { 104 verifyEnabledWorks: function() {
119 chrome.management.setEnabled(GOOD_CRX_ID, true, 105 chrome.management.setEnabled(GOOD_CRX_ID, true, function() {
120 this.runPendingRequests.bind(this, function() {
121 var node = getRequiredElement(GOOD_CRX_ID); 106 var node = getRequiredElement(GOOD_CRX_ID);
122 assertFalse(node.classList.contains('inactive-extension')); 107 assertFalse(node.classList.contains('inactive-extension'));
123 this.nextStep(); 108 this.nextStep();
124 }.bind(this))); 109 }.bind(this));
125 }, 110 },
126 111
127 /** @protected */ 112 /** @protected */
128 verifyUninstallWorks: function() { 113 verifyUninstallWorks: function() {
114 var next = this.nextStep.bind(this);
129 chrome.test.runWithUserGesture(function() { 115 chrome.test.runWithUserGesture(function() {
130 chrome.management.uninstall(GOOD_CRX_ID, 116 chrome.management.uninstall(GOOD_CRX_ID, function() {
131 this.runPendingRequests.bind(this, function() {
132 assertEquals(null, $(GOOD_CRX_ID)); 117 assertEquals(null, $(GOOD_CRX_ID));
133 this.nextStep(); 118 next();
134 }.bind(this))); 119 });
135 }.bind(this)); 120 });
136 }, 121 },
137 }; 122 };
138 123
139 TEST_F('BasicExtensionSettingsWebUITest', 'testDisable', function() { 124 TEST_F('BasicExtensionSettingsWebUITest', 'testDisable', function() {
140 this.steps = [this.waitForPageLoad, 125 this.steps = [this.waitForPageLoad,
141 this.verifyDisabledWorks, 126 this.verifyDisabledWorks,
142 testDone]; 127 testDone];
143 this.nextStep(); 128 this.nextStep();
144 }); 129 });
145 130
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 313
329 ExtensionOptionsDialogWebUITest.prototype = { 314 ExtensionOptionsDialogWebUITest.prototype = {
330 __proto__: InstalledExtensionSettingsWebUITest.prototype, 315 __proto__: InstalledExtensionSettingsWebUITest.prototype,
331 316
332 /** @override */ 317 /** @override */
333 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + 318 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload +
334 '?options=' + GOOD_CRX_ID, 319 '?options=' + GOOD_CRX_ID,
335 }; 320 };
336 321
337 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit); 322 TEST_F('ExtensionOptionsDialogWebUITest', 'testAccessibility', runAudit);
OLDNEW
« no previous file with comments | « chrome/browser/resources/extensions/extensions.js ('k') | chrome/browser/ui/webui/extensions/extension_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698