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

Side by Side Diff: chrome/browser/ui/webui/options/multilanguage_options_webui_browsertest.js

Issue 1481723002: Revert of [a11y] Bring accessibility-audit up to date: v2.10.0 release. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 GEN_INCLUDE(['options_browsertest_base.js']);
6 GEN('#include "chrome/browser/ui/webui/options/' + 5 GEN('#include "chrome/browser/ui/webui/options/' +
7 'multilanguage_options_browsertest.h"'); 6 'multilanguage_options_browsertest.h"');
8 7
9 /** 8 /**
10 * Test C++ fixture for Language Options WebUI testing. 9 * Test C++ fixture for Language Options WebUI testing.
11 * @constructor 10 * @constructor
12 * @extends {testing.Test} 11 * @extends {testing.Test}
13 */ 12 */
14 function MultilanguageOptionsWebUIBrowserTest() {} 13 function MultilanguageOptionsWebUIBrowserTest() {}
15 14
16 MultilanguageOptionsWebUIBrowserTest.prototype = { 15 MultilanguageOptionsWebUIBrowserTest.prototype = {
17 __proto__: OptionsBrowsertestBase.prototype, 16 __proto__: testing.Test.prototype,
18 17
19 /** @override */ 18 /** @override */
20 browsePreload: 'chrome://settings-frame/languages', 19 browsePreload: 'chrome://settings-frame/languages',
21 20
22 /** @override */ 21 /** @override */
23 typedefCppFixture: 'MultilanguageOptionsBrowserTest', 22 typedefCppFixture: 'MultilanguageOptionsBrowserTest',
24 23
25 /** @override */ 24 /** @override */
26 accessibilityIssuesAreErrors: true, 25 accessibilityIssuesAreErrors: true,
27 26
28 /** @param {string} expected Sorted currently selected languages. */ 27 /** @param {string} expected Sorted currently selected languages. */
29 expectCurrentlySelected: function(expected) { 28 expectCurrentlySelected: function(expected) {
30 var languages = LanguageOptions.getInstance().spellCheckLanguages_; 29 var languages = LanguageOptions.getInstance().spellCheckLanguages_;
31 expectEquals(expected, Object.keys(languages).sort().join()); 30 expectEquals(expected, Object.keys(languages).sort().join());
32 }, 31 },
33 32
34 /** @override */ 33 /** @override */
35 setUp: function() { 34 setUp: function() {
36 OptionsBrowsertestBase.prototype.setUp.call(this); 35 testing.Test.prototype.setUp.call(this);
37 36
38 assertTrue(loadTimeData.getBoolean('enableMultilingualSpellChecker')); 37 assertTrue(loadTimeData.getBoolean('enableMultilingualSpellChecker'));
39 assertFalse(cr.isMac); 38 assertFalse(cr.isMac);
40 expectTrue($('spellcheck-language-button').hidden); 39 expectTrue($('spellcheck-language-button').hidden);
41 expectFalse($('edit-custom-dictionary-button').hidden); 40 expectFalse($('edit-custom-dictionary-button').hidden);
42 this.expectEnableSpellcheckCheckboxHidden(); 41 this.expectEnableSpellcheckCheckboxHidden();
43 this.expectCurrentlySelected('fr'); 42 this.expectCurrentlySelected('fr');
44
45 var requiredOwnedAriaRoleMissingSelectors = [
46 '#default-search-engine-list',
47 '#other-search-engine-list',
48 ];
49
50 // Enable when failure is resolved.
51 // AX_ARIA_08: http://crbug.com/559320
52 this.accessibilityAuditConfig.ignoreSelectors(
53 'requiredOwnedAriaRoleMissing',
54 requiredOwnedAriaRoleMissingSelectors);
55
56 // Enable when failure is resolved.
57 // AX_ARIA_10: http://crbug.com/559266
58 this.accessibilityAuditConfig.ignoreSelectors(
59 'unsupportedAriaAttribute',
60 '#language-options-list');
61
62 // Enable when failure is resolved.
63 // AX_TEXT_04: http://crbug.com/559271
64 this.accessibilityAuditConfig.ignoreSelectors(
65 'linkWithUnclearPurpose',
66 '#languagePage > .content-area > .language-options-header > A');
67 }, 43 },
68 44
69 /** @override */ 45 /** @override */
70 tearDown: function() { 46 tearDown: function() {
71 testing.Test.prototype.tearDown.call(this); 47 testing.Test.prototype.tearDown.call(this);
72 this.expectEnableSpellcheckCheckboxHidden(); 48 this.expectEnableSpellcheckCheckboxHidden();
73 }, 49 },
74 50
75 /** Make sure the 'Enable spell checking' checkbox is not visible. */ 51 /** Make sure the 'Enable spell checking' checkbox is not visible. */
76 expectEnableSpellcheckCheckboxHidden: function() { 52 expectEnableSpellcheckCheckboxHidden: function() {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 * Watch for a change to the preference |pref| and then call |callback|. 133 * Watch for a change to the preference |pref| and then call |callback|.
158 * @param {string} pref The preference to listen for a change on. 134 * @param {string} pref The preference to listen for a change on.
159 * @param {function} callback The function to run after a listener event. 135 * @param {function} callback The function to run after a listener event.
160 */ 136 */
161 addPreferenceListener: function(pref, callback) { 137 addPreferenceListener: function(pref, callback) {
162 options.Preferences.getInstance().addEventListener(pref, callback); 138 options.Preferences.getInstance().addEventListener(pref, callback);
163 }, 139 },
164 140
165 /** @override */ 141 /** @override */
166 setUp: function() { 142 setUp: function() {
167 OptionsBrowsertestBase.prototype.setUp.call(this); 143 testing.Test.prototype.setUp.call(this);
168 144
169 assertTrue(loadTimeData.getBoolean('enableMultilingualSpellChecker')); 145 assertTrue(loadTimeData.getBoolean('enableMultilingualSpellChecker'));
170 assertFalse(cr.isMac); 146 assertFalse(cr.isMac);
171 expectTrue($('spellcheck-language-button').hidden); 147 expectTrue($('spellcheck-language-button').hidden);
172 expectTrue($('edit-custom-dictionary-button').hidden); 148 expectTrue($('edit-custom-dictionary-button').hidden);
173 this.expectEnableSpellcheckCheckboxHidden(); 149 this.expectEnableSpellcheckCheckboxHidden();
174 this.expectCurrentlySelected(''); 150 this.expectCurrentlySelected('');
175 this.expectRegisteredDictionariesPref(''); 151 this.expectRegisteredDictionariesPref('');
176
177 // Enable when failure is resolved.
178 // AX_ARIA_10: http://crbug.com/559266
179 this.accessibilityAuditConfig.ignoreSelectors(
180 'unsupportedAriaAttribute',
181 '#language-options-list');
182
183 // Enable when failure is resolved.
184 // AX_TEXT_04: http://crbug.com/559271
185 this.accessibilityAuditConfig.ignoreSelectors(
186 'linkWithUnclearPurpose',
187 '#languagePage > .content-area > .language-options-header > A');
188 }, 152 },
189 }; 153 };
190 154
191 // Make sure the case where no languages are selected is handled properly. 155 // Make sure the case where no languages are selected is handled properly.
192 TEST_F('MultilanguagePreferenceWebUIBrowserTest', 'SelectFromBlank', 156 TEST_F('MultilanguagePreferenceWebUIBrowserTest', 'SelectFromBlank',
193 function() { 157 function() {
194 expectTrue($('language-options-list').selectLanguageByCode('fr')); 158 expectTrue($('language-options-list').selectLanguageByCode('fr'));
195 expectFalse($('spellcheck-language-checkbox').checked, 'fr'); 159 expectFalse($('spellcheck-language-checkbox').checked, 'fr');
196 expectTrue($('edit-custom-dictionary-button').hidden); 160 expectTrue($('edit-custom-dictionary-button').hidden);
197 161
198 // Add a preference change event listener which ensures that the preference is 162 // Add a preference change event listener which ensures that the preference is
199 // updated correctly and that 'fr' is the only thing in the dictionary object. 163 // updated correctly and that 'fr' is the only thing in the dictionary object.
200 this.addPreferenceListener('spellcheck.dictionaries', function() { 164 this.addPreferenceListener('spellcheck.dictionaries', function() {
201 expectTrue($('spellcheck-language-checkbox').checked, 'fr'); 165 expectTrue($('spellcheck-language-checkbox').checked, 'fr');
202 this.expectRegisteredDictionariesPref('fr'); 166 this.expectRegisteredDictionariesPref('fr');
203 this.expectCurrentlySelected('fr'); 167 this.expectCurrentlySelected('fr');
204 expectFalse($('edit-custom-dictionary-button').hidden); 168 expectFalse($('edit-custom-dictionary-button').hidden);
205 testDone(); 169 testDone();
206 }.bind(this)); 170 }.bind(this));
207 171
208 // Click 'fr' and trigger the preference listener. 172 // Click 'fr' and trigger the preference listener.
209 $('spellcheck-language-checkbox').click(); 173 $('spellcheck-language-checkbox').click();
210 }); 174 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698