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.
6 * Returns if the specified file is being played.
8 * @param {string} filename Name of audio file to be checked. This must be same
9 * as entry.name() of the audio file.
10 * @return {boolean} True if the video is playing, false otherwise.
12 test.util.sync.isPlaying = function(filename) {
13 for (var appId in window.background.appWindows) {
14 var contentWindow = window.background.appWindows[appId].contentWindow;
16 contentWindow.document.title === filename) {
17 var element = contentWindow.document.querySelector('video[src]');
18 if (element && !element.paused)
26 * Loads the mock of the cast extension.
28 * @param {Window} contentWindow Video player window to be chacked toOB.
30 test.util.sync.loadMockCastExtension = function(contentWindow) {
31 var script = contentWindow.document.createElement('script');
33 'chrome-extension://ljoplibgfehghmibaoaepfagnmbbfiga/' +
34 'cast_extension_mock/load.js';
35 contentWindow.document.body.appendChild(script);
39 * Opens the main Files.app's window and waits until it is ready.
41 * @param {Array.<string>} urls URLs to be opened.
42 * @param {number} pos Indes in the |urls| to be played at first
43 * @param {function(string)} callback Completion callback with the new window's
46 test.util.async.openVideoPlayer = function(urls, pos, callback) {
47 openVideoPlayerWindow({items: urls, position: pos}, false).then(callback);
50 // Register the test utils.
51 test.util.registerRemoteTestUtils();