Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/file_manager_browsertest/video_player/test_util.js |
| diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/video_player/test_util.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/video_player/test_util.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..43f57ca8c9459200054f4942200abe84ee5e465a |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/video_player/test_util.js |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +'use strict'; |
| + |
| +/** |
| + * Launches the video player with the given entries. |
| + * |
| + * @param {string} testVolumeName Test volume name passed to the addEntries |
| + * function. Either 'drive' or 'local'. |
| + * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. |
| + * @param {Array.<TestEntryInfo>} entries Entries to be parepared and passed to |
| + * the application. |
| + * @param {Array.<TestEntryInfo>=} opt_selected Entries to be selected. Should |
| + * be a sub-set of the entries argument. |
| + * @return {Promise} Promise to be fulfilled with the video player element. |
| + */ |
| +function launch( |
| + testVolumeName, volumeType, entries, opt_selected) { |
|
hirono
2014/08/20 04:14:06
nit: #19 and #20 matches one line?
yoshiki
2014/08/20 04:26:21
Done.
|
| + |
| + var entriesPromise = addEntries([testVolumeName], entries).then(function() { |
| + var selectedEntries = opt_selected || entries; |
| + return getFilesUnderVolume( |
| + volumeType, |
| + selectedEntries.map(function(entry) { return entry.nameText; })); |
| + }); |
| + |
| + var appWindow = null; |
| + return entriesPromise.then(function(entries) { |
| + return open(entries.map(function(entry) { |
| + return {entry: entry, title: entry.name, url: entry.toURL()}; |
| + })).then(function() { |
| + appWindow = appWindowsForTest[entries[0].name]; |
| + }); |
| + }).then(function() { |
| + return Promise.all([ |
| + waitForElement(appWindow, '#video-player[first-video][last-video]'), |
| + waitForElement(appWindow, '.play.media-button[state="playing"]'), |
| + ]).then(function(args) { |
| + return args[0]; |
| + }); |
| + }); |
| +} |