Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs |
index 584fd8064f4b9b8fb76800bfd535feb36242c5e0..ff176e1acaca7365033a4489d1e084a17a96b8f4 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs |
@@ -325,13 +325,14 @@ TEST_F('CursorsTest', 'IsInWebRange', function() { |
TEST_F('CursorsTest', 'SingleDocSelection', function() { |
this.runWithLoadedTree(function() {/*! |
+ <span>start</span> |
<p><a href="google.com">google home page</a></p> |
<p>some more text</p> |
<p>end of text</p> |
*/}, |
function(root) { |
- var link = root.firstChild.firstChild; |
- var p1 = root.firstChild.nextSibling; |
+ var link = root.find({role: RoleType.link}); |
+ var p1 = root.find({role: RoleType.paragraph}); |
var p2 = p1.nextSibling; |
var singleSel = new cursors.Range( |
@@ -350,7 +351,7 @@ TEST_F('CursorsTest', 'SingleDocSelection', function() { |
assertEquals(1, root.focusOffset); |
this.listenOnce(root, 'textSelectionChanged', verifySel); |
multiSel.select(); |
- } else { |
+ } else if (root.anchorObject == p1.firstChild) { |
assertEquals(p1.firstChild, root.anchorObject); |
assertEquals(2, root.anchorOffset); |
assertEquals(p2.firstChild, root.focusObject); |
@@ -394,9 +395,14 @@ TEST_F('CursorsTest', 'MultiLineOffsetSelection', function() { |
TEST_F('CursorsTest', 'InlineElementOffset', function() { |
this.runWithLoadedTree(function() {/*! |
+ <span>start</span> |
<p>This<br> is a<a href="#g">test</a>of selection</p> |
*/}, function(root) { |
root.addEventListener('textSelectionChanged', this.newCallback(function(evt) { |
+ // Test setup moves initial focus; ensure we don't test that here. |
+ if (testNode != root.anchorObject) |
+ return; |
+ |
// This is a little unexpected though not really incorrect; Ctrl+C works. |
assertEquals(testNode, root.anchorObject); |
assertEquals(ofSelectionNode, root.focusObject); |