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

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

Issue 2559343002: Allow tree walker to escape roots (Closed)
Patch Set: Update the test. Created 4 years 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
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 GEN_INCLUDE(['../../testing/snippets.js']); 8 GEN_INCLUDE(['../../testing/snippets.js']);
9 9
10 /** 10 /**
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 var leafP = function(n) { return n.name == '3' || n.name == '5'; }; 119 var leafP = function(n) { return n.name == '3' || n.name == '5'; };
120 var rootP = function(n) { return n.name == '2'; }; 120 var rootP = function(n) { return n.name == '2'; };
121 121
122 // Track the nodes we've visited. 122 // Track the nodes we've visited.
123 var visited = ''; 123 var visited = '';
124 var visit = function(n) { visited += n.name; }; 124 var visit = function(n) { visited += n.name; };
125 var restrictions = {leaf: leafP, root: rootP, visit: visit}; 125 var restrictions = {leaf: leafP, root: rootP, visit: visit};
126 var walker = new AutomationTreeWalker(node2, 'forward', restrictions); 126 var walker = new AutomationTreeWalker(node2, 'forward', restrictions);
127 while (walker.next().node) {} 127 while (walker.next().node) {}
128 assertEquals('35', visited); 128 assertEquals('35', visited);
129 assertEquals(AutomationTreeWalkerPhase.OTHER, walker.phase);
129 130
130 // And the reverse. 131 // And the reverse.
131 // Note that walking into a root is allowed. 132 // Note that walking into a root is allowed.
132 visited = ''; 133 visited = '';
133 var node6 = r.lastChild.lastChild; 134 var node6 = r.lastChild.lastChild;
134 assertEquals('6', node6.name); 135 assertEquals('6', node6.name);
135 walker = new AutomationTreeWalker(node6, 'backward', restrictions); 136 walker = new AutomationTreeWalker(node6, 'backward', restrictions);
136 while (walker.next().node) {} 137 while (walker.next().node) {}
137 assertEquals('532', visited); 138 assertEquals('532', visited);
138 139
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 {root: function(node) { return node === r; }}); 191 {root: function(node) { return node === r; }});
191 assertEquals(r, backwardWalker.next().node); 192 assertEquals(r, backwardWalker.next().node);
192 assertEquals(null, backwardWalker.next().node); 193 assertEquals(null, backwardWalker.next().node);
193 194
194 var forwardWalker = 195 var forwardWalker =
195 new AutomationTreeWalker(r.firstChild.lastChild, 'forward', 196 new AutomationTreeWalker(r.firstChild.lastChild, 'forward',
196 {root: function(node) { return node === r; }}); 197 {root: function(node) { return node === r; }});
197 assertEquals(null, forwardWalker.next().node); 198 assertEquals(null, forwardWalker.next().node);
198 }); 199 });
199 }); 200 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698