Index: chrome/renderer/resources/extensions/automation/automation_node.js |
diff --git a/chrome/renderer/resources/extensions/automation/automation_node.js b/chrome/renderer/resources/extensions/automation/automation_node.js |
index fb851690585913880b3ba70de3c1a2f1ea4dbd09..dc76e77de271e30931d485cef5c89dd5c4cbe5d1 100644 |
--- a/chrome/renderer/resources/extensions/automation/automation_node.js |
+++ b/chrome/renderer/resources/extensions/automation/automation_node.js |
@@ -95,6 +95,15 @@ AutomationNodeImpl.prototype = { |
endIndex: endIndex }); |
}, |
+ querySelector: function(selector, callback) { |
+ automationInternal.querySelector( |
+ { processID: this.rootImpl.processID, |
+ routingID: this.rootImpl.routingID, |
+ automationNodeID: this.id, |
+ selector: selector }, |
+ this.querySelectorCallback_.bind(this, callback)); |
+ }, |
+ |
addEventListener: function(eventType, callback, capture) { |
this.removeEventListener(eventType, callback); |
if (!this.listeners[eventType]) |
@@ -136,11 +145,14 @@ AutomationNodeImpl.prototype = { |
}, |
toString: function() { |
- return 'node id=' + this.id + |
+ var impl = privates(this).impl; |
+ if (!impl) |
+ impl = this; |
+ return 'node id=' + impl.id + |
' role=' + this.role + |
' state=' + $JSON.stringify(this.state) + |
- ' parentID=' + this.parentID + |
- ' childIds=' + $JSON.stringify(this.childIds) + |
+ ' parentID=' + impl.parentID + |
+ ' childIds=' + $JSON.stringify(impl.childIds) + |
' attributes=' + $JSON.stringify(this.attributes); |
}, |
@@ -211,6 +223,19 @@ AutomationNodeImpl.prototype = { |
automationNodeID: this.id, |
actionType: actionType }, |
opt_args || {}); |
+ }, |
+ |
+ querySelectorCallback_: function(userCallback, resultAutomationNodeID) { |
+ if (resultAutomationNodeID == 0) { |
+ userCallback(null); |
+ return; |
+ } |
+ var resultNode = this.rootImpl.get(resultAutomationNodeID); |
+ if (!resultNode) { |
dmazzoni
2014/10/30 23:32:42
Do you want to return here? It looks like you're c
aboxhall
2014/10/31 20:32:22
I think that's WAI - they need to know that they d
|
+ logging.WARNING('Query selector result not in tree: ' + |
+ resultAutomationNodeID) |
+ } |
+ userCallback(resultNode); |
} |
}; |
@@ -599,7 +624,9 @@ var AutomationNode = utils.expose('AutomationNode', |
'makeVisible', |
'setSelection', |
'addEventListener', |
- 'removeEventListener'], |
+ 'removeEventListener', |
+ 'querySelector', |
+ 'toString'], |
readonly: ['isRootNode', |
'role', |
'state', |
@@ -610,7 +637,8 @@ var AutomationNode = utils.expose('AutomationNode', |
var AutomationRootNode = utils.expose('AutomationRootNode', |
AutomationRootNodeImpl, |
{ superclass: AutomationNode, |
- functions: ['load'], |
+ functions: ['load', |
+ 'toString'], |
readonly: ['loaded'] }); |
exports.AutomationNode = AutomationNode; |