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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_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 // Include test fixture. 5 // Include test fixture.
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 * Test fixture for cvox2.cursors. 9 * Test fixture for cvox2.cursors.
10 * @constructor 10 * @constructor
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 /** 82 /**
83 * Makes assertions about the given |cursor|. 83 * Makes assertions about the given |cursor|.
84 * @param {Object} expected 84 * @param {Object} expected
85 * @param {Cursor} cursor 85 * @param {Cursor} cursor
86 */ 86 */
87 makeCursorAssertion: function(expected, cursor) { 87 makeCursorAssertion: function(expected, cursor) {
88 if (goog.isDef(expected.index)) 88 if (goog.isDef(expected.index))
89 assertEquals(expected.index, cursor.index); 89 assertEquals(expected.index, cursor.index);
90 if (goog.isDef(expected.value)) 90 if (goog.isDef(expected.value))
91 assertEquals(expected.value, cursor.node.value); 91 assertEquals(expected.value, cursor.node.name);
92 }, 92 },
93 93
94 /** 94 /**
95 * Runs the specified moves on the |doc| and asserts expectations. 95 * Runs the specified moves on the |doc| and asserts expectations.
96 * @param {function} doc 96 * @param {function} doc
97 * @param {string=} opt_testType Either CURSOR or RANGE. 97 * @param {string=} opt_testType Either CURSOR or RANGE.
98 */ 98 */
99 runCursorMovesOnDocument: function(doc, moves, opt_testType) { 99 runCursorMovesOnDocument: function(doc, moves, opt_testType) {
100 this.runWithLoadedTree(doc, 100 this.runWithLoadedTree(doc,
101 function(root) { 101 function(root) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 ], this.RANGE); 273 ], this.RANGE);
274 }); 274 });
275 275
276 TEST_F('CursorsTest', 'DontSplitOnNodeNavigation', function() { 276 TEST_F('CursorsTest', 'DontSplitOnNodeNavigation', function() {
277 this.runWithLoadedTree(this.multiInlineDoc, function(root) { 277 this.runWithLoadedTree(this.multiInlineDoc, function(root) {
278 var para = root.firstChild; 278 var para = root.firstChild;
279 assertEquals('paragraph', para.role); 279 assertEquals('paragraph', para.role);
280 var cursor = new cursors.Cursor(para, 0); 280 var cursor = new cursors.Cursor(para, 0);
281 cursor = cursor.move(DOM_NODE, DIRECTIONAL, FORWARD); 281 cursor = cursor.move(DOM_NODE, DIRECTIONAL, FORWARD);
282 assertEquals('staticText', cursor.node.role); 282 assertEquals('staticText', cursor.node.role);
283 assertEquals('end', cursor.node.value); 283 assertEquals('end', cursor.node.name);
284 284
285 cursor = cursor.move(DOM_NODE, DIRECTIONAL, BACKWARD); 285 cursor = cursor.move(DOM_NODE, DIRECTIONAL, BACKWARD);
286 assertEquals('staticText', cursor.node.role); 286 assertEquals('staticText', cursor.node.role);
287 assertEquals('start diff line', cursor.node.value); 287 assertEquals('start diff line', cursor.node.name);
288 288
289 assertEquals('inlineTextBox', cursor.node.firstChild.role); 289 assertEquals('inlineTextBox', cursor.node.firstChild.role);
290 assertEquals('start ', cursor.node.firstChild.value); 290 assertEquals('start ', cursor.node.firstChild.name);
291 assertEquals('diff ', cursor.node.firstChild.nextSibling.value); 291 assertEquals('diff ', cursor.node.firstChild.nextSibling.name);
292 assertEquals('line', cursor.node.lastChild.value); 292 assertEquals('line', cursor.node.lastChild.name);
293 }); 293 });
294 }); 294 });
295 295
296 TEST_F('CursorsTest', 'WrappingCursors', function() { 296 TEST_F('CursorsTest', 'WrappingCursors', function() {
297 this.runWithLoadedTree(this.multiInlineDoc, function(root) { 297 this.runWithLoadedTree(this.multiInlineDoc, function(root) {
298 var para = root.firstChild; 298 var para = root.firstChild;
299 var cursor = new cursors.WrappingCursor(para, -1); 299 var cursor = new cursors.WrappingCursor(para, -1);
300 cursor = cursor.move(DOM_NODE, DIRECTIONAL, BACKWARD); 300 cursor = cursor.move(DOM_NODE, DIRECTIONAL, BACKWARD);
301 assertEquals(root.lastChild.firstChild, cursor.node); 301 assertEquals(root.lastChild.firstChild, cursor.node);
302 cursor = cursor.move(DOM_NODE, DIRECTIONAL, FORWARD); 302 cursor = cursor.move(DOM_NODE, DIRECTIONAL, FORWARD);
303 assertEquals(root.firstChild.firstChild, cursor.node); 303 assertEquals(root.firstChild.firstChild, cursor.node);
304 }); 304 });
305 }); 305 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698