OLD | NEW |
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 GEN_INCLUDE(['../../testing/snippets.js']); | 8 GEN_INCLUDE(['../../testing/snippets.js']); |
9 | 9 |
10 /** | 10 /** |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 }.bind(this)); | 116 }.bind(this)); |
117 }); | 117 }); |
118 | 118 |
119 TEST_F('AutomationUtilE2ETest', 'GetDirection', function() { | 119 TEST_F('AutomationUtilE2ETest', 'GetDirection', function() { |
120 this.runWithLoadedTree(this.basicDoc, function(root) { | 120 this.runWithLoadedTree(this.basicDoc, function(root) { |
121 var left = root, right = root; | 121 var left = root, right = root; |
122 | 122 |
123 // Same node. | 123 // Same node. |
124 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right)); | 124 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right)); |
125 | 125 |
126 // Ancestor. | 126 // Ancestry. |
127 left = left.firstChild; | 127 left = left.firstChild; |
128 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right)); | 128 // Upward movement is backward (in dfs). |
| 129 assertEquals(Dir.BACKWARD, AutomationUtil.getDirection(left, right)); |
| 130 // Downward movement is forward. |
129 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(right, left)); | 131 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(right, left)); |
130 | 132 |
131 // Ordered. | 133 // Ordered. |
132 right = right.lastChild; | 134 right = right.lastChild; |
133 assertEquals(Dir.BACKWARD, AutomationUtil.getDirection(right, left)); | 135 assertEquals(Dir.BACKWARD, AutomationUtil.getDirection(right, left)); |
134 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right)); | 136 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right)); |
135 }); | 137 }); |
136 }); | 138 }); |
137 | 139 |
138 TEST_F('AutomationUtilE2ETest', 'IsInSameWebpage', function() { | 140 TEST_F('AutomationUtilE2ETest', 'IsInSameWebpage', function() { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 assertEquals(h1, AutomationUtil.hitTest(r, getCP(h1.parent))); | 226 assertEquals(h1, AutomationUtil.hitTest(r, getCP(h1.parent))); |
225 assertEquals(h1.parent.parent, | 227 assertEquals(h1.parent.parent, |
226 AutomationUtil.hitTest(r, getCP(h1.parent.parent))); | 228 AutomationUtil.hitTest(r, getCP(h1.parent.parent))); |
227 | 229 |
228 assertEquals(a, AutomationUtil.hitTest(r, getCP(a))); | 230 assertEquals(a, AutomationUtil.hitTest(r, getCP(a))); |
229 assertEquals(a, AutomationUtil.hitTest(r, getCP(a.parent))); | 231 assertEquals(a, AutomationUtil.hitTest(r, getCP(a.parent))); |
230 assertEquals(a.parent.parent, | 232 assertEquals(a.parent.parent, |
231 AutomationUtil.hitTest(r, getCP(a.parent.parent))); | 233 AutomationUtil.hitTest(r, getCP(a.parent.parent))); |
232 }); | 234 }); |
233 }); | 235 }); |
OLD | NEW |