Commit 371f687e authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Improve debugging strings

AX-Relnotes: n/a.
Bug: None.
Change-Id: Ibd14ecb887cdb6c59885292890d336966692ff7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389225
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Reviewed-by: default avatarAbigail Klein <abigailbklein@google.com>
Cr-Commit-Position: refs/heads/master@{#808590}
parent 19e2ad7f
...@@ -119,8 +119,11 @@ class BackButtonNode extends SAChildNode { ...@@ -119,8 +119,11 @@ class BackButtonNode extends SAChildNode {
// ================= Debug methods ================= // ================= Debug methods =================
/** @override */ /** @override */
debugString() { debugString(wholeTree, prefix = '', currentNode = null) {
return 'BackButtonNode'; if (!this.automationNode) {
return 'BackButtonNode';
}
return super.debugString(wholeTree, prefix, currentNode);
} }
// ================= Static methods ================= // ================= Static methods =================
......
...@@ -205,8 +205,8 @@ class SAChildNode { ...@@ -205,8 +205,8 @@ class SAChildNode {
/** /**
* String-ifies the node (for debugging purposes). * String-ifies the node (for debugging purposes).
* @param {boolean} wholeTree Whether to recursively include descendants. * @param {boolean} wholeTree Whether to recursively include descendants.
* @param {string=} prefix * @param {string} prefix
* @param {SAChildNode=} currentNode the currentNode, to highlight. * @param {?SAChildNode} currentNode the currentNode, to highlight.
* @return {string} * @return {string}
*/ */
debugString(wholeTree, prefix = '', currentNode = null) { debugString(wholeTree, prefix = '', currentNode = null) {
...@@ -215,7 +215,7 @@ class SAChildNode { ...@@ -215,7 +215,7 @@ class SAChildNode {
wholeTree, prefix + ' ', currentNode); wholeTree, prefix + ' ', currentNode);
} }
let str = this.role + ' '; let str = this.constructor.name + ' role(' + this.role + ') ';
if (this.automationNode.name) { if (this.automationNode.name) {
str += 'name(' + this.automationNode.name + ') '; str += 'name(' + this.automationNode.name + ') ';
...@@ -407,13 +407,14 @@ class SARootNode { ...@@ -407,13 +407,14 @@ class SARootNode {
/** /**
* String-ifies the node (for debugging purposes). * String-ifies the node (for debugging purposes).
* @param {boolean=} wholeTree Whether to recursively descend the tree * @param {boolean} wholeTree Whether to recursively descend the tree
* @param {string=} prefix * @param {string} prefix
* @param {SAChildNode} currentNode the currently focused node, to mark. * @param {?SAChildNode} currentNode the currently focused node, to mark.
* @return {string} * @return {string}
*/ */
debugString(wholeTree = false, prefix = '', currentNode = null) { debugString(wholeTree = false, prefix = '', currentNode = null) {
let str = 'Root: ' + this.automationNode.role + ' '; let str =
'Root: ' + this.constructor.name + ' ' + this.automationNode.role + ' ';
if (this.automationNode.name) { if (this.automationNode.name) {
str += 'name(' + this.automationNode.name + ') '; str += 'name(' + this.automationNode.name + ') ';
} }
......
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