| Index: chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
|
| index e432a998de5f9d711f04ff24f136c4ef8509eeee..5eebf0b0085f268dd24e6e3ad05d4f6ac94142c6 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_next_e2e_test_base.js
|
| @@ -29,11 +29,24 @@ ChromeVoxNextE2ETest.prototype = {
|
| GEN('#include "base/command_line.h"');
|
| },
|
|
|
| - runWithAutomation: function(doc, callback) {
|
| - this.runWithDocument(doc, function() {
|
| - chrome.automation.getTree(function(root) {
|
| - callback(root);
|
| - }.bind(this));
|
| + /**
|
| + * Launches a new tab with the given document, and runs callback when a load
|
| + * complete fires.
|
| + * @param {function() : void} doc Snippet wrapped inside of a function.
|
| + * @param {function()} opt_callback Called once the document is ready.
|
| + */
|
| + runWithLoadedTree: function(doc, callback) {
|
| + chrome.automation.getDesktop(function(r) {
|
| + function callbackInternal(evt) {
|
| + if (!evt.target.attributes.url ||
|
| + evt.target.attributes.url.indexOf('test') == -1)
|
| + return;
|
| +
|
| + r.removeEventListener(callbackInternal);
|
| + callback(evt.target);
|
| + }
|
| + r.addEventListener('loadComplete', callbackInternal, true);
|
| + this.runWithTab(doc);
|
| }.bind(this));
|
| }
|
| };
|
|
|