| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 runWithLoadedTree: function(doc, callback, opt_url) { | 50 runWithLoadedTree: function(doc, callback, opt_url) { |
| 51 callback = this.newCallback(callback); | 51 callback = this.newCallback(callback); |
| 52 chrome.automation.getDesktop(function(r) { | 52 chrome.automation.getDesktop(function(r) { |
| 53 var url = opt_url || TestUtils.createUrlForDoc(doc); | 53 var url = opt_url || TestUtils.createUrlForDoc(doc); |
| 54 var listener = function(evt) { | 54 var listener = function(evt) { |
| 55 if (evt.target.root.url != url) | 55 if (evt.target.root.url != url) |
| 56 return; | 56 return; |
| 57 | 57 |
| 58 r.removeEventListener('focus', listener, true); | 58 r.removeEventListener('focus', listener, true); |
| 59 r.removeEventListener('loadComplete', listener, true); | 59 r.removeEventListener('loadComplete', listener, true); |
| 60 ChromeVoxState.instance.onGotCommand('nextObject'); | 60 global.backgroundObj.onGotCommand('nextObject'); |
| 61 callback && callback(evt.target); | 61 callback && callback(evt.target); |
| 62 callback = null; | 62 callback = null; |
| 63 }; | 63 }; |
| 64 r.addEventListener('focus', listener, true); | 64 r.addEventListener('focus', listener, true); |
| 65 r.addEventListener('loadComplete', listener, true); | 65 r.addEventListener('loadComplete', listener, true); |
| 66 var createParams = { | 66 var createParams = { |
| 67 active: true, | 67 active: true, |
| 68 url: url | 68 url: url |
| 69 }; | 69 }; |
| 70 chrome.tabs.create(createParams); | 70 chrome.tabs.create(createParams); |
| 71 }.bind(this)); | 71 }.bind(this)); |
| 72 }, | 72 }, |
| 73 | 73 |
| 74 listenOnce: function(node, eventType, callback, capture) { | 74 listenOnce: function(node, eventType, callback, capture) { |
| 75 var innerCallback = this.newCallback(function() { | 75 var innerCallback = this.newCallback(function() { |
| 76 node.removeEventListener(eventType, innerCallback, capture); | 76 node.removeEventListener(eventType, innerCallback, capture); |
| 77 callback.apply(this, arguments); | 77 callback.apply(this, arguments); |
| 78 }); | 78 }); |
| 79 node.addEventListener(eventType, innerCallback, capture); | 79 node.addEventListener(eventType, innerCallback, capture); |
| 80 } | 80 } |
| 81 }; | 81 }; |
| OLD | NEW |