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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_browsertest.js

Issue 1132493004: Enable extensions error button test that was failing on stable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply feedback Created 5 years, 7 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
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // The id of the extension from |InstallGoodExtension|.
11 // ExtensionSettingsUIBrowserTest::InstallGoodExtension() in some of the tests. 11 var GOOD_EXTENSION_ID = 'ldnnhddmnhbkjipkidpdiheffobcpfmf';
12 var GOOD_CRX_ID = 'ldnnhddmnhbkjipkidpdiheffobcpfmf'; 12
13 // The id of the extension from |InstallErrorsExtension|.
14 var ERROR_EXTENSION_ID = 'pdlpifnclfacjobnmbpngemkalkjamnf';
13 15
14 /** 16 /**
15 * Test C++ fixture for settings WebUI testing. 17 * Test C++ fixture for settings WebUI testing.
16 * @constructor 18 * @constructor
17 * @extends {testing.Test} 19 * @extends {testing.Test}
18 */ 20 */
19 function ExtensionSettingsUIBrowserTest() {} 21 function ExtensionSettingsUIBrowserTest() {}
20 22
21 /** 23 /**
22 * TestFixture for extension settings WebUI testing. 24 * TestFixture for extension settings WebUI testing.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 GEN(' InstallPackagedApp();'); 194 GEN(' InstallPackagedApp();');
193 195
194 GEN(' SetAutoConfirmUninstall();'); 196 GEN(' SetAutoConfirmUninstall();');
195 }, 197 },
196 198
197 /** @protected */ 199 /** @protected */
198 verifyDisabledWorks: function() { 200 verifyDisabledWorks: function() {
199 var listener = new UpdateListener( 201 var listener = new UpdateListener(
200 chrome.developerPrivate.EventType.UNLOADED, 202 chrome.developerPrivate.EventType.UNLOADED,
201 function() { 203 function() {
202 var node = getRequiredElement(GOOD_CRX_ID); 204 var node = getRequiredElement(GOOD_EXTENSION_ID);
203 assertTrue(node.classList.contains('inactive-extension')); 205 assertTrue(node.classList.contains('inactive-extension'));
204 this.nextStep(); 206 this.nextStep();
205 }.bind(this)); 207 }.bind(this));
206 chrome.management.setEnabled(GOOD_CRX_ID, false); 208 chrome.management.setEnabled(GOOD_EXTENSION_ID, false);
207 }, 209 },
208 210
209 /** @protected */ 211 /** @protected */
210 verifyEnabledWorks: function() { 212 verifyEnabledWorks: function() {
211 var listener = new UpdateListener( 213 var listener = new UpdateListener(
212 chrome.developerPrivate.EventType.LOADED, 214 chrome.developerPrivate.EventType.LOADED,
213 function() { 215 function() {
214 var node = getRequiredElement(GOOD_CRX_ID); 216 var node = getRequiredElement(GOOD_EXTENSION_ID);
215 assertFalse(node.classList.contains('inactive-extension')); 217 assertFalse(node.classList.contains('inactive-extension'));
216 this.nextStep(); 218 this.nextStep();
217 }.bind(this)); 219 }.bind(this));
218 chrome.management.setEnabled(GOOD_CRX_ID, true); 220 chrome.management.setEnabled(GOOD_EXTENSION_ID, true);
219 }, 221 },
220 222
221 /** @protected */ 223 /** @protected */
222 verifyUninstallWorks: function() { 224 verifyUninstallWorks: function() {
223 var listener = new UpdateListener( 225 var listener = new UpdateListener(
224 chrome.developerPrivate.EventType.UNINSTALLED, 226 chrome.developerPrivate.EventType.UNINSTALLED,
225 function() { 227 function() {
226 assertEquals(null, $(GOOD_CRX_ID)); 228 assertEquals(null, $(GOOD_EXTENSION_ID));
227 this.nextStep(); 229 this.nextStep();
228 }.bind(this)); 230 }.bind(this));
229 chrome.test.runWithUserGesture(function() { 231 chrome.test.runWithUserGesture(function() {
230 chrome.management.uninstall(GOOD_CRX_ID); 232 chrome.management.uninstall(GOOD_EXTENSION_ID);
231 }); 233 });
232 }, 234 },
233 }; 235 };
234 236
235 // Verify that developer mode doesn't change behavior when the number of 237 // Verify that developer mode doesn't change behavior when the number of
236 // extensions changes. 238 // extensions changes.
237 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperModeManyExtensions', 239 TEST_F('BasicExtensionSettingsWebUITest', 'testDeveloperModeManyExtensions',
238 function() { 240 function() {
239 this.testDeveloperMode(); 241 this.testDeveloperMode();
240 }); 242 });
(...skipping 23 matching lines...) Expand all
264 assertFalse($('extension-list-wrapper').hidden); 266 assertFalse($('extension-list-wrapper').hidden);
265 assertTrue($('no-extensions').hidden); 267 assertTrue($('no-extensions').hidden);
266 assertGT($('extension-settings-list').childNodes.length, 0); 268 assertGT($('extension-settings-list').childNodes.length, 0);
267 this.nextStep(); 269 this.nextStep();
268 }; 270 };
269 271
270 this.steps = [this.waitForPageLoad, verifyListIsNotHiddenAndEmpty, testDone]; 272 this.steps = [this.waitForPageLoad, verifyListIsNotHiddenAndEmpty, testDone];
271 this.nextStep(); 273 this.nextStep();
272 }); 274 });
273 275
274 function AsyncExtensionSettingsWebUITest() {} 276 function ErrorConsoleExtensionSettingsWebUITest() {}
275 277
276 AsyncExtensionSettingsWebUITest.prototype = { 278 ErrorConsoleExtensionSettingsWebUITest.prototype = {
277 __proto__: ExtensionSettingsWebUITest.prototype, 279 __proto__: ExtensionSettingsWebUITest.prototype,
278 280
279 /** @override */ 281 /** @override */
280 testGenPreamble: function() { 282 testGenPreamble: function() {
283 GEN(' EnableErrorConsole();');
281 GEN(' InstallGoodExtension();'); 284 GEN(' InstallGoodExtension();');
282 GEN(' InstallErrorsExtension();'); 285 GEN(' InstallErrorsExtension();');
283 }, 286 },
284 }; 287 };
285 288
286 // Still fails on CrWinClang tester. BUG=463245 289 TEST_F('ErrorConsoleExtensionSettingsWebUITest',
287 TEST_F('AsyncExtensionSettingsWebUITest', 290 'testErrorListButtonVisibility', function() {
288 'DISABLED_testErrorListButtonVisibility',
289 function() {
290 var testButtonVisibility = function() { 291 var testButtonVisibility = function() {
291 var extensionList = $('extension-list-wrapper'); 292 var extensionList = $('extension-list-wrapper');
292 293
293 // 2 extensions are loaded:
294 // The 'good' extension will have 0 errors wich means no error button.
295 // The 'bad' extension will have >3 manifest errors and <3 runtime errors.
296 // This means there will be a single error button.
297 var visibleButtons = extensionList.querySelectorAll( 294 var visibleButtons = extensionList.querySelectorAll(
298 '.errors-link:not([hidden])'); 295 '.errors-link:not([hidden])');
299 expectEquals(1, visibleButtons.length); 296 expectEquals(1, visibleButtons.length);
300 297
298 if (visibleButtons.length > 0) {
299 var errorLink = $(ERROR_EXTENSION_ID).querySelector('.errors-link');
300 expectEquals(visibleButtons[0], errorLink);
301
302 var errorIcon = errorLink.querySelector('img');
303 expectTrue(errorIcon.classList.contains('extension-error-warning-icon'));
304 }
305
301 var hiddenButtons = extensionList.querySelectorAll('.errors-link[hidden]'); 306 var hiddenButtons = extensionList.querySelectorAll('.errors-link[hidden]');
302 expectEquals(1, hiddenButtons.length); 307 expectEquals(1, hiddenButtons.length);
303 308
304 this.nextStep(); 309 this.nextStep();
305 }; 310 };
306 311
307 this.steps = [this.waitForPageLoad, 312 this.steps = [this.waitForPageLoad,
308 this.enableDeveloperMode, 313 this.enableDeveloperMode,
309 testButtonVisibility, 314 testButtonVisibility,
310 testDone]; 315 testDone];
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 }; 367 };
363 368
364 TEST_F('InstallGoodExtensionSettingsWebUITest', 'testAccessibility', 369 TEST_F('InstallGoodExtensionSettingsWebUITest', 'testAccessibility',
365 function() { 370 function() {
366 this.emptyTestForAccessibility(); 371 this.emptyTestForAccessibility();
367 }); 372 });
368 373
369 TEST_F('InstallGoodExtensionSettingsWebUITest', 'showOptions', function() { 374 TEST_F('InstallGoodExtensionSettingsWebUITest', 'showOptions', function() {
370 var showExtensionOptions = function() { 375 var showExtensionOptions = function() {
371 var optionsOverlay = extensions.ExtensionOptionsOverlay.getInstance(); 376 var optionsOverlay = extensions.ExtensionOptionsOverlay.getInstance();
372 optionsOverlay.setExtensionAndShow(GOOD_CRX_ID, 'GOOD!', '', 377 optionsOverlay.setExtensionAndShow(GOOD_EXTENSION_ID, 'GOOD!', '',
373 this.nextStep.bind(this)); 378 this.nextStep.bind(this));
374 379
375 // Preferred size changes don't happen in browser tests. Just fake it. 380 // Preferred size changes don't happen in browser tests. Just fake it.
376 document.querySelector('extensionoptions').onpreferredsizechanged( 381 document.querySelector('extensionoptions').onpreferredsizechanged(
377 {width: 500, height: 500}); 382 {width: 500, height: 500});
378 }; 383 };
379 384
380 this.steps = [this.waitForPageLoad, showExtensionOptions, testDone]; 385 this.steps = [this.waitForPageLoad, showExtensionOptions, testDone];
381 this.nextStep(); 386 this.nextStep();
382 }); 387 });
(...skipping 22 matching lines...) Expand all
405 * @constructor 410 * @constructor
406 * @extends {InstallGoodExtensionSettingsWebUITest} 411 * @extends {InstallGoodExtensionSettingsWebUITest}
407 */ 412 */
408 function OptionsDialogExtensionSettingsWebUITest() {} 413 function OptionsDialogExtensionSettingsWebUITest() {}
409 414
410 OptionsDialogExtensionSettingsWebUITest.prototype = { 415 OptionsDialogExtensionSettingsWebUITest.prototype = {
411 __proto__: InstallGoodExtensionSettingsWebUITest.prototype, 416 __proto__: InstallGoodExtensionSettingsWebUITest.prototype,
412 417
413 /** @override */ 418 /** @override */
414 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload + 419 browsePreload: ExtensionSettingsWebUITest.prototype.browsePreload +
415 '?options=' + GOOD_CRX_ID, 420 '?options=' + GOOD_EXTENSION_ID,
416 }; 421 };
417 422
418 TEST_F('OptionsDialogExtensionSettingsWebUITest', 'testAccessibility', 423 TEST_F('OptionsDialogExtensionSettingsWebUITest', 'testAccessibility',
419 function() { 424 function() {
420 this.emptyTestForAccessibility(); 425 this.emptyTestForAccessibility();
421 }); 426 });
OLDNEW
« 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