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

Unified Diff: chrome/browser/resources/chromeos/switch_access/tree_walker_unittest.gtestjs

Issue 2818503002: Improved isInteresting heuristic, made more AutomationNodes focusable (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/switch_access/tree_walker_unittest.gtestjs
diff --git a/chrome/browser/resources/chromeos/switch_access/tree_walker_unittest.gtestjs b/chrome/browser/resources/chromeos/switch_access/tree_walker_unittest.gtestjs
index 52782ee3e5b63e7e9e4c0f22b842885bea85e4e1..74d210b4044b4fb43149abd2c9ce10d76f98c71d 100644
--- a/chrome/browser/resources/chromeos/switch_access/tree_walker_unittest.gtestjs
+++ b/chrome/browser/resources/chromeos/switch_access/tree_walker_unittest.gtestjs
@@ -23,6 +23,7 @@ AutomationTreeWalkerUnitTest.prototype = {
browsePreload: DUMMY_URL,
getSampleTree: function() {
+ let loc = {left: 0, top: 0, width: 0, height: 0};
// root
// middle1
// leaf1
@@ -31,14 +32,14 @@ AutomationTreeWalkerUnitTest.prototype = {
// middle2
// leaf4
// leaf5
- let root = {};
- let middle1 = {};
- let middle2 = {};
- let leaf1 = {};
- let leaf2 = {};
- let leaf3 = {};
- let leaf4 = {};
- let leaf5 = {};
+ let root = {location: loc, state: {}};
+ let middle1 = {location: loc, state: {}};
+ let middle2 = {location: loc, state: {}};
+ let leaf1 = {location: loc, state: {}};
+ let leaf2 = {location: loc, state: {}};
+ let leaf3 = {location: loc, state: {}};
+ let leaf4 = {location: loc, state: {}};
+ let leaf5 = {location: loc, state: {}};
root.firstChild = middle1;
root.lastChild = middle2;
@@ -79,6 +80,7 @@ AutomationTreeWalkerUnitTest.prototype = {
};
TEST_F('AutomationTreeWalkerUnitTest', 'MoveToNode', function() {
+ chrome.automation = {RoleType: {TAB: 'tab', TAB_LIST: 'tabList'}};
let t = this.getSampleTree();
let treeWalker = new AutomationTreeWalker();
@@ -154,14 +156,29 @@ TEST_F('AutomationTreeWalkerUnitTest', 'GetYoungestDescendant', function() {
});
TEST_F('AutomationTreeWalkerUnitTest', 'IsInteresting', function() {
- let node1 = {};
- let node2 = {state: {}};
- let node3 = {state: {focusable: false}};
- let node4 = {state: {focusable: true}};
+ chrome.automation = {RoleType: {TAB: 'tab', TAB_LIST: 'tabList'}};
let treeWalker = new AutomationTreeWalker();
- assertTrue(treeWalker.isInteresting_(node1) === undefined);
- assertTrue(treeWalker.isInteresting_(node2) === undefined);
- assertFalse(treeWalker.isInteresting_(node3));
- assertTrue(treeWalker.isInteresting_(node4));
+ // Testing focusable.
+ let loc1 = {left: 0, top: 0, width: 0, height: 0};
+ let node1 = {location: loc1, state: {}};
+ let node2 = {location: loc1, state: {focusable: false}};
+ let node3 = {location: loc1, state: {focusable: true}};
+ assertEquals(undefined, treeWalker.isInteresting_(node1));
+ assertFalse(treeWalker.isInteresting_(node2));
+ assertTrue(treeWalker.isInteresting_(node3));
+
+ // Testing onscreen.
+ let loc2 = {left: -1, top: 0, width: 0, height: 0};
+ let loc3 = {left: 0, top: -1, width: 0, height: 0};
+ let node4 = {location: loc2, state: {focusable: true}};
+ let node5 = {location: loc3, state: {focusable: true}};
+ assertFalse(treeWalker.isInteresting_(node4));
+ assertFalse(treeWalker.isInteresting_(node5));
+
+ // Testing if tab.
+ let node6 = {location: loc1, role: 'tabList', state: {}};
+ let node7 = {location: loc1, parent: node6, role: 'tab', state: {}};
+ assertEquals(undefined, treeWalker.isInteresting_(node6));
+ assertTrue(treeWalker.isInteresting_(node7));
});

Powered by Google App Engine
This is Rietveld 408576698