| 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..bf35ec53e8ceae1a1d8926f7c524b6f571f7ccd6 100644
|
| --- a/chrome/renderer/resources/extensions/automation/automation_node.js
|
| +++ b/chrome/renderer/resources/extensions/automation/automation_node.js
|
| @@ -95,6 +95,17 @@ AutomationNodeImpl.prototype = {
|
| endIndex: endIndex });
|
| },
|
|
|
| + query: function(queryParams, callback) {
|
| + if ('selector' in queryParams) {
|
| + automationInternal.querySelector(
|
| + { processID: this.rootImpl.processID,
|
| + routingID: this.rootImpl.routingID,
|
| + automationNodeID: this.id,
|
| + selector: queryParams.selector },
|
| + this.querySelectorCallback_.bind(this, callback));
|
| + }
|
| + },
|
| +
|
| addEventListener: function(eventType, callback, capture) {
|
| this.removeEventListener(eventType, callback);
|
| if (!this.listeners[eventType])
|
| @@ -136,11 +147,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 +225,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) {
|
| + logging.WARNING('Query selector result not in tree: ' +
|
| + resultAutomationNodeID)
|
| + }
|
| + userCallback(resultNode);
|
| }
|
| };
|
|
|
| @@ -599,7 +626,9 @@ var AutomationNode = utils.expose('AutomationNode',
|
| 'makeVisible',
|
| 'setSelection',
|
| 'addEventListener',
|
| - 'removeEventListener'],
|
| + 'removeEventListener',
|
| + 'query',
|
| + 'toString'],
|
| readonly: ['isRootNode',
|
| 'role',
|
| 'state',
|
| @@ -610,7 +639,8 @@ var AutomationNode = utils.expose('AutomationNode',
|
| var AutomationRootNode = utils.expose('AutomationRootNode',
|
| AutomationRootNodeImpl,
|
| { superclass: AutomationNode,
|
| - functions: ['load'],
|
| + functions: ['load',
|
| + 'toString'],
|
| readonly: ['loaded'] });
|
|
|
| exports.AutomationNode = AutomationNode;
|
|
|