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

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

Issue 1435113003: Make use of new AX name calc in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue with ariaTextAlternative Created 5 years, 1 month 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 ]}, o.speechOutputForTest); 171 ]}, o.speechOutputForTest);
172 checkBrailleOutput( 172 checkBrailleOutput(
173 'h' + i + ' ' + letter, 173 'h' + i + ' ' + letter,
174 [{value: new Output.NodeSpan(el), start: 0, end: 4}], 174 [{value: new Output.NodeSpan(el), start: 0, end: 4}],
175 o); 175 o);
176 el = el.nextSibling; 176 el = el.nextSibling;
177 } 177 }
178 178
179 range = cursors.Range.fromNode(el); 179 range = cursors.Range.fromNode(el);
180 o = new Output().withSpeechAndBraille(range, null, 'navigate'); 180 o = new Output().withSpeechAndBraille(range, null, 'navigate');
181 assertEqualsJSON({string_: 'Heading 1|b|Link', 'spans_': [ 181 assertEqualsJSON({string_: 'Heading 1|b', 'spans_': [
182 // Link. 182 {value: 'nameOrDescendants', start: 10, end: 11}
183 {value: 'name', start: 10, end: 11},
184 {value: {earconId: "LINK"}, start: 10, end: 11},
185 {value: 'role', start: 12, end: 16}
186 ]}, o.speechOutputForTest); 183 ]}, o.speechOutputForTest);
187 checkBrailleOutput( 184 checkBrailleOutput(
188 'h1 b lnk', 185 'h1 b',
189 [{value: new Output.NodeSpan(el), start: 0, end: 2}, 186 [{value: new Output.NodeSpan(el), start: 0, end: 4}],
190 {value: new Output.NodeSpan(el.firstChild), start: 3, end: 8}],
191 o); 187 o);
192 }); 188 });
193 }); 189 });
194 190
195 TEST_F('OutputE2ETest', 'Audio', function() { 191 TEST_F('OutputE2ETest', 'Audio', function() {
196 this.runWithLoadedTree('<audio src="foo.mp3" controls></audio>', 192 this.runWithLoadedTree('<audio src="foo.mp3" controls></audio>',
197 function(root) { 193 function(root) {
198 var el = root.firstChild.firstChild.firstChild.firstChild; 194 var el = root.firstChild.firstChild.firstChild.firstChild;
199 var range = cursors.Range.fromNode(el); 195 var range = cursors.Range.fromNode(el);
200 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); 196 var o = new Output().withSpeechAndBraille(range, null, 'navigate');
201 assertEqualsJSON( 197 assertEqualsJSON(
202 {string_: 'audio|Tool bar|play||begin playback|Button', 198 {string_: 'audio|Tool bar|audio|play||Button|begin playback',
203 spans_: 199 spans_:
204 // Entered container toolbar. 200 // Entered container toolbar.
205 201
206 // Button. 202 // Button.
207 [{value: 'name', start: 15, end: 19}, 203 [{value: 'name', start: 21, end: 25},
208 204
209 // Button earcon. 205 // Button earcon.
210 {value: {earconId: "BUTTON"}, start: 15, end: 19}, 206 {value: {earconId: "BUTTON"}, start: 21, end: 25},
211 207
212 {value: 'value', start: 20, end: 20}, 208 {value: 'value', start: 26, end: 26},
213 {value: 'help', start: 21, end: 35}, 209 {value: 'role', start: 27, end: 33},
214 {value: 'role', start: 36, end: 42}] 210 {value: 'description', start: 34, end: 48}],
215 }, o.speechOutputForTest); 211 }, o.speechOutputForTest);
216 checkBrailleOutput( 212 checkBrailleOutput(
217 'audio tlbar play begin playback btn', 213 'audio tlbar audio play btn begin playback',
218 [{value: new Output.NodeSpan(el.parent), start: 0, end: 11}, 214 [{value: new Output.NodeSpan(el.parent), start: 0, end: 17},
219 {value: new Output.NodeSpan(el), start: 12, end: 35}], 215 {value: new Output.NodeSpan(el), start: 18, end: 41}],
220 o); 216 o);
221 217
222 el = el.nextSibling; 218 el = el.nextSibling;
223 var prevRange = range; 219 var prevRange = range;
224 range = cursors.Range.fromNode(el); 220 range = cursors.Range.fromNode(el);
225 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate'); 221 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate');
226 assertEqualsJSON({string_: '|0, , slider|audio time scrubber', 222 assertEqualsJSON({string_: '|0, , slider|audio time scrubber',
227 spans_: 223 spans_:
228 [{value: {'earconId': 'SLIDER'}, start: 0, end: 0}, 224 [{value: {'earconId': 'SLIDER'}, start: 0, end: 0},
229 {value: 'help', start: 13, end: 32}] 225 {value: 'description', start: 13, end: 32}]
230 }, o.speechOutputForTest); 226 }, o.speechOutputForTest);
231 // TODO(plundblad): Investigate this. 227 // TODO(plundblad): Investigate this.
232 checkBrailleOutput( 228 checkBrailleOutput(
233 '0, , slider audio time scrubber', 229 '0, , slider audio time scrubber',
234 [{value: new Output.NodeSpan(el), start: 0, end: 31}], 230 [{value: new Output.NodeSpan(el), start: 0, end: 31}],
235 o); 231 o);
236 }); 232 });
237 }); 233 });
238 234
239 TEST_F('OutputE2ETest', 'Input', function() { 235 TEST_F('OutputE2ETest', 'Input', function() {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 this.runWithLoadedTree(function() {/*! 465 this.runWithLoadedTree(function() {/*!
470 <select multiple> 466 <select multiple>
471 <option>1</option> 467 <option>1</option>
472 <option>2</option> 468 <option>2</option>
473 </select> 469 </select>
474 */}, 470 */},
475 function(root) { 471 function(root) {
476 var el = root.firstChild.firstChild.firstChild; 472 var el = root.firstChild.firstChild.firstChild;
477 var range = cursors.Range.fromNode(el); 473 var range = cursors.Range.fromNode(el);
478 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); 474 var o = new Output().withSpeechAndBraille(range, null, 'navigate');
479 assertEqualsJSON({string_: '|List box|with 2 items||List item| 1 of 2 ', 475 assertEqualsJSON({string_: '|List box|with 2 items|1|List item| 1 of 2 ',
480 spans_: [ 476 spans_: [
481 // ListBox. 477 // ListBox.
482 // Earcon. 478 // Earcon.
483 {value: {earconId:'LISTBOX'}, start: 0, end: 0}, 479 {value: {earconId:'LISTBOX'}, start: 0, end: 0},
484 480
485 {value: 'name', start: 23, end: 23}, 481 {value: 'name', start: 23, end: 24},
486 482
487 // Earcon. 483 // Earcon.
488 {value: {earconId: 'LIST_ITEM'}, start: 23, end: 23}, 484 {value: {earconId: 'LIST_ITEM'}, start: 23, end: 24},
489 485
490 {value: 'role', start:24, end: 33} 486 {value: 'role', start:25, end: 34}
491 ]}, o.speechOutputForTest); 487 ]}, o.speechOutputForTest);
492 checkBrailleOutput( 488 checkBrailleOutput(
493 'lstbx +2 lstitm 1/2', 489 'lstbx +2 1 lstitm 1/2',
494 [{value: new Output.NodeSpan(el.parent), start: 0, end: 8}, 490 [{value: new Output.NodeSpan(el.parent), start: 0, end: 8},
495 {value: new Output.NodeSpan(el), start: 9, end: 19}], 491 {value: new Output.NodeSpan(el), start: 9, end: 21}],
496 o); 492 o);
497 }); 493 });
498 }); 494 });
499 495
500 SYNC_TEST_F('OutputE2ETest', 'MessageIdAndEarconValidity', function() { 496 SYNC_TEST_F('OutputE2ETest', 'MessageIdAndEarconValidity', function() {
501 for (var key in Output.ROLE_INFO_) { 497 for (var key in Output.ROLE_INFO_) {
502 var value = Output.ROLE_INFO_[key]; 498 var value = Output.ROLE_INFO_[key];
503 Msgs.getMsg(value.msgId); 499 Msgs.getMsg(value.msgId);
504 Msgs.getMsg(value.msgId + '_brl'); 500 Msgs.getMsg(value.msgId + '_brl');
505 assertFalse(/[A-Z]+/.test(value.msgId)); 501 assertFalse(/[A-Z]+/.test(value.msgId));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 assertEqualsJSON({string_: '|that has content', 534 assertEqualsJSON({string_: '|that has content',
539 spans_: [ 535 spans_: [
540 {value: 'name', start: 1, end: 17} 536 {value: 'name', start: 1, end: 17}
541 ]}, o.speechOutputForTest); 537 ]}, o.speechOutputForTest);
542 checkBrailleOutput( 538 checkBrailleOutput(
543 'that has content', 539 'that has content',
544 [{value: new Output.NodeSpan(el), start: 0, end: 16}], 540 [{value: new Output.NodeSpan(el), start: 0, end: 16}],
545 o); 541 o);
546 }); 542 });
547 }); 543 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698