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

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

Issue 2649373002: Re-land: Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Fix presubmit 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 // 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 }); 324 });
325 325
326 TEST_F('CursorsTest', 'DISABLED_SingleDocSelection', function() { 326 TEST_F('CursorsTest', 'DISABLED_SingleDocSelection', function() {
327 this.runWithLoadedTree(function() {/*! 327 this.runWithLoadedTree(function() {/*!
328 <span>start</span> 328 <span>start</span>
329 <p><a href="google.com">google home page</a></p> 329 <p><a href="google.com">google home page</a></p>
330 <p>some more text</p> 330 <p>some more text</p>
331 <p>end of text</p> 331 <p>end of text</p>
332 */}, 332 */},
333 function(root) { 333 function(root) {
334 var link = root.find({role: RoleType.link}); 334 var link = root.find({role: RoleType.LINK});
335 var p1 = root.find({role: RoleType.paragraph}); 335 var p1 = root.find({role: RoleType.PARAGRAPH});
336 var p2 = p1.nextSibling; 336 var p2 = p1.nextSibling;
337 337
338 var singleSel = new cursors.Range( 338 var singleSel = new cursors.Range(
339 new cursors.Cursor(link, 0), 339 new cursors.Cursor(link, 0),
340 new cursors.Cursor(link, 1)); 340 new cursors.Cursor(link, 1));
341 341
342 var multiSel = new cursors.Range( 342 var multiSel = new cursors.Range(
343 new cursors.Cursor(p1.firstChild, 2), 343 new cursors.Cursor(p1.firstChild, 2),
344 new cursors.Cursor(p2.firstChild, 4)); 344 new cursors.Cursor(p2.firstChild, 4));
345 345
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 // This is a little unexpected though not really incorrect; Ctrl+C works. 406 // This is a little unexpected though not really incorrect; Ctrl+C works.
407 assertEquals(testNode, root.anchorObject); 407 assertEquals(testNode, root.anchorObject);
408 assertEquals(ofSelectionNode, root.focusObject); 408 assertEquals(ofSelectionNode, root.focusObject);
409 assertEquals(4, root.anchorOffset); 409 assertEquals(4, root.anchorOffset);
410 assertEquals(1, root.focusOffset); 410 assertEquals(1, root.focusOffset);
411 })); 411 }));
412 412
413 // This is the link's static text. 413 // This is the link's static text.
414 var testNode = root.lastChild.lastChild.previousSibling.firstChild; 414 var testNode = root.lastChild.lastChild.previousSibling.firstChild;
415 assertEquals(RoleType.staticText, testNode.role); 415 assertEquals(RoleType.STATIC_TEXT, testNode.role);
416 assertEquals('test', testNode.name); 416 assertEquals('test', testNode.name);
417 417
418 var ofSelectionNode = root.lastChild.lastChild; 418 var ofSelectionNode = root.lastChild.lastChild;
419 var cur = new cursors.Cursor(ofSelectionNode, 0); 419 var cur = new cursors.Cursor(ofSelectionNode, 0);
420 assertEquals('of selection', cur.selectionNode_.name); 420 assertEquals('of selection', cur.selectionNode_.name);
421 assertEquals(RoleType.staticText, cur.selectionNode_.role); 421 assertEquals(RoleType.STATIC_TEXT, cur.selectionNode_.role);
422 assertEquals(0, cur.selectionIndex_); 422 assertEquals(0, cur.selectionIndex_);
423 423
424 var curIntoO = new cursors.Cursor(ofSelectionNode, 1); 424 var curIntoO = new cursors.Cursor(ofSelectionNode, 1);
425 assertEquals('of selection', curIntoO.selectionNode_.name); 425 assertEquals('of selection', curIntoO.selectionNode_.name);
426 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role); 426 assertEquals(RoleType.STATIC_TEXT, curIntoO.selectionNode_.role);
427 assertEquals(1, curIntoO.selectionIndex_); 427 assertEquals(1, curIntoO.selectionIndex_);
428 428
429 var oRange = new cursors.Range(cur, curIntoO); 429 var oRange = new cursors.Range(cur, curIntoO);
430 oRange.select(); 430 oRange.select();
431 }); 431 });
432 }); 432 });
433 433
434 TEST_F('CursorsTest', 'ContentEquality', function() { 434 TEST_F('CursorsTest', 'ContentEquality', function() {
435 this.runWithLoadedTree(function() {/*! 435 this.runWithLoadedTree(function() {/*!
436 <div role="region">this is a test</button> 436 <div role="region">this is a test</button>
437 */}, function(root) { 437 */}, function(root) {
438 var region = root.firstChild; 438 var region = root.firstChild;
439 assertEquals(RoleType.region, region.role); 439 assertEquals(RoleType.REGION, region.role);
440 var staticText = region.firstChild; 440 var staticText = region.firstChild;
441 assertEquals(RoleType.staticText, staticText.role); 441 assertEquals(RoleType.STATIC_TEXT, staticText.role);
442 var inlineTextBox = staticText.firstChild; 442 var inlineTextBox = staticText.firstChild;
443 assertEquals(RoleType.inlineTextBox, inlineTextBox.role); 443 assertEquals(RoleType.INLINE_TEXT_BOX, inlineTextBox.role);
444 444
445 var rootRange = cursors.Range.fromNode(root); 445 var rootRange = cursors.Range.fromNode(root);
446 var regionRange = cursors.Range.fromNode(region); 446 var regionRange = cursors.Range.fromNode(region);
447 var staticTextRange = cursors.Range.fromNode(staticText); 447 var staticTextRange = cursors.Range.fromNode(staticText);
448 var inlineTextBoxRange = cursors.Range.fromNode(inlineTextBox); 448 var inlineTextBoxRange = cursors.Range.fromNode(inlineTextBox);
449 449
450 // Positive cases. 450 // Positive cases.
451 assertTrue(regionRange.contentEquals(staticTextRange)); 451 assertTrue(regionRange.contentEquals(staticTextRange));
452 assertTrue(staticTextRange.contentEquals(regionRange)); 452 assertTrue(staticTextRange.contentEquals(regionRange));
453 assertTrue(inlineTextBoxRange.contentEquals(staticTextRange)); 453 assertTrue(inlineTextBoxRange.contentEquals(staticTextRange));
454 assertTrue(staticTextRange.contentEquals(inlineTextBoxRange)); 454 assertTrue(staticTextRange.contentEquals(inlineTextBoxRange));
455 455
456 // Negative cases. 456 // Negative cases.
457 assertFalse(rootRange.contentEquals(regionRange)); 457 assertFalse(rootRange.contentEquals(regionRange));
458 assertFalse(rootRange.contentEquals(staticTextRange)); 458 assertFalse(rootRange.contentEquals(staticTextRange));
459 assertFalse(rootRange.contentEquals(inlineTextBoxRange)); 459 assertFalse(rootRange.contentEquals(inlineTextBoxRange));
460 assertFalse(regionRange.contentEquals(rootRange)); 460 assertFalse(regionRange.contentEquals(rootRange));
461 assertFalse(staticTextRange.contentEquals(rootRange)); 461 assertFalse(staticTextRange.contentEquals(rootRange));
462 assertFalse(inlineTextBoxRange.contentEquals(rootRange)); 462 assertFalse(inlineTextBoxRange.contentEquals(rootRange));
463 }); 463 });
464 }); 464 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698