| 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 GEN_INCLUDE([ | 5 GEN_INCLUDE([ |
| 6 'common.js', | 6 'common.js', |
| 7 'callback_helper.js']); | 7 'callback_helper.js']); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Base test fixture for ChromeVox end to end tests. | 10 * Base test fixture for ChromeVox end to end tests. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 }); | 70 }); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Launches the given document in a new tab. | 74 * Launches the given document in a new tab. |
| 75 * @param {function() : void} doc Snippet wrapped inside of a function. | 75 * @param {function() : void} doc Snippet wrapped inside of a function. |
| 76 * @param {function(url: string)} opt_callback Called once the | 76 * @param {function(url: string)} opt_callback Called once the |
| 77 * document is created. | 77 * document is created. |
| 78 */ | 78 */ |
| 79 runWithTab: function(doc, opt_callback) { | 79 runWithTab: function(doc, opt_callback) { |
| 80 var docString = TestUtils.extractHtmlFromCommentEncodedString(doc); | 80 var url = TestUtils.createUrlForDoc(doc); |
| 81 var url = 'data:text/html,<!doctype html>' + | |
| 82 docString + | |
| 83 '<!-- chromevox_next_test -->'; | |
| 84 var createParams = { | 81 var createParams = { |
| 85 active: true, | 82 active: true, |
| 86 url: url | 83 url: url |
| 87 }; | 84 }; |
| 88 chrome.tabs.create(createParams, function(tab) { | 85 chrome.tabs.create(createParams, function(tab) { |
| 89 if (opt_callback) | 86 if (opt_callback) |
| 90 opt_callback(tab.url); | 87 opt_callback(tab.url); |
| 91 }); | 88 }); |
| 92 }, | 89 }, |
| 93 | 90 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 115 * called. If this method is called one or more times, then | 112 * called. If this method is called one or more times, then |
| 116 * {@code testDone()} will be called when all callbacks have been called. | 113 * {@code testDone()} will be called when all callbacks have been called. |
| 117 * @param {Function=} opt_callback Wrapped callback that will have its this | 114 * @param {Function=} opt_callback Wrapped callback that will have its this |
| 118 * reference bound to the test fixture. | 115 * reference bound to the test fixture. |
| 119 * @return {Function} | 116 * @return {Function} |
| 120 */ | 117 */ |
| 121 newCallback: function(opt_callback) { | 118 newCallback: function(opt_callback) { |
| 122 return this.callbackHelper_.wrap(opt_callback); | 119 return this.callbackHelper_.wrap(opt_callback); |
| 123 } | 120 } |
| 124 }; | 121 }; |
| OLD | NEW |