Commit 9b70272b authored by yoshiki's avatar yoshiki Committed by Commit bot

[Files.app] Add tests of opening Gallery from Files.app

BUG=465575
TEST=browser_test passes

Review URL: https://codereview.chromium.org/1011663002

Cr-Commit-Position: refs/heads/master@{#320866}
parent 95151588
......@@ -867,6 +867,20 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
TestParameter(NOT_IN_GUEST_MODE, "audioRepeatMultipleFileDrive"),
TestParameter(NOT_IN_GUEST_MODE, "audioNoRepeatMultipleFileDrive")));
// Slow tests are disabled on debug build. http://crbug.com/327719
// Fails on official build. http://crbug.com/429294
#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
#define MAYBE_OpenImageFiles DISABLED_OpenImageFiles
#else
#define MAYBE_OpenImageFiles OpenImageFiles
#endif
WRAPPED_INSTANTIATE_TEST_CASE_P(
MAYBE_OpenImageFiles,
FileManagerBrowserTest,
::testing::Values(TestParameter(IN_GUEST_MODE, "imageOpenDownloads"),
TestParameter(NOT_IN_GUEST_MODE, "imageOpenDownloads"),
TestParameter(NOT_IN_GUEST_MODE, "imageOpenDrive")));
// Slow tests are disabled on debug build. http://crbug.com/327719
#if !defined(NDEBUG) || defined(OFFICIAL_BUILD)
#define MAYBE_CreateNewFolder DISABLED_CreateNewFolder
......
......@@ -13,6 +13,15 @@ var FILE_MANAGER_EXTENSIONS_ID = 'hhaomjibdihmijegdhdafkllkbggdgoj';
var remoteCall = new RemoteCallFilesApp(FILE_MANAGER_EXTENSIONS_ID);
/**
* Extension ID of Gallery.
* @type {string}
* @const
*/
var GALLERY_APP_ID = 'nlkncpkkdoccmpiclbokaimcnedabhhm';
var galleryApp = new RemoteCallGallery(GALLERY_APP_ID);
/**
* Extension ID of Audio Player.
* @type {string}
......
// Copyright 2015 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';
(function() {
/**
* Tests if the gallery shows up for the selected image and is loaded
* successfully.
*
* @param {string} path Directory path to be tested.
*/
function imageOpen(path) {
var appId;
var galleryAppId;
var expectedFilesBefore =
TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ?
BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort();
var expectedFilesAfter =
expectedFilesBefore.concat([ENTRIES.image2.getExpectedRow()]).sort();
StepsRunner.run([
function() {
setupAndWaitUntilReady(null, path, this.next);
},
// Select the song.
function(inAppId) {
appId = inAppId;
// Add an additional image file.
addEntries(['local', 'drive'], [ENTRIES.image2], this.next);
},
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForFileListChange(appId, expectedFilesBefore.length).
then(this.next);
},
function(actualFilesAfter) {
chrome.test.assertEq(expectedFilesAfter, actualFilesAfter);
// Open a file in Files.app.
remoteCall.callRemoteTestUtil(
'openFile', appId, ['My Desktop Background.png'], this.next);
},
function(result) {
chrome.test.assertTrue(result);
// Wait for the window.
galleryApp.waitForWindow('gallery.html').then(this.next);
},
function(inAppId) {
galleryAppId = inAppId;
// Wait for the file opened.
galleryApp.waitForSlideImage(
galleryAppId, 800, 600, 'My Desktop Background').then(this.next);
},
function() {
// Open another file in Files.app.
remoteCall.callRemoteTestUtil(
'openFile', appId, ['image2.png'], this.next);
},
function(result) {
chrome.test.assertTrue(result);
// Wait for the file opened.
galleryApp.waitForSlideImage(
galleryAppId, 1024, 768, 'image2').then(this.next);
},
function() {
// Close window
galleryApp.closeWindowAndWait(galleryAppId).then(this.next);
},
// Wait for closing.
function(result) {
chrome.test.assertTrue(result, 'Fail to close the window');
checkIfNoErrorsOccured(this.next);
}
]);
}
testcase.imageOpenDownloads = function() {
imageOpen(RootPath.DOWNLOADS);
};
testcase.imageOpenDrive = function() {
imageOpen(RootPath.DRIVE);
};
})();
......@@ -21,6 +21,7 @@
"file_manager/grid_view.js",
"file_manager/keyboard_operations.js",
"file_manager/open_audio_files.js",
"file_manager/open_image_files.js",
"file_manager/open_video_files.js",
"file_manager/open_zip_files.js",
"file_manager/restore_geometry.js",
......
......@@ -220,7 +220,7 @@ var ENTRIES = {
image2: new TestEntryInfo(
EntryType.FILE, 'image2.png', 'image2.png',
'image/png', SharedOption.NONE, 'Jan 18, 2038, 1:02 AM',
'image2.png', '272 bytes', 'PNG image'),
'image2.png', '4 KB', 'PNG image'),
image3: new TestEntryInfo(
EntryType.FILE, 'image3.jpg', 'image3.jpg',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment