| 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 /** | 5 /** |
| 6 * Returns if a video element playing the specified file meet the condition | 6 * Returns if a video element playing the specified file meet the condition |
| 7 * which is given by a parameter. | 7 * which is given by a parameter. |
| 8 * @param {string} filename Name of video file to be checked. This must be same | 8 * @param {string} filename Name of video file to be checked. This must be same |
| 9 * as entry.name() of the video file. | 9 * as entry.name() of the video file. |
| 10 * @param {function(!HTMLElement):boolean} testFunction | 10 * @param {function(!HTMLElement):boolean} testFunction |
| 11 */ | 11 */ |
| 12 function testElement(filename, testFunction) { | 12 function testElement(filename, testFunction) { |
| 13 for (var appId in window.background.appWindows) { | 13 for (var appId in window.background.appWindows) { |
| 14 var contentWindow = window.background.appWindows[appId].contentWindow; | 14 var contentWindow = window.background.appWindows[appId].contentWindow; |
| 15 if (contentWindow && | 15 if (contentWindow && |
| 16 contentWindow.document.title === filename) { | 16 contentWindow.document.title === filename) { |
| 17 var element = contentWindow.document.querySelector('video[src]'); | 17 var element = contentWindow.document.querySelector('video'); |
| 18 if (element && testFunction(element)) | 18 if (element && testFunction(element)) |
| 19 return true; | 19 return true; |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 return false; | 22 return false; |
| 23 } | 23 } |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Returns if the specified file is being played. | 26 * Returns if the specified file is being played. |
| 27 * | 27 * |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 * @param {!Array<string>} urls URLs to be opened. | 63 * @param {!Array<string>} urls URLs to be opened. |
| 64 * @param {function(string)} callback Completion callback with the new window's | 64 * @param {function(string)} callback Completion callback with the new window's |
| 65 * App ID. | 65 * App ID. |
| 66 */ | 66 */ |
| 67 test.util.async.openVideoPlayer = function(urls, callback) { | 67 test.util.async.openVideoPlayer = function(urls, callback) { |
| 68 openVideoPlayerWindow(urls).then(callback); | 68 openVideoPlayerWindow(urls).then(callback); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Register the test utils. | 71 // Register the test utils. |
| 72 test.util.registerRemoteTestUtils(); | 72 test.util.registerRemoteTestUtils(); |
| OLD | NEW |