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

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

Issue 1457683009: Complete live region support in ChromeVox Next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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 automation_util.js. 9 * Test fixture for automation_util.js.
10 * @constructor 10 * @constructor
11 * @extends {ChromeVoxE2ETestBase} 11 * @extends {ChromeVoxE2ETestBase}
12 */ 12 */
13 function AutomationUtilE2ETest() { 13 function AutomationUtilE2ETest() {
14 ChromeVoxNextE2ETest.call(this); 14 ChromeVoxNextE2ETest.call(this);
15 } 15 }
16 16
17 AutomationUtilE2ETest.prototype = { 17 AutomationUtilE2ETest.prototype = {
18 __proto__: ChromeVoxNextE2ETest.prototype, 18 __proto__: ChromeVoxNextE2ETest.prototype,
19 19
20 /** @override */ 20 /** @override */
21 setUp: function() { 21 setUp: function() {
22 window.Dir = AutomationUtil.Dir; 22 window.Dir = AutomationUtil.Dir;
23 }, 23 },
24 24
25 basicDoc: function() {/*! 25 basicDoc: function() {/*!
26 <p><a href='#'></a>hello</p> 26 <p><a href='#'></a>hello</p>
27 <h1><ul><li>a</ul><button></h1> 27 <h1><ul><li>a</ul><button></h1>
28 */},
29
30 secondDoc: function() {/*!
31 <html><head><title>Second doc</title></head><body>Second</body></html>
28 */} 32 */}
29 }; 33 };
30 34
31 TEST_F('AutomationUtilE2ETest', 'GetAncestors', function() { 35 TEST_F('AutomationUtilE2ETest', 'GetAncestors', function() {
32 this.runWithLoadedTree(this.basicDoc, function(root) { 36 this.runWithLoadedTree(this.basicDoc, function(root) {
33 var expectedLength = 1; 37 var expectedLength = 1;
34 while (root) { 38 while (root) {
35 var ancestors = AutomationUtil.getAncestors(root); 39 var ancestors = AutomationUtil.getAncestors(root);
36 assertEquals(expectedLength++, ancestors.length); 40 assertEquals(expectedLength++, ancestors.length);
37 root = root.firstChild; 41 root = root.firstChild;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right)); 97 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right));
94 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(right, left)); 98 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(right, left));
95 99
96 // Ordered. 100 // Ordered.
97 right = right.lastChild; 101 right = right.lastChild;
98 assertEquals(Dir.BACKWARD, AutomationUtil.getDirection(right, left)); 102 assertEquals(Dir.BACKWARD, AutomationUtil.getDirection(right, left));
99 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right)); 103 assertEquals(Dir.FORWARD, AutomationUtil.getDirection(left, right));
100 104
101 }); 105 });
102 }); 106 });
107
108 TEST_F('AutomationUtilE2ETest', 'IsInSameWebpage', function() {
109 this.runWithLoadedTree(this.basicDoc, function(root) {
110 this.runWithLoadedTree(this.secondDoc, function(root2) {
111 assertTrue(AutomationUtil.isInSameWebpage(root, root));
112 assertTrue(AutomationUtil.isInSameWebpage(root.firstChild, root));
113 assertTrue(AutomationUtil.isInSameWebpage(root, root.firstChild));
114
115 assertTrue(AutomationUtil.isInSameWebpage(root2, root2));
116 assertTrue(AutomationUtil.isInSameWebpage(root2.firstChild, root2));
117 assertTrue(AutomationUtil.isInSameWebpage(root2, root2.firstChild));
118
119 assertFalse(AutomationUtil.isInSameWebpage(root, root2));
120 assertFalse(AutomationUtil.isInSameWebpage(root.firstChild, root2));
121 assertFalse(AutomationUtil.isInSameWebpage(root2.firstChild));
122 assertFalse(AutomationUtil.isInSameWebpage(
123 root.firstChild, root2.firstChild));
124 });
125 });
Peter Lundblad 2015/11/24 11:04:30 Could test with one node being in the desktop tree
dmazzoni 2015/11/30 22:00:46 All good ideas. I think it was worth adding a test
126 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698