| Index: ui/file_manager/integration_tests/file_manager/open_image_files.js
|
| diff --git a/ui/file_manager/integration_tests/file_manager/open_image_files.js b/ui/file_manager/integration_tests/file_manager/open_image_files.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5fa208b007769021bb84dc8058781b2a635d2189
|
| --- /dev/null
|
| +++ b/ui/file_manager/integration_tests/file_manager/open_image_files.js
|
| @@ -0,0 +1,89 @@
|
| +// 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);
|
| +};
|
| +
|
| +})();
|
|
|