Allow only one bookmark to be added for multiple fast starring
[chromium-blink-merge.git] / chrome / browser / resources / chromeos / chromevox / testing / chromevox_next_e2e_test_base.js
blobbf0f03babf9c89f1c2d514fbe24106be53e033ee
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Include test fixture.
6 GEN_INCLUDE(['chromevox_e2e_test_base.js']);
8 /**
9 * Base test fixture for ChromeVox Next end to end tests.
11 * These tests are identical to ChromeVoxE2ETests except for performing the
12 * necessary setup to run ChromeVox Next.
13 * @constructor
14 * @extends {ChromeVoxE2ETest}
16 function ChromeVoxNextE2ETest() {
17 ChromeVoxE2ETest.call(this);
20 ChromeVoxNextE2ETest.prototype = {
21 __proto__: ChromeVoxE2ETest.prototype,
23 /**
24 * Launches a new tab with the given document, and runs callback when a load
25 * complete fires.
26 * @param {function() : void} doc Snippet wrapped inside of a function.
27 * @param {function()} opt_callback Called once the document is ready.
29 runWithLoadedTree: function(doc, callback) {
30 callback = this.newCallback(callback);
31 chrome.automation.getDesktop(function(r) {
32 var listener = function(evt) {
33 if (!evt.target.docUrl ||
34 evt.target.docUrl.indexOf('test') == -1)
35 return;
37 r.removeEventListener(listener);
38 callback && callback(evt.target);
39 callback = null;
41 r.addEventListener('loadComplete', listener, true);
42 this.runWithTab(doc);
43 }.bind(this));