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 GEN('#include "chrome/browser/ui/browser.h"');
6 GEN('#include "chrome/browser/ui/browser_commands.h"');
7 GEN('#include "chrome/browser/ui/exclusive_access/' +
8 'fullscreen_controller_test.h"');
11 * Fixture for ChromeOs WebUI OOBE testing.
13 * There's one test for each page in the Chrome OS Out-of-box-experience
14 * (OOBE), so that an accessibility audit can be run automatically on
15 * each one. This will alert a developer immediately if they accidentally
16 * forget to label a control, or if a focusable control ends up
17 * off-screen without being disabled, for example.
20 function OobeWebUITest() {}
22 OobeWebUITest.prototype = {
23 __proto__: testing.Test.prototype,
26 browsePreload: 'chrome://oobe/oobe',
29 runAccessibilityChecks: true,
32 accessibilityIssuesAreErrors: true,
35 testGenPreamble: function() {
36 // OobeWebUI should run in fullscreen.
37 GEN(' FullscreenNotificationObserver fullscreen_observer;');
38 GEN(' chrome::ToggleFullscreenMode(browser());');
39 GEN(' fullscreen_observer.Wait();');
44 testing.Test.prototype.setUp.call(this);
46 /* False positives. http://crbug.com/501489 */
47 this.accessibilityAuditConfig.ignoreSelectors('badAriaAttributeValue',
49 this.accessibilityAuditConfig.ignoreSelectors(
50 'nonExistentAriaLabelledbyElement',
54 * False positive AX_FOCUS_01.
55 * https://github.com/GoogleChrome/accessibility-developer-tools/issues/171
57 this.accessibilityAuditConfig.ignoreSelectors(
58 'focusableElementNotVisibleAndNotAriaHidden',
63 function createOobeWebUITestSupervisedManagerData() {
66 { 'username' : 'user@invalid.domain',
67 'displayName' : 'John Doe',
68 'emailAddress' : 'user@invalid.domain'
70 { 'username' : 'other@invalid.domain',
71 'displayName' : 'Joanna Doe',
72 'emailAddress' : 'other@invalid.domain'
78 TEST_F('OobeWebUITest', 'EmptyOobe', function() {
81 TEST_F('OobeWebUITest', 'OobeConnect', function() {
82 Oobe.getInstance().showScreen({'id':'connect'});
85 TEST_F('OobeWebUITest', 'OobeEula', function() {
86 Oobe.getInstance().showScreen({'id':'eula'});
89 TEST_F('OobeWebUITest', 'OobeUpdate', function() {
90 Oobe.getInstance().showScreen({'id':'update'});
93 TEST_F('OobeWebUITest', 'OobeGaiaSignIn', function() {
94 Oobe.getInstance().showScreen({'id':'gaia-signin'});
97 TEST_F('OobeWebUITest', 'OobeSupervisedUsers', function() {
98 Oobe.getInstance().showScreen(
99 {'id' : 'supervised-user-creation',
100 'data' : createOobeWebUITestSupervisedManagerData()});
103 TEST_F('OobeWebUITest', 'OobeSupervisedUsers2', function() {
104 Oobe.getInstance().showScreen(
105 {'id' : 'supervised-user-creation',
106 'data' : createOobeWebUITestSupervisedManagerData()});
107 $('supervised-user-creation').setVisiblePage_('manager');
110 TEST_F('OobeWebUITest', 'OobeSupervisedUsers3', function() {
111 Oobe.getInstance().showScreen(
112 {'id' : 'supervised-user-creation',
113 'data' : createOobeWebUITestSupervisedManagerData()});
114 $('supervised-user-creation').setDefaultImages(
115 [{'url': 'chrome://nothing/', 'title': 'None'},
116 {'url': 'chrome://nothing/', 'title': 'None'}]);
117 $('supervised-user-creation').setVisiblePage_('username');
120 // TODO: this either needs a WebUILoginDisplay instance or some
121 // other way to initialize the appropriate C++ handlers.
122 TEST_F('OobeWebUITest', 'DISABLED_OobeUserImage', function() {
123 Oobe.getInstance().showScreen({'id':'user-image'});
126 // TODO: figure out what state to mock in order for this
127 // screen to show up.
128 TEST_F('OobeWebUITest', 'DISABLED_OobeAccountPicker', function() {
129 Oobe.getInstance().showScreen({'id':'account-picker'});
133 TEST_F('OobeWebUITest', 'HIDDetectionScreenTest', function() {
134 function getPincodeSymbol(i) {
135 return $('hid-keyboard-pincode-sym-' + (i + 1));
138 function getDisplayedPincode() {
140 for (var i = 0; i < 6; ++i)
141 pincode += getPincodeSymbol(i).textContent;
145 login.HIDDetectionScreen.contextChanged({
146 'keyboard-state': 'searching',
147 'mouse-state': 'searching'
149 Oobe.showScreen({'id': 'hid-detection'});
150 expectTrue($('hid-keyboard-pincode').hidden);
152 login.HIDDetectionScreen.contextChanged({
153 'keyboard-state': 'pairing',
154 'keyboard-pincode': '013188'
156 expectFalse($('hid-keyboard-pincode').hidden);
157 expectEquals('013188', getDisplayedPincode());
159 login.HIDDetectionScreen.contextChanged({
160 'num-keys-entered-expected': true,
161 'num-keys-entered-pincode': 3
163 expectFalse($('hid-keyboard-pincode').hidden);
164 expectEquals('013188', getDisplayedPincode());
166 { 'key-typed': true },
167 { 'key-typed': true },
168 { 'key-typed': true },
169 { 'key-next': true },
170 { 'key-untyped': true },
171 { 'key-untyped': true },
172 { 'key-untyped': true } // Enter key symbol.
173 ].forEach(function(expectedClasses, i) {
174 var symbol = getPincodeSymbol(i);
175 ['key-typed', 'key-untyped', 'key-next'].forEach(function(className) {
176 expectEquals(!!expectedClasses[className],
177 symbol.classList.contains(className));
181 login.HIDDetectionScreen.contextChanged({
182 'keyboard-state': 'connected'
184 expectTrue($('hid-keyboard-pincode').hidden);