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

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

Issue 2438893004: Revert of Make ChromeVox Next the default ChromeVox experience (Closed)
Patch Set: Created 4 years, 2 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 // 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 var para = root.firstChild; 318 var para = root.firstChild;
319 var webRange = new cursors.Range.fromNode(para); 319 var webRange = new cursors.Range.fromNode(para);
320 var auraRange = cursors.Range.fromNode(root.parent); 320 var auraRange = cursors.Range.fromNode(root.parent);
321 assertFalse(auraRange.isWebRange()); 321 assertFalse(auraRange.isWebRange());
322 assertTrue(webRange.isWebRange()); 322 assertTrue(webRange.isWebRange());
323 }); 323 });
324 }); 324 });
325 325
326 TEST_F('CursorsTest', 'SingleDocSelection', function() { 326 TEST_F('CursorsTest', 'SingleDocSelection', function() {
327 this.runWithLoadedTree(function() {/*! 327 this.runWithLoadedTree(function() {/*!
328 <span>start</span>
329 <p><a href="google.com">google home page</a></p> 328 <p><a href="google.com">google home page</a></p>
330 <p>some more text</p> 329 <p>some more text</p>
331 <p>end of text</p> 330 <p>end of text</p>
332 */}, 331 */},
333 function(root) { 332 function(root) {
334 var link = root.find({role: RoleType.link}); 333 var link = root.firstChild.firstChild;
335 var p1 = root.find({role: RoleType.paragraph}); 334 var p1 = root.firstChild.nextSibling;
336 var p2 = p1.nextSibling; 335 var p2 = p1.nextSibling;
337 336
338 var singleSel = new cursors.Range( 337 var singleSel = new cursors.Range(
339 new cursors.Cursor(link, 0), 338 new cursors.Cursor(link, 0),
340 new cursors.Cursor(link, 1)); 339 new cursors.Cursor(link, 1));
341 340
342 var multiSel = new cursors.Range( 341 var multiSel = new cursors.Range(
343 new cursors.Cursor(p1.firstChild, 2), 342 new cursors.Cursor(p1.firstChild, 2),
344 new cursors.Cursor(p2.firstChild, 4)); 343 new cursors.Cursor(p2.firstChild, 4));
345 344
346 function verifySel() { 345 function verifySel() {
347 if (root.anchorObject == link.firstChild) { 346 if (root.anchorObject == link.firstChild) {
348 assertEquals(link.firstChild, root.anchorObject); 347 assertEquals(link.firstChild, root.anchorObject);
349 assertEquals(0, root.anchorOffset); 348 assertEquals(0, root.anchorOffset);
350 assertEquals(link.firstChild, root.focusObject); 349 assertEquals(link.firstChild, root.focusObject);
351 assertEquals(1, root.focusOffset); 350 assertEquals(1, root.focusOffset);
352 this.listenOnce(root, 'textSelectionChanged', verifySel); 351 this.listenOnce(root, 'textSelectionChanged', verifySel);
353 multiSel.select(); 352 multiSel.select();
354 } else if (root.anchorObject == p1.firstChild) { 353 } else {
355 assertEquals(p1.firstChild, root.anchorObject); 354 assertEquals(p1.firstChild, root.anchorObject);
356 assertEquals(2, root.anchorOffset); 355 assertEquals(2, root.anchorOffset);
357 assertEquals(p2.firstChild, root.focusObject); 356 assertEquals(p2.firstChild, root.focusObject);
358 assertEquals(4, root.focusOffset); 357 assertEquals(4, root.focusOffset);
359 } 358 }
360 } 359 }
361 360
362 this.listenOnce(root, 'textSelectionChanged', verifySel, true); 361 this.listenOnce(root, 'textSelectionChanged', verifySel, true);
363 singleSel.select(); 362 singleSel.select();
364 }); 363 });
(...skipping 23 matching lines...) Expand all
388 assertEquals(0, cursor.selectionIndex_); 387 assertEquals(0, cursor.selectionIndex_);
389 388
390 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1); 389 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1);
391 assertEquals(root, cursor.selectionNode_); 390 assertEquals(root, cursor.selectionNode_);
392 assertEquals(1, cursor.selectionIndex_); 391 assertEquals(1, cursor.selectionIndex_);
393 }); 392 });
394 }); 393 });
395 394
396 TEST_F('CursorsTest', 'InlineElementOffset', function() { 395 TEST_F('CursorsTest', 'InlineElementOffset', function() {
397 this.runWithLoadedTree(function() {/*! 396 this.runWithLoadedTree(function() {/*!
398 <span>start</span>
399 <p>This<br> is a<a href="#g">test</a>of selection</p> 397 <p>This<br> is a<a href="#g">test</a>of selection</p>
400 */}, function(root) { 398 */}, function(root) {
401 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) { 399 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) {
402 // Test setup moves initial focus; ensure we don't test that here.
403 if (testNode != root.anchorObject)
404 return;
405
406 // This is a little unexpected though not really incorrect; Ctrl+C works. 400 // This is a little unexpected though not really incorrect; Ctrl+C works.
407 assertEquals(testNode, root.anchorObject); 401 assertEquals(testNode, root.anchorObject);
408 assertEquals(ofSelectionNode, root.focusObject); 402 assertEquals(ofSelectionNode, root.focusObject);
409 assertEquals(4, root.anchorOffset); 403 assertEquals(4, root.anchorOffset);
410 assertEquals(1, root.focusOffset); 404 assertEquals(1, root.focusOffset);
411 })); 405 }));
412 406
413 // This is the link's static text. 407 // This is the link's static text.
414 var testNode = root.lastChild.lastChild.previousSibling.firstChild; 408 var testNode = root.lastChild.lastChild.previousSibling.firstChild;
415 assertEquals(RoleType.staticText, testNode.role); 409 assertEquals(RoleType.staticText, testNode.role);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 449
456 // Negative cases. 450 // Negative cases.
457 assertFalse(rootRange.contentEquals(regionRange)); 451 assertFalse(rootRange.contentEquals(regionRange));
458 assertFalse(rootRange.contentEquals(staticTextRange)); 452 assertFalse(rootRange.contentEquals(staticTextRange));
459 assertFalse(rootRange.contentEquals(inlineTextBoxRange)); 453 assertFalse(rootRange.contentEquals(inlineTextBoxRange));
460 assertFalse(regionRange.contentEquals(rootRange)); 454 assertFalse(regionRange.contentEquals(rootRange));
461 assertFalse(staticTextRange.contentEquals(rootRange)); 455 assertFalse(staticTextRange.contentEquals(rootRange));
462 assertFalse(inlineTextBoxRange.contentEquals(rootRange)); 456 assertFalse(inlineTextBoxRange.contentEquals(rootRange));
463 }); 457 });
464 }); 458 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698