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

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

Issue 2333533003: Add a |contentEquals| method to cursors and ranges. (Closed)
Patch Set: Add a |contentEquals| method to cursors and ranges. Created 4 years, 3 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 var curIntoO = new cursors.Cursor(ofSelectionNode, 1); 420 var curIntoO = new cursors.Cursor(ofSelectionNode, 1);
421 assertEquals('of selection', curIntoO.selectionNode_.name); 421 assertEquals('of selection', curIntoO.selectionNode_.name);
422 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role); 422 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role);
423 assertEquals(1, curIntoO.selectionIndex_); 423 assertEquals(1, curIntoO.selectionIndex_);
424 424
425 var oRange = new cursors.Range(cur, curIntoO); 425 var oRange = new cursors.Range(cur, curIntoO);
426 oRange.select(); 426 oRange.select();
427 }); 427 });
428 }); 428 });
429
430 TEST_F('CursorsTest', 'ContentEquality', function() {
431 this.runWithLoadedTree(function() {/*!
432 <div role="region">this is a test</button>
433 */}, function(root) {
434 var region = root.firstChild;
435 assertEquals(RoleType.region, region.role);
436 var staticText = region.firstChild;
437 assertEquals(RoleType.staticText, staticText.role);
438 var inlineTextBox = staticText.firstChild;
439 assertEquals(RoleType.inlineTextBox, inlineTextBox.role);
440
441 var rootRange = cursors.Range.fromNode(root);
442 var regionRange = cursors.Range.fromNode(region);
443 var staticTextRange = cursors.Range.fromNode(staticText);
444 var inlineTextBoxRange = cursors.Range.fromNode(inlineTextBox);
445
446 // Positive cases.
447 assertTrue(regionRange.contentEquals(staticTextRange));
448 assertTrue(staticTextRange.contentEquals(regionRange));
449 assertTrue(inlineTextBoxRange.contentEquals(staticTextRange));
450 assertTrue(staticTextRange.contentEquals(inlineTextBoxRange));
451
452 // Negative cases.
453 assertFalse(rootRange.contentEquals(regionRange));
454 assertFalse(rootRange.contentEquals(staticTextRange));
455 assertFalse(rootRange.contentEquals(inlineTextBoxRange));
456 assertFalse(regionRange.contentEquals(rootRange));
457 assertFalse(staticTextRange.contentEquals(rootRange));
458 assertFalse(inlineTextBoxRange.contentEquals(rootRange));
459 });
460 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698