| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Include test fixture. | 5 // Include test fixture. |
| 6 GEN_INCLUDE(['chromevox_e2e_test_base.js']); | 6 GEN_INCLUDE(['chromevox_e2e_test_base.js']); |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Base test fixture for ChromeVox Next end to end tests. | 9 * Base test fixture for ChromeVox Next end to end tests. |
| 10 * | 10 * |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 */ | 33 */ |
| 34 runWithLoadedTree: function(doc, callback) { | 34 runWithLoadedTree: function(doc, callback) { |
| 35 callback = this.newCallback(callback); | 35 callback = this.newCallback(callback); |
| 36 chrome.automation.getDesktop(function(r) { | 36 chrome.automation.getDesktop(function(r) { |
| 37 this.runWithTab(doc, function(newTabUrl) { | 37 this.runWithTab(doc, function(newTabUrl) { |
| 38 var listener = function(evt) { | 38 var listener = function(evt) { |
| 39 if (!evt.target.docUrl || evt.target.docUrl != newTabUrl) | 39 if (!evt.target.docUrl || evt.target.docUrl != newTabUrl) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 r.removeEventListener('loadComplete', listener, true); | 42 r.removeEventListener('loadComplete', listener, true); |
| 43 global.backgroundObj.onGotCommand('nextElement'); | 43 global.backgroundObj.onGotCommand('nextObject'); |
| 44 callback && callback(evt.target); | 44 callback && callback(evt.target); |
| 45 callback = null; | 45 callback = null; |
| 46 }; | 46 }; |
| 47 r.addEventListener('loadComplete', listener, true); | 47 r.addEventListener('loadComplete', listener, true); |
| 48 }.bind(this)); | 48 }.bind(this)); |
| 49 }.bind(this)); | 49 }.bind(this)); |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 listenOnce: function(node, eventType, callback, capture) { | 52 listenOnce: function(node, eventType, callback, capture) { |
| 53 var innerCallback = this.newCallback(function() { | 53 var innerCallback = this.newCallback(function() { |
| 54 node.removeEventListener(eventType, innerCallback, capture); | 54 node.removeEventListener(eventType, innerCallback, capture); |
| 55 callback.apply(this, arguments); | 55 callback.apply(this, arguments); |
| 56 }); | 56 }); |
| 57 node.addEventListener(eventType, innerCallback, capture); | 57 node.addEventListener(eventType, innerCallback, capture); |
| 58 } | 58 } |
| 59 }; | 59 }; |
| OLD | NEW |