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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs

Issue 2507063007: Use aria range values for sliders (Closed)
Patch Set: Rebase Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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(['../../testing/assert_additions.js']); 5 GEN_INCLUDE(['../../testing/assert_additions.js']);
6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']);
7 7
8 /** 8 /**
9 * Gets the braille output and asserts that it matches expected values. 9 * Gets the braille output and asserts that it matches expected values.
10 * Annotations in the output that are primitive strings are ignored. 10 * Annotations in the output that are primitive strings are ignored.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 function OutputE2ETest() { 93 function OutputE2ETest() {
94 ChromeVoxNextE2ETest.call(this); 94 ChromeVoxNextE2ETest.call(this);
95 } 95 }
96 96
97 OutputE2ETest.prototype = { 97 OutputE2ETest.prototype = {
98 __proto__: ChromeVoxNextE2ETest.prototype, 98 __proto__: ChromeVoxNextE2ETest.prototype,
99 99
100 /** @override */ 100 /** @override */
101 setUp: function() { 101 setUp: function() {
102 window.Dir = AutomationUtil.Dir; 102 window.Dir = AutomationUtil.Dir;
103 window.RoleType = chrome.automation.RoleType;
103 this.forceContextualLastOutput(); 104 this.forceContextualLastOutput();
104 } 105 }
105 }; 106 };
106 107
107 TEST_F('OutputE2ETest', 'Links', function() { 108 TEST_F('OutputE2ETest', 'Links', function() {
108 this.runWithLoadedTree('<a href="#">Click here</a>', 109 this.runWithLoadedTree('<a href="#">Click here</a>',
109 function(root) { 110 function(root) {
110 var el = root.firstChild.firstChild; 111 var el = root.firstChild.firstChild;
111 var range = cursors.Range.fromNode(el); 112 var range = cursors.Range.fromNode(el);
112 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); 113 var o = new Output().withSpeechAndBraille(range, null, 'navigate');
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 checkBrailleOutput( 229 checkBrailleOutput(
229 'play btn begin playback audio tlbar', 230 'play btn begin playback audio tlbar',
230 [{value: new Output.NodeSpan(el), start: 0, end: 23}, 231 [{value: new Output.NodeSpan(el), start: 0, end: 23},
231 {value: new Output.NodeSpan(el.parent), start: 24, end: 35}], 232 {value: new Output.NodeSpan(el.parent), start: 24, end: 35}],
232 o); 233 o);
233 234
234 el = el.nextSibling.nextSibling; 235 el = el.nextSibling.nextSibling;
235 var prevRange = range; 236 var prevRange = range;
236 range = cursors.Range.fromNode(el); 237 range = cursors.Range.fromNode(el);
237 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate'); 238 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate');
238 checkSpeechOutput('|0, , slider|audio time scrubber', 239 checkSpeechOutput('0|Min 0|Max 0||Slider|audio time scrubber',
239 [ 240 [
240 {value: new Output.EarconAction('SLIDER'), start: 0, end: 0}, 241 {value: 'valueForRange', start: 0, end: 1},
241 {value: 'description', start: 13, end: 32} 242 {value: 'name', start: 14, end: 14},
243 {value: new Output.EarconAction('SLIDER'), start: 14, end: 14},
244 {value: 'role', start: 15, end: 21},
245 {value: 'description', start: 22, end: 41}
242 ], 246 ],
243 o); 247 o);
244 // TODO(plundblad): Investigate this.
245 checkBrailleOutput( 248 checkBrailleOutput(
246 '0, , slider audio time scrubber', 249 '0 min:0 max:0 sldr audio time scrubber',
247 [{value: new Output.NodeSpan(el), start: 0, end: 31}], 250 [{value: new Output.NodeSpan(el), start: 0, end: 38}],
248 o); 251 o);
249 }); 252 });
250 }); 253 });
251 254
252 TEST_F('OutputE2ETest', 'Input', function() { 255 TEST_F('OutputE2ETest', 'Input', function() {
253 this.runWithLoadedTree( 256 this.runWithLoadedTree(
254 '<input type="text"></input>' + 257 '<input type="text"></input>' +
255 '<input type="email"></input>' + 258 '<input type="email"></input>' +
256 '<input type="password"></input>' + 259 '<input type="password"></input>' +
257 '<input type="tel"></input>' + 260 '<input type="tel"></input>' +
(...skipping 10 matching lines...) Expand all
268 {value: new Output.SelectionSpan(0, 0, 0), start: 1, end: 1}, 271 {value: new Output.SelectionSpan(0, 0, 0), start: 1, end: 1},
269 {value: 'value', start: 1, end: 1}, 272 {value: 'value', start: 1, end: 1},
270 {value: 'inputType', start: 2} 273 {value: 'inputType', start: 2}
271 ]; 274 ];
272 275
273 var expectedSpeechValues = [ 276 var expectedSpeechValues = [
274 '||Edit text', 277 '||Edit text',
275 '||Edit text, email entry', 278 '||Edit text, email entry',
276 '||Password edit text', 279 '||Password edit text',
277 '||Edit text numeric only', 280 '||Edit text numeric only',
278 ['||Spin button', 281 ['0|Min 0|Max 0||Spin button',
279 [{value: 'name', start: 0, end: 0}, 282 [{value: 'valueForRange', start: 0, end: 1},
280 {value: new Output.EarconAction('LISTBOX'), start: 0, end: 0}, 283 {value: 'name', start: 14, end: 14},
281 {value: {startIndex: 0, endIndex: 0}, start: 1, end: 1}, 284 {value: new Output.EarconAction('LISTBOX'), start: 14, end: 14},
282 {value: 'value', start: 1, end: 1}, 285 {value: 'role', start: 15, end: 26}]
283 {value: 'role', start: 2, end: 13}]
284 ], 286 ],
285 ['Time control', 287 ['Time control',
286 [{value: 'role', start: 0, end: 12}] 288 [{value: 'role', start: 0, end: 12}]
287 ], 289 ],
288 ['Date control', 290 ['Date control',
289 [{value: 'role', start: 0, end: 12}] 291 [{value: 'role', start: 0, end: 12}]
290 ], 292 ],
291 ['Choose File|No file chosen|Button', 293 ['Choose File|No file chosen|Button',
292 [{value: 'name', start: 0, end: 11}, 294 [{value: 'name', start: 0, end: 11},
293 {value: new Output.EarconAction("BUTTON"), start: 0, end: 11}, 295 {value: new Output.EarconAction("BUTTON"), start: 0, end: 11},
294 {value: 'value', start: 12, end: 26}, 296 {value: 'value', start: 12, end: 26},
295 {value: 'role', start: 27, end: 33}] 297 {value: 'role', start: 27, end: 33}]
296 ], 298 ],
297 '||Edit text, search entry', 299 '||Edit text, search entry',
298 '||Edit text' 300 '||Edit text'
299 ]; 301 ];
300 // TODO(plundblad): Some of these are wrong, there should be an initial 302 // TODO(plundblad): Some of these are wrong, there should be an initial
301 // space for the cursor in edit fields. 303 // space for the cursor in edit fields.
302 var expectedBrailleValues = [ 304 var expectedBrailleValues = [
303 ' ed', 305 ' ed',
304 ' @ed', 306 ' @ed',
305 ' pwded', 307 ' pwded',
306 ' #ed', 308 ' #ed',
307 ' spnbtn', 309 {string_: '0 min:0 max:0 spnbtn'},
308 {string_: 'time'}, 310 {string_: 'time'},
309 {string_: 'date'}, 311 {string_: 'date'},
310 {string_: 'Choose File No file chosen btn'}, 312 {string_: 'Choose File No file chosen btn'},
311 ' srched', 313 ' srched',
312 ' ed' 314 ' ed'
313 ]; 315 ];
314 assertEquals(expectedSpeechValues.length, expectedBrailleValues.length); 316 assertEquals(expectedSpeechValues.length, expectedBrailleValues.length);
315 317
316 var el = root.firstChild.firstChild; 318 var el = root.firstChild.firstChild;
317 expectedSpeechValues.forEach(function(expectedValue) { 319 expectedSpeechValues.forEach(function(expectedValue) {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 [ 707 [
706 {value: new Output.NodeSpan(text), start: 0, end: 4}, 708 {value: new Output.NodeSpan(text), start: 0, end: 4},
707 {value: new Output.NodeSpan(link), start: 5, end: 8}, 709 {value: new Output.NodeSpan(link), start: 5, end: 8},
708 {value: new Output.NodeSpan(listItem), start: 9, end: 15}, 710 {value: new Output.NodeSpan(listItem), start: 9, end: 15},
709 {value: new Output.NodeSpan(list), start: 16, end: 23} 711 {value: new Output.NodeSpan(list), start: 16, end: 23}
710 ], 712 ],
711 713
712 o); 714 o);
713 }); 715 });
714 }); 716 });
717
718 TEST_F('OutputE2ETest', 'RangeOutput', function() {
719 this.runWithLoadedTree(function(root) {/*!
720 <div role="slider" aria-valuemin="1" aria-valuemax="10" aria-valuenow="2"
721 aria-label="volume"></div>
722 <progress aria-valuemin="1" aria-valuemax="10"
723 aria-valuenow="2" aria-label="volume"></progress>
724 <meter aria-valuemin="1" aria-valuemax="10" aria-valuenow="2"
725 aria-label="volume"></meter>
726 <div role="spinbutton" aria-valuemin="1" aria-valuemax="10"
727 aria-valuenow="2" aria-label="volume"></div>
728 */}, function(root) {
729
730 var obj = root.find({role: RoleType.slider});
731 var o = new Output().withSpeech(cursors.Range.fromNode(obj));
732 checkSpeechOutput('2|Min 1|Max 10|volume|Slider',
733 [
734 {value: 'valueForRange', start: 0, end: 1},
735 {value: 'name', start: 15,end: 21},
736 {value: new Output.EarconAction('SLIDER'), start: 15, end: 21},
737 {value: 'role', start: 22, end: 28}
738 ],
739 o);
740
741 obj = root.find({role: RoleType.progressIndicator});
742 o = new Output().withSpeech(cursors.Range.fromNode(obj));
743 checkSpeechOutput('2|Min 1|Max 10|volume|Progress indicator',
744 [
745 {value: 'valueForRange', start: 0, end: 1},
746 {value: 'name', start: 15,end: 21},
747 {value: 'role', start: 22, end: 40}
748 ],
749 o);
750
751 obj = root.find({role: RoleType.meter});
752 o = new Output().withSpeech(cursors.Range.fromNode(obj));
753 checkSpeechOutput('2|Min 1|Max 10|volume|Meter',
754 [
755 {value: 'valueForRange', start: 0, end: 1},
756 {value: 'name', start: 15,end: 21},
757 {value: 'role', start: 22, end: 27}
758 ],
759 o);
760
761 obj = root.find({role: RoleType.spinButton});
762 o = new Output().withSpeech(cursors.Range.fromNode(obj));
763 checkSpeechOutput('2|Min 1|Max 10|volume|Spin button',
764 [
765 {value: 'valueForRange', start: 0, end: 1},
766 {value: 'name', start: 15,end: 21},
767 {value: new Output.EarconAction('LISTBOX'), start: 15, end: 21},
768 {value: 'role', start: 22, end: 33}
769 ],
770 o);
771 });
772 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698