1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(dbeam): test for loading upacked extensions?
GEN('#include "chrome/browser/ui/webui/extensions/' +
'extension_settings_browsertest.h"');
/**
* Test C++ fixture for settings WebUI testing.
* @constructor
* @extends {testing.Test}
*/
function ExtensionSettingsUIBrowserTest() {}
/**
* TestFixture for extension settings WebUI testing.
* @extends {testing.Test}
* @constructor
*/
function ExtensionSettingsWebUITest() {}
ExtensionSettingsWebUITest.prototype = {
__proto__: testing.Test.prototype,
accessibilityIssuesAreErrors: true,
/** @override */
setUp: function() {
// TODO(aboxhall): remove these when crbug.com/267035 is closed.
this.accessibilityAuditConfig.ignoreSelectors(
'lowContrastElements',
'.enable-checkbox input:disabled + .enable-checkbox-text > *');
this.accessibilityAuditConfig.ignoreSelectors(
'lowContrastElements', '.extension-description > *');
this.accessibilityAuditConfig.ignoreSelectors(
'lowContrastElements', '.location-text');
},
/**
* A URL to load before starting each test.
* @type {string}
* @const
*/
browsePreload: 'chrome://extensions-frame/',
/** @override */
typedefCppFixture: 'ExtensionSettingsUIBrowserTest',
};
TEST_F('ExtensionSettingsWebUITest', 'testChromeSendHandled', function() {
assertEquals(this.browsePreload, document.location.href);
// This dialog should be hidden at first.
assertFalse($('pack-extension-overlay').classList.contains('showing'));
// Show the dialog, which triggers a chrome.send() for metrics purposes.
cr.dispatchSimpleEvent($('pack-extension'), 'click');
assertTrue($('pack-extension-overlay').classList.contains('showing'));
});
/**
* TestFixture for extension settings WebUI testing (commands config edition).
* @extends {testing.Test}
* @constructor
*/
function ExtensionSettingsCommandsConfigWebUITest() {}
ExtensionSettingsCommandsConfigWebUITest.prototype = {
__proto__: testing.Test.prototype,
accessibilityIssuesAreErrors: true,
/**
* A URL to load before starting each test.
* @type {string}
* @const
*/
browsePreload: 'chrome://extensions-frame/configureCommands',
};
TEST_F('ExtensionSettingsCommandsConfigWebUITest', 'testChromeSendHandler',
function() {
// Just navigating to the page should trigger the chrome.send().
assertEquals(this.browsePreload, document.location.href);
assertTrue($('extension-commands-overlay').classList.contains('showing'));
});
function ExtensionSettingsWebUITestWithExtensionInstalled() {}
ExtensionSettingsWebUITestWithExtensionInstalled.prototype = {
__proto__: ExtensionSettingsWebUITest.prototype,
/** @override */
typedefCppFixture: 'ExtensionSettingsUIBrowserTest',
/** @override */
testGenPreamble: function() {
GEN(' InstallGoodExtension();');
}
};
TEST_F('ExtensionSettingsWebUITestWithExtensionInstalled',
'baseAccessibilityIsOk', function() {
assertEquals(this.browsePreload, document.location.href);
this.runAccessibilityAudit();
});
|