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

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/common/test_util_common.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/common/test_util_common.js
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/common/test_util_common.js
similarity index 53%
copy from chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js
copy to chrome/test/data/extensions/api_test/file_manager_browsertest/common/test_util_common.js
index 25c7f3b6e8d966decafd996674a7a65256a73398..fe4ea00c8e327bc9f68f8cba5fb2903f2990f1f7 100644
--- a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/common/test_util_common.js
@@ -12,14 +12,12 @@
* @return {Promise} Promise to be fulflled with Array.<FileEntry>.
*/
function getFilesUnderVolume(volumeType, names) {
- var displayRootPromise = backgroundComponentsPromise.then(
- function(backgroundComponent) {
- var volumeManager = backgroundComponent.volumeManager;
- var volumeInfo = volumeManager.getCurrentProfileVolumeInfo(volumeType);
- return new Promise(function(fulfill, reject) {
- volumeInfo.resolveDisplayRoot(fulfill, reject);
- });
- });
+ var displayRootPromise =
+ VolumeManager.getInstance().then(function(volumeManager) {
+ var volumeInfo = volumeManager.getCurrentProfileVolumeInfo(volumeType);
+ return volumeInfo.resolveDisplayRoot();
+ });
+
return displayRootPromise.then(function(displayRoot) {
var filesPromise = names.map(function(name) {
return new Promise(
@@ -64,61 +62,6 @@ function waitForElementLost(appWindow, query) {
}
/**
- * Launches the Gallery app with the test 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.
- */
-function launchWithTestEntries(
- 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; }));
- });
- return launch(entriesPromise).then(function() {
- var launchedPromise = Promise.all([appWindowPromise, entriesPromise]);
- return launchedPromise.then(function(results) {
- return {appWindow: results[0], entries: results[1]};
- });
- });
-}
-
-/**
- * Waits until the expected image is shown.
- *
- * @param {document} document Document.
- * @param {number} width Expected width of the image.
- * @param {number} height Expected height of the image.
- * @param {string} name Expected name of the image.
- * @return {Promise} Promsie to be fulfilled when the check is passed.
- */
-function waitForSlideImage(document, width, height, name) {
- var expected = {width: width, height: height, name: name};
- return repeatUntil(function() {
- var fullResCanvas = document.querySelector(
- '.gallery[mode="slide"] .content canvas.fullres');
- var nameBox = document.querySelector('.namebox');
- var actual = {
- width: fullResCanvas && fullResCanvas.width,
- height: fullResCanvas && fullResCanvas.height,
- name: nameBox && nameBox.value
- };
- if (!chrome.test.checkDeepEq(expected, actual)) {
- return pending('Slide mode state, expected is %j, actual is %j.',
- expected, actual);
- }
- return actual;
- });
-}
-
-/**
* Shorthand for clicking an element.
* @param {AppWindow} appWindow Application window.
* @param {string} query Query for the element.

Powered by Google App Engine
This is Rietveld 408576698