Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9244)

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/video_player/test_util.js

Issue 485013003: Video Player: Add a test to open a single video file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f8ccbe451bfb4ba34834a3785e71b10187088c28
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/video_player/test_util.js
@@ -0,0 +1,43 @@
+// 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) {
+
+ 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];
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698