Commit 740e1a93 authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Rename class for clarity

This change renames NodeWrapper to BasicNode for increased clarity.
This is a pure refactor.

AX-Relnotes: n/a.
Bug: None
Change-Id: I86302cbfbaf76ee33c9f2672c4a92b4c424f081c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388772Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Cr-Commit-Position: refs/heads/master@{#803953}
parent d5def071
...@@ -61,13 +61,13 @@ run_jsbundler("switch_access_copied_files") { ...@@ -61,13 +61,13 @@ run_jsbundler("switch_access_copied_files") {
"metrics.js", "metrics.js",
"navigation_manager.js", "navigation_manager.js",
"nodes/back_button_node.js", "nodes/back_button_node.js",
"nodes/basic_node.js",
"nodes/combo_box_node.js", "nodes/combo_box_node.js",
"nodes/desktop_node.js", "nodes/desktop_node.js",
"nodes/editable_text_node.js", "nodes/editable_text_node.js",
"nodes/group_node.js", "nodes/group_node.js",
"nodes/keyboard_node.js", "nodes/keyboard_node.js",
"nodes/modal_dialog_node.js", "nodes/modal_dialog_node.js",
"nodes/node_wrapper.js",
"nodes/slider_node.js", "nodes/slider_node.js",
"nodes/switch_access_node.js", "nodes/switch_access_node.js",
"nodes/tab_node.js", "nodes/tab_node.js",
...@@ -103,8 +103,8 @@ js2gtest("switch_access_extjs_tests") { ...@@ -103,8 +103,8 @@ js2gtest("switch_access_extjs_tests") {
sources = [ sources = [
"auto_scan_manager_test.js", "auto_scan_manager_test.js",
"navigation_manager_test.js", "navigation_manager_test.js",
"nodes/basic_node_test.js",
"nodes/desktop_node_test.js", "nodes/desktop_node_test.js",
"nodes/node_wrapper_test.js",
"nodes/tab_node_test.js", "nodes/tab_node_test.js",
"switch_access_predicate_test.js", "switch_access_predicate_test.js",
"text_navigation_manager_test.js", "text_navigation_manager_test.js",
...@@ -132,6 +132,7 @@ js_type_check("closure_compile") { ...@@ -132,6 +132,7 @@ js_type_check("closure_compile") {
":auto_scan_manager", ":auto_scan_manager",
":back_button_node", ":back_button_node",
":background", ":background",
":basic_node",
":cache", ":cache",
":combo_box_node", ":combo_box_node",
":commands", ":commands",
...@@ -145,7 +146,6 @@ js_type_check("closure_compile") { ...@@ -145,7 +146,6 @@ js_type_check("closure_compile") {
":metrics", ":metrics",
":modal_dialog_node", ":modal_dialog_node",
":navigation_manager", ":navigation_manager",
":node_wrapper",
":preferences", ":preferences",
":slider_node", ":slider_node",
":switch_access", ":switch_access",
...@@ -196,7 +196,7 @@ js_library("cache") { ...@@ -196,7 +196,7 @@ js_library("cache") {
js_library("combo_box_node") { js_library("combo_box_node") {
sources = [ "nodes/combo_box_node.js" ] sources = [ "nodes/combo_box_node.js" ]
deps = [ deps = [
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
"../common:event_generator", "../common:event_generator",
"../common:key_code", "../common:key_code",
...@@ -215,14 +215,14 @@ js_library("commands") { ...@@ -215,14 +215,14 @@ js_library("commands") {
js_library("desktop_node") { js_library("desktop_node") {
sources = [ "nodes/desktop_node.js" ] sources = [ "nodes/desktop_node.js" ]
deps = [ ":node_wrapper" ] deps = [ ":basic_node" ]
externs_list = [ "$externs_path/automation.js" ] externs_list = [ "$externs_path/automation.js" ]
} }
js_library("editable_text_node") { js_library("editable_text_node") {
sources = [ "nodes/editable_text_node.js" ] sources = [ "nodes/editable_text_node.js" ]
deps = [ deps = [
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
] ]
...@@ -234,7 +234,7 @@ js_library("editable_text_node") { ...@@ -234,7 +234,7 @@ js_library("editable_text_node") {
js_library("focus_ring_manager") { js_library("focus_ring_manager") {
deps = [ deps = [
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
] ]
...@@ -245,7 +245,7 @@ js_library("group_node") { ...@@ -245,7 +245,7 @@ js_library("group_node") {
sources = [ "nodes/group_node.js" ] sources = [ "nodes/group_node.js" ]
deps = [ deps = [
":back_button_node", ":back_button_node",
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
"../common:rect_util", "../common:rect_util",
...@@ -258,9 +258,9 @@ js_library("group_node") { ...@@ -258,9 +258,9 @@ js_library("group_node") {
js_library("history") { js_library("history") {
deps = [ deps = [
":basic_node",
":cache", ":cache",
":desktop_node", ":desktop_node",
":node_wrapper",
":switch_access_node", ":switch_access_node",
":switch_access_predicate", ":switch_access_predicate",
] ]
...@@ -270,8 +270,8 @@ js_library("history") { ...@@ -270,8 +270,8 @@ js_library("history") {
js_library("keyboard_node") { js_library("keyboard_node") {
sources = [ "nodes/keyboard_node.js" ] sources = [ "nodes/keyboard_node.js" ]
deps = [ deps = [
":basic_node",
":group_node", ":group_node",
":node_wrapper",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
":switch_access_predicate", ":switch_access_predicate",
...@@ -306,7 +306,7 @@ js_library("metrics") { ...@@ -306,7 +306,7 @@ js_library("metrics") {
js_library("modal_dialog_node") { js_library("modal_dialog_node") {
sources = [ "nodes/modal_dialog_node.js" ] sources = [ "nodes/modal_dialog_node.js" ]
deps = [ deps = [
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
"../common:event_generator", "../common:event_generator",
...@@ -317,6 +317,7 @@ js_library("modal_dialog_node") { ...@@ -317,6 +317,7 @@ js_library("modal_dialog_node") {
js_library("navigation_manager") { js_library("navigation_manager") {
deps = [ deps = [
":basic_node",
":desktop_node", ":desktop_node",
":focus_ring_manager", ":focus_ring_manager",
":history", ":history",
...@@ -324,7 +325,6 @@ js_library("navigation_manager") { ...@@ -324,7 +325,6 @@ js_library("navigation_manager") {
":menu_manager", ":menu_manager",
":metrics", ":metrics",
":modal_dialog_node", ":modal_dialog_node",
":node_wrapper",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
":switch_access_predicate", ":switch_access_predicate",
...@@ -338,8 +338,8 @@ js_library("navigation_manager") { ...@@ -338,8 +338,8 @@ js_library("navigation_manager") {
] ]
} }
js_library("node_wrapper") { js_library("basic_node") {
sources = [ "nodes/node_wrapper.js" ] sources = [ "nodes/basic_node.js" ]
deps = [ deps = [
":back_button_node", ":back_button_node",
":cache", ":cache",
...@@ -365,7 +365,7 @@ js_library("preferences") { ...@@ -365,7 +365,7 @@ js_library("preferences") {
js_library("slider_node") { js_library("slider_node") {
sources = [ "nodes/slider_node.js" ] sources = [ "nodes/slider_node.js" ]
deps = [ deps = [
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
"../common:event_generator", "../common:event_generator",
"../common:key_code", "../common:key_code",
...@@ -417,7 +417,7 @@ js_library("switch_access_predicate") { ...@@ -417,7 +417,7 @@ js_library("switch_access_predicate") {
js_library("tab_node") { js_library("tab_node") {
sources = [ "nodes/tab_node.js" ] sources = [ "nodes/tab_node.js" ]
deps = [ deps = [
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
"../common:rect_util", "../common:rect_util",
...@@ -440,7 +440,7 @@ js_library("text_navigation_manager") { ...@@ -440,7 +440,7 @@ js_library("text_navigation_manager") {
js_library("window_node") { js_library("window_node") {
sources = [ "nodes/window_node.js" ] sources = [ "nodes/window_node.js" ]
deps = [ deps = [
":node_wrapper", ":basic_node",
":switch_access_constants", ":switch_access_constants",
":switch_access_node", ":switch_access_node",
] ]
......
...@@ -140,7 +140,7 @@ class NavigationManager { ...@@ -140,7 +140,7 @@ class NavigationManager {
if (!menuNode) { if (!menuNode) {
return; return;
} }
const menu = RootNodeWrapper.buildTree(menuNode); const menu = BasicRootNode.buildTree(menuNode);
NavigationManager.instance.jumpTo_(menu, false /* shouldExitMenu */); NavigationManager.instance.jumpTo_(menu, false /* shouldExitMenu */);
} }
...@@ -191,7 +191,7 @@ class NavigationManager { ...@@ -191,7 +191,7 @@ class NavigationManager {
} }
const navigator = NavigationManager.instance; const navigator = NavigationManager.instance;
const baseNode = node.automationNode; const baseNode = node.automationNode;
if (!(node instanceof NodeWrapper) || !baseNode) { if (!(node instanceof BasicNode) || !baseNode) {
navigator.setNode_(node); navigator.setNode_(node);
return; return;
} }
......
...@@ -121,7 +121,7 @@ TEST_F('SwitchAccessNavigationManagerTest', 'JumpTo', function() { ...@@ -121,7 +121,7 @@ TEST_F('SwitchAccessNavigationManagerTest', 'JumpTo', function() {
this.navigator.group_.isEquivalentTo(group1), this.navigator.group_.isEquivalentTo(group1),
'Group is initialized in an unexpected manner'); 'Group is initialized in an unexpected manner');
this.navigator.jumpTo_(RootNodeWrapper.buildTree(group2)); this.navigator.jumpTo_(BasicRootNode.buildTree(group2));
assertFalse( assertFalse(
this.navigator.group_.isEquivalentTo(group1), 'Jump did nothing'); this.navigator.group_.isEquivalentTo(group1), 'Jump did nothing');
assertTrue( assertTrue(
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* This class handles interactions with an onscreen element based on a single * This class handles interactions with an onscreen element based on a single
* AutomationNode. * AutomationNode.
*/ */
class NodeWrapper extends SAChildNode { class BasicNode extends SAChildNode {
/** /**
* @param {!AutomationNode} baseNode * @param {!AutomationNode} baseNode
* @param {?SARootNode} parent * @param {?SARootNode} parent
...@@ -75,22 +75,22 @@ class NodeWrapper extends SAChildNode { ...@@ -75,22 +75,22 @@ class NodeWrapper extends SAChildNode {
if (!this.isGroup()) { if (!this.isGroup()) {
return null; return null;
} }
return RootNodeWrapper.buildTree(this.baseNode_); return BasicRootNode.buildTree(this.baseNode_);
} }
/** @override */ /** @override */
equals(other) { equals(other) {
if (!other || !(other instanceof NodeWrapper)) { if (!other || !(other instanceof BasicNode)) {
return false; return false;
} }
other = /** @type {!NodeWrapper} */ (other); other = /** @type {!BasicNode} */ (other);
return other.baseNode_ === this.baseNode_; return other.baseNode_ === this.baseNode_;
} }
/** @override */ /** @override */
isEquivalentTo(node) { isEquivalentTo(node) {
if (node instanceof NodeWrapper || node instanceof RootNodeWrapper) { if (node instanceof BasicNode || node instanceof BasicRootNode) {
return this.baseNode_ === node.baseNode_; return this.baseNode_ === node.baseNode_;
} }
...@@ -200,7 +200,7 @@ class NodeWrapper extends SAChildNode { ...@@ -200,7 +200,7 @@ class NodeWrapper extends SAChildNode {
/** /**
* @param {!AutomationNode} baseNode * @param {!AutomationNode} baseNode
* @param {?SARootNode} parent * @param {?SARootNode} parent
* @return {!NodeWrapper} * @return {!BasicNode}
*/ */
static create(baseNode, parent) { static create(baseNode, parent) {
if (SwitchAccessPredicate.isTextInput(baseNode)) { if (SwitchAccessPredicate.isTextInput(baseNode)) {
...@@ -216,7 +216,7 @@ class NodeWrapper extends SAChildNode { ...@@ -216,7 +216,7 @@ class NodeWrapper extends SAChildNode {
case chrome.automation.RoleType.TAB: case chrome.automation.RoleType.TAB:
return TabNode.create(baseNode, parent); return TabNode.create(baseNode, parent);
default: default:
return new NodeWrapper(baseNode, parent); return new BasicNode(baseNode, parent);
} }
} }
} }
...@@ -225,10 +225,10 @@ class NodeWrapper extends SAChildNode { ...@@ -225,10 +225,10 @@ class NodeWrapper extends SAChildNode {
* This class handles constructing and traversing a group of onscreen elements * This class handles constructing and traversing a group of onscreen elements
* based on all the interesting descendants of a single AutomationNode. * based on all the interesting descendants of a single AutomationNode.
*/ */
class RootNodeWrapper extends SARootNode { class BasicRootNode extends SARootNode {
/** /**
* WARNING: If you call this constructor, you must *explicitly* set children. * WARNING: If you call this constructor, you must *explicitly* set children.
* Use the static function RootNodeWrapper.buildTree for most use cases. * Use the static function BasicRootNode.buildTree for most use cases.
* @param {!AutomationNode} baseNode * @param {!AutomationNode} baseNode
*/ */
constructor(baseNode) { constructor(baseNode) {
...@@ -260,17 +260,17 @@ class RootNodeWrapper extends SARootNode { ...@@ -260,17 +260,17 @@ class RootNodeWrapper extends SARootNode {
/** @override */ /** @override */
equals(other) { equals(other) {
if (!(other instanceof RootNodeWrapper)) { if (!(other instanceof BasicRootNode)) {
return false; return false;
} }
other = /** @type {!RootNodeWrapper} */ (other); other = /** @type {!BasicRootNode} */ (other);
return super.equals(other) && this.baseNode_ === other.baseNode_; return super.equals(other) && this.baseNode_ === other.baseNode_;
} }
/** @override */ /** @override */
isEquivalentTo(node) { isEquivalentTo(node) {
if (node instanceof RootNodeWrapper || node instanceof NodeWrapper) { if (node instanceof BasicRootNode || node instanceof BasicNode) {
return this.baseNode_ === node.baseNode_; return this.baseNode_ === node.baseNode_;
} }
...@@ -308,9 +308,9 @@ class RootNodeWrapper extends SARootNode { ...@@ -308,9 +308,9 @@ class RootNodeWrapper extends SARootNode {
/** @override */ /** @override */
refreshChildren() { refreshChildren() {
const childConstructor = (node) => NodeWrapper.create(node, this); const childConstructor = (node) => BasicNode.create(node, this);
try { try {
RootNodeWrapper.findAndSetChildren(this, childConstructor); BasicRootNode.findAndSetChildren(this, childConstructor);
} catch (e) { } catch (e) {
this.invalidated_ = true; this.invalidated_ = true;
} }
...@@ -327,7 +327,7 @@ class RootNodeWrapper extends SARootNode { ...@@ -327,7 +327,7 @@ class RootNodeWrapper extends SARootNode {
} }
} }
// Update this RootNodeWrapper's children. // Update this BasicRootNode's children.
this.refreshChildren(); this.refreshChildren();
if (this.invalidated_) { if (this.invalidated_) {
this.onUnfocus(); this.onUnfocus();
...@@ -353,7 +353,7 @@ class RootNodeWrapper extends SARootNode { ...@@ -353,7 +353,7 @@ class RootNodeWrapper extends SARootNode {
/** /**
* @param {!AutomationNode} rootNode * @param {!AutomationNode} rootNode
* @return {!RootNodeWrapper} * @return {!BasicRootNode}
*/ */
static buildTree(rootNode) { static buildTree(rootNode) {
if (rootNode.role === chrome.automation.RoleType.KEYBOARD) { if (rootNode.role === chrome.automation.RoleType.KEYBOARD) {
...@@ -363,22 +363,22 @@ class RootNodeWrapper extends SARootNode { ...@@ -363,22 +363,22 @@ class RootNodeWrapper extends SARootNode {
return WindowRootNode.buildTree(rootNode); return WindowRootNode.buildTree(rootNode);
} }
const root = new RootNodeWrapper(rootNode); const root = new BasicRootNode(rootNode);
const childConstructor = (node) => NodeWrapper.create(node, root); const childConstructor = (node) => BasicNode.create(node, root);
RootNodeWrapper.findAndSetChildren(root, childConstructor); BasicRootNode.findAndSetChildren(root, childConstructor);
return root; return root;
} }
/** /**
* Helper function to connect tree elements, given the root node and a * Helper function to connect tree elements, given the root node and a
* constructor for the child type. * constructor for the child type.
* @param {!RootNodeWrapper} root * @param {!BasicRootNode} root
* @param {function(!AutomationNode): !SAChildNode} childConstructor * @param {function(!AutomationNode): !SAChildNode} childConstructor
* Constructs a child node from an automation node. * Constructs a child node from an automation node.
*/ */
static findAndSetChildren(root, childConstructor) { static findAndSetChildren(root, childConstructor) {
const interestingChildren = RootNodeWrapper.getInterestingChildren(root); const interestingChildren = BasicRootNode.getInterestingChildren(root);
const children = interestingChildren.map(childConstructor) const children = interestingChildren.map(childConstructor)
.filter((child) => child.isValidAndVisible()); .filter((child) => child.isValidAndVisible());
...@@ -393,11 +393,11 @@ class RootNodeWrapper extends SARootNode { ...@@ -393,11 +393,11 @@ class RootNodeWrapper extends SARootNode {
} }
/** /**
* @param {!RootNodeWrapper|!AutomationNode} root * @param {!BasicRootNode|!AutomationNode} root
* @return {!Array<!AutomationNode>} * @return {!Array<!AutomationNode>}
*/ */
static getInterestingChildren(root) { static getInterestingChildren(root) {
if (root instanceof RootNodeWrapper) { if (root instanceof BasicRootNode) {
root = root.baseNode_; root = root.baseNode_;
} }
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
GEN_INCLUDE(['../switch_access_e2e_test_base.js']); GEN_INCLUDE(['../switch_access_e2e_test_base.js']);
/** Test fixture for the node wrapper type. */ /** Test fixture for the node wrapper type. */
SwitchAccessNodeWrapperTest = class extends SwitchAccessE2ETest {}; SwitchAccessBasicNodeTest = class extends SwitchAccessE2ETest {};
TEST_F('SwitchAccessNodeWrapperTest', 'AsRootNode', function() { TEST_F('SwitchAccessBasicNodeTest', 'AsRootNode', function() {
const website = `<div aria-label="outer"> const website = `<div aria-label="outer">
<div aria-label="inner"> <div aria-label="inner">
<input type="range"> <input type="range">
...@@ -22,7 +22,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'AsRootNode', function() { ...@@ -22,7 +22,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'AsRootNode', function() {
const outer = inner.parent; const outer = inner.parent;
assertNotEquals(undefined, outer, 'Could not find outer group'); assertNotEquals(undefined, outer, 'Could not find outer group');
const outerRootNode = RootNodeWrapper.buildTree(outer, null); const outerRootNode = BasicRootNode.buildTree(outer, null);
const innerNode = outerRootNode.firstChild; const innerNode = outerRootNode.firstChild;
assertTrue(innerNode.isGroup(), 'Inner group node is not a group'); assertTrue(innerNode.isGroup(), 'Inner group node is not a group');
...@@ -41,7 +41,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'AsRootNode', function() { ...@@ -41,7 +41,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'AsRootNode', function() {
}); });
}); });
TEST_F('SwitchAccessNodeWrapperTest', 'Equals', function() { TEST_F('SwitchAccessBasicNodeTest', 'Equals', function() {
this.runWithLoadedTree('', (desktop) => { this.runWithLoadedTree('', (desktop) => {
const desktopNode = DesktopNode.build(desktop); const desktopNode = DesktopNode.build(desktop);
...@@ -79,17 +79,17 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Equals', function() { ...@@ -79,17 +79,17 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Equals', function() {
const wrappedNode = desktopNode.firstChild; const wrappedNode = desktopNode.firstChild;
assertTrue( assertTrue(
wrappedNode instanceof NodeWrapper, wrappedNode instanceof BasicNode,
'Child node is not of type NodeWrapper'); 'Child node is not of type BasicNode');
assertGT(desktopNode.children.length, 1, 'Desktop root has only 1 child'); assertGT(desktopNode.children.length, 1, 'Desktop root has only 1 child');
assertFalse(wrappedNode.equals(), 'Child NodeWrapper equals nothing'); assertFalse(wrappedNode.equals(), 'Child BasicNode equals nothing');
assertFalse( assertFalse(
wrappedNode.equals(new BackButtonNode()), wrappedNode.equals(new BackButtonNode()),
'Child NodeWrapper equals a BackButtonNode'); 'Child BasicNode equals a BackButtonNode');
assertFalse( assertFalse(
new BackButtonNode().equals(wrappedNode), new BackButtonNode().equals(wrappedNode),
'Equals is not symmetric? NodeWrapper equals a BackButtonNode'); 'Equals is not symmetric? BasicNode equals a BackButtonNode');
assertFalse( assertFalse(
wrappedNode.equals(desktopNode.lastChild), wrappedNode.equals(desktopNode.lastChild),
'Children with different base nodes are equal'); 'Children with different base nodes are equal');
...@@ -98,7 +98,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Equals', function() { ...@@ -98,7 +98,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Equals', function() {
'Equals is not symmetric? Nodes with different base nodes are equal'); 'Equals is not symmetric? Nodes with different base nodes are equal');
const equivalentWrappedNode = const equivalentWrappedNode =
NodeWrapper.create(wrappedNode.baseNode_, desktopNode); BasicNode.create(wrappedNode.baseNode_, desktopNode);
assertTrue( assertTrue(
wrappedNode.equals(wrappedNode), wrappedNode.equals(wrappedNode),
'Equals is not reflexive? (child node)'); 'Equals is not reflexive? (child node)');
...@@ -111,12 +111,12 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Equals', function() { ...@@ -111,12 +111,12 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Equals', function() {
}); });
}); });
TEST_F('SwitchAccessNodeWrapperTest', 'Actions', function() { TEST_F('SwitchAccessBasicNodeTest', 'Actions', function() {
const website = `<input type="text"> const website = `<input type="text">
<button></button> <button></button>
<input type="range" min=1 max=5 value=3>`; <input type="range" min=1 max=5 value=3>`;
this.runWithLoadedTree(website, (desktop) => { this.runWithLoadedTree(website, (desktop) => {
const textField = NodeWrapper.create( const textField = BasicNode.create(
desktop.find({role: chrome.automation.RoleType.TEXT_FIELD}), desktop.find({role: chrome.automation.RoleType.TEXT_FIELD}),
new SARootNode()); new SARootNode());
...@@ -133,7 +133,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Actions', function() { ...@@ -133,7 +133,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Actions', function() {
textField.hasAction(SwitchAccessMenuAction.SELECT), textField.hasAction(SwitchAccessMenuAction.SELECT),
'Text field has action SELECT'); 'Text field has action SELECT');
const button = NodeWrapper.create( const button = BasicNode.create(
desktop.find({role: chrome.automation.RoleType.BUTTON}), desktop.find({role: chrome.automation.RoleType.BUTTON}),
new SARootNode()); new SARootNode());
...@@ -150,7 +150,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Actions', function() { ...@@ -150,7 +150,7 @@ TEST_F('SwitchAccessNodeWrapperTest', 'Actions', function() {
button.hasAction(SwitchAccessMenuAction.DICTATION), button.hasAction(SwitchAccessMenuAction.DICTATION),
'Button has action DICTATION'); 'Button has action DICTATION');
const slider = NodeWrapper.create( const slider = BasicNode.create(
desktop.find({role: chrome.automation.RoleType.SLIDER}), desktop.find({role: chrome.automation.RoleType.SLIDER}),
new SARootNode()); new SARootNode());
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* This class handles interactions with combo boxes. * This class handles interactions with combo boxes.
* TODO(anastasi): Add a test for this class. * TODO(anastasi): Add a test for this class.
*/ */
class ComboBoxNode extends NodeWrapper { class ComboBoxNode extends BasicNode {
/** /**
* @param {!AutomationNode} baseNode * @param {!AutomationNode} baseNode
* @param {?SARootNode} parent * @param {?SARootNode} parent
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/** /**
* This class handles interactions with the desktop automation node. * This class handles interactions with the desktop automation node.
*/ */
class DesktopNode extends RootNodeWrapper { class DesktopNode extends BasicRootNode {
/** /**
* @param {!AutomationNode} autoNode The automation node representing the * @param {!AutomationNode} autoNode The automation node representing the
* desktop. * desktop.
...@@ -40,7 +40,7 @@ class DesktopNode extends RootNodeWrapper { ...@@ -40,7 +40,7 @@ class DesktopNode extends RootNodeWrapper {
} }
// Update this DesktopNode's children. // Update this DesktopNode's children.
const childConstructor = (node) => NodeWrapper.create(node, this); const childConstructor = (node) => BasicNode.create(node, this);
DesktopNode.findAndSetChildren(this, childConstructor); DesktopNode.findAndSetChildren(this, childConstructor);
// Set the new instance of that child to be the focused node. // Set the new instance of that child to be the focused node.
...@@ -64,7 +64,7 @@ class DesktopNode extends RootNodeWrapper { ...@@ -64,7 +64,7 @@ class DesktopNode extends RootNodeWrapper {
*/ */
static build(desktop) { static build(desktop) {
const root = new DesktopNode(desktop); const root = new DesktopNode(desktop);
const childConstructor = (autoNode) => NodeWrapper.create(autoNode, root); const childConstructor = (autoNode) => BasicNode.create(autoNode, root);
DesktopNode.findAndSetChildren(root, childConstructor); DesktopNode.findAndSetChildren(root, childConstructor);
return root; return root;
...@@ -72,7 +72,7 @@ class DesktopNode extends RootNodeWrapper { ...@@ -72,7 +72,7 @@ class DesktopNode extends RootNodeWrapper {
/** @override */ /** @override */
static findAndSetChildren(root, childConstructor) { static findAndSetChildren(root, childConstructor) {
const interestingChildren = RootNodeWrapper.getInterestingChildren(root); const interestingChildren = BasicRootNode.getInterestingChildren(root);
if (interestingChildren.length < 1) { if (interestingChildren.length < 1) {
// If the desktop node does not behave as expected, we have no basis for // If the desktop node does not behave as expected, we have no basis for
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/** /**
* This class handles interactions with editable text fields. * This class handles interactions with editable text fields.
*/ */
class EditableTextNode extends NodeWrapper { class EditableTextNode extends BasicNode {
/** /**
* @param {!AutomationNode} baseNode * @param {!AutomationNode} baseNode
* @param {?SARootNode} parent * @param {?SARootNode} parent
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* This class handles the behavior of keyboard nodes directly associated with a * This class handles the behavior of keyboard nodes directly associated with a
* single AutomationNode. * single AutomationNode.
*/ */
class KeyboardNode extends NodeWrapper { class KeyboardNode extends BasicNode {
/** /**
* @param {!AutomationNode} node * @param {!AutomationNode} node
* @param {!SARootNode} parent * @param {!SARootNode} parent
...@@ -59,7 +59,7 @@ class KeyboardNode extends NodeWrapper { ...@@ -59,7 +59,7 @@ class KeyboardNode extends NodeWrapper {
* This class handles the top-level Keyboard node, as well as the construction * This class handles the top-level Keyboard node, as well as the construction
* of the Keyboard tree. * of the Keyboard tree.
*/ */
class KeyboardRootNode extends RootNodeWrapper { class KeyboardRootNode extends BasicRootNode {
/** /**
* @param {!AutomationNode} groupNode * @param {!AutomationNode} groupNode
* @private * @private
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
/** This class represents the group rooted at a modal dialog. */ /** This class represents the group rooted at a modal dialog. */
class ModalDialogRootNode extends RootNodeWrapper { class ModalDialogRootNode extends BasicRootNode {
/** @override */ /** @override */
onExit() { onExit() {
// To close a modal dialog, we need to send an escape key event. // To close a modal dialog, we need to send an escape key event.
...@@ -17,9 +17,9 @@ class ModalDialogRootNode extends RootNodeWrapper { ...@@ -17,9 +17,9 @@ class ModalDialogRootNode extends RootNodeWrapper {
*/ */
static buildTree(dialogNode) { static buildTree(dialogNode) {
const root = new ModalDialogRootNode(dialogNode); const root = new ModalDialogRootNode(dialogNode);
const childConstructor = (node) => NodeWrapper.create(node, root); const childConstructor = (node) => BasicNode.create(node, root);
RootNodeWrapper.findAndSetChildren(root, childConstructor); BasicRootNode.findAndSetChildren(root, childConstructor);
return root; return root;
} }
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
/** This class handles interactions with sliders. */ /** This class handles interactions with sliders. */
class SliderNode extends NodeWrapper { class SliderNode extends BasicNode {
/** /**
* @param {!AutomationNode} baseNode * @param {!AutomationNode} baseNode
* @param {?SARootNode} parent * @param {?SARootNode} parent
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* This class handles the behavior of tab nodes at the top level (i.e. as * This class handles the behavior of tab nodes at the top level (i.e. as
* groups). * groups).
*/ */
class TabNode extends NodeWrapper { class TabNode extends BasicNode {
/** /**
* @param {!AutomationNode} node The node in the automation * @param {!AutomationNode} node The node in the automation
* tree * tree
...@@ -53,12 +53,12 @@ class TabNode extends NodeWrapper { ...@@ -53,12 +53,12 @@ class TabNode extends NodeWrapper {
/** @override */ /** @override */
static create(tabNode, parent) { static create(tabNode, parent) {
const tabAsRoot = new RootNodeWrapper(tabNode); const tabAsRoot = new BasicRootNode(tabNode);
let closeButton; let closeButton;
for (const child of tabNode.children) { for (const child of tabNode.children) {
if (child.role === chrome.automation.RoleType.BUTTON) { if (child.role === chrome.automation.RoleType.BUTTON) {
closeButton = new NodeWrapper(child, tabAsRoot); closeButton = new BasicNode(child, tabAsRoot);
break; break;
} }
} }
...@@ -77,7 +77,7 @@ class TabNode extends NodeWrapper { ...@@ -77,7 +77,7 @@ class TabNode extends NodeWrapper {
} }
/** This class handles the behavior of tabs as actionable elements */ /** This class handles the behavior of tabs as actionable elements */
class ActionableTabNode extends NodeWrapper { class ActionableTabNode extends BasicNode {
/** /**
* @param {!AutomationNode} node * @param {!AutomationNode} node
* @param {?SARootNode} parent * @param {?SARootNode} parent
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
/** This class represents a window. */ /** This class represents a window. */
class WindowRootNode extends RootNodeWrapper { class WindowRootNode extends BasicRootNode {
/** @override */ /** @override */
onFocus() { onFocus() {
super.onFocus(); super.onFocus();
...@@ -23,9 +23,9 @@ class WindowRootNode extends RootNodeWrapper { ...@@ -23,9 +23,9 @@ class WindowRootNode extends RootNodeWrapper {
*/ */
static buildTree(windowNode) { static buildTree(windowNode) {
const root = new WindowRootNode(windowNode); const root = new WindowRootNode(windowNode);
const childConstructor = (node) => NodeWrapper.create(node, root); const childConstructor = (node) => BasicNode.create(node, root);
RootNodeWrapper.findAndSetChildren(root, childConstructor); BasicRootNode.findAndSetChildren(root, childConstructor);
return root; return root;
} }
} }
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"switch_access/metrics.js", "switch_access/metrics.js",
"switch_access/navigation_manager.js", "switch_access/navigation_manager.js",
"switch_access/nodes/switch_access_node.js", "switch_access/nodes/switch_access_node.js",
"switch_access/nodes/node_wrapper.js", "switch_access/nodes/basic_node.js",
"switch_access/nodes/back_button_node.js", "switch_access/nodes/back_button_node.js",
"switch_access/nodes/combo_box_node.js", "switch_access/nodes/combo_box_node.js",
"switch_access/nodes/desktop_node.js", "switch_access/nodes/desktop_node.js",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment