Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / webui / extensions / extension_settings_browsertest.js
blob2324d6df0243064e4660535c756adaff0f5596f0
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
3 // found in the LICENSE file.
5 // TODO(dbeam): test for loading upacked extensions?
7 GEN('#include "chrome/browser/ui/webui/extensions/' +
8 'extension_settings_browsertest.h"');
10 /**
11 * Test C++ fixture for settings WebUI testing.
12 * @constructor
13 * @extends {testing.Test}
15 function ExtensionSettingsUIBrowserTest() {}
17 /**
18 * TestFixture for extension settings WebUI testing.
19 * @extends {testing.Test}
20 * @constructor
22 function ExtensionSettingsWebUITest() {}
24 ExtensionSettingsWebUITest.prototype = {
25 __proto__: testing.Test.prototype,
27 accessibilityIssuesAreErrors: true,
29 /** @override */
30 setUp: function() {
31 // TODO(aboxhall): remove these when crbug.com/267035 is closed.
32 this.accessibilityAuditConfig.ignoreSelectors(
33 'lowContrastElements',
34 '.enable-checkbox input:disabled + .enable-checkbox-text > *');
35 this.accessibilityAuditConfig.ignoreSelectors(
36 'lowContrastElements', '.extension-description > *');
37 this.accessibilityAuditConfig.ignoreSelectors(
38 'lowContrastElements', '.location-text');
41 /**
42 * A URL to load before starting each test.
43 * @type {string}
44 * @const
46 browsePreload: 'chrome://extensions-frame/',
48 /** @override */
49 typedefCppFixture: 'ExtensionSettingsUIBrowserTest',
52 TEST_F('ExtensionSettingsWebUITest', 'testChromeSendHandled', function() {
53 assertEquals(this.browsePreload, document.location.href);
55 // This dialog should be hidden at first.
56 assertFalse($('pack-extension-overlay').classList.contains('showing'));
58 // Show the dialog, which triggers a chrome.send() for metrics purposes.
59 cr.dispatchSimpleEvent($('pack-extension'), 'click');
60 assertTrue($('pack-extension-overlay').classList.contains('showing'));
61 });
63 /**
64 * TestFixture for extension settings WebUI testing (commands config edition).
65 * @extends {testing.Test}
66 * @constructor
68 function ExtensionSettingsCommandsConfigWebUITest() {}
70 ExtensionSettingsCommandsConfigWebUITest.prototype = {
71 __proto__: testing.Test.prototype,
73 accessibilityIssuesAreErrors: true,
75 /**
76 * A URL to load before starting each test.
77 * @type {string}
78 * @const
80 browsePreload: 'chrome://extensions-frame/configureCommands',
83 TEST_F('ExtensionSettingsCommandsConfigWebUITest', 'testChromeSendHandler',
84 function() {
85 // Just navigating to the page should trigger the chrome.send().
86 assertEquals(this.browsePreload, document.location.href);
87 assertTrue($('extension-commands-overlay').classList.contains('showing'));
88 });
90 function ExtensionSettingsWebUITestWithExtensionInstalled() {}
92 ExtensionSettingsWebUITestWithExtensionInstalled.prototype = {
93 __proto__: ExtensionSettingsWebUITest.prototype,
95 /** @override */
96 typedefCppFixture: 'ExtensionSettingsUIBrowserTest',
98 /** @override */
99 testGenPreamble: function() {
100 GEN(' InstallGoodExtension();');
104 TEST_F('ExtensionSettingsWebUITestWithExtensionInstalled',
105 'baseAccessibilityIsOk', function() {
106 assertEquals(this.browsePreload, document.location.href);
107 this.runAccessibilityAudit();