Commit 704f2a4c authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Add two more OpenImageFiles FilesAppBrowserTest in Gallery

Recover the test coverage mentioned in crrev.com/568798. Add new tests
for Downloads and Drive to open a file in Gallery, and then once it is
shown, open another file in the open Gallery window.

Bug: 837551
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Iae20fd22340c43a99902da4c21966c918febfb80
Reviewed-on: https://chromium-review.googlesource.com/1120446Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571815}
parent 73ca25e7
......@@ -173,7 +173,9 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
FilesAppBrowserTest,
::testing::Values(TestCase("imageOpenDownloads").InGuestMode(),
TestCase("imageOpenDownloads"),
TestCase("imageOpenDrive")));
TestCase("imageOpenDrive"),
TestCase("imageOpenGalleryOpenDownloads"),
TestCase("imageOpenGalleryOpenDrive")));
WRAPPED_INSTANTIATE_TEST_CASE_P(
CreateNewFolder, /* create_new_folder.js */
......
......@@ -53,6 +53,56 @@ function imageOpen(path) {
]);
}
/**
* Tests opening the image Gallery from Files app: once the Gallery opens and
* shows the initial image, open a different image from FilesApp.
*
* @param {string} path Directory path (Downloads or Drive).
*/
function imageOpenGalleryOpen(path) {
let appId;
let galleryAppId;
const testImages = [ENTRIES.image3, ENTRIES.desktop];
StepsRunner.run([
// Open Files.App on |path|, add test images to Downloads and Drive.
function() {
setupAndWaitUntilReady(null, path, this.next, testImages, testImages);
},
// Open an image file in Files app.
function(results) {
appId = results.windowId;
remoteCall.callRemoteTestUtil(
'openFile', appId, [ENTRIES.image3.targetPath], this.next);
},
// Check: the Gallery window should open.
function(result) {
chrome.test.assertTrue(result);
galleryApp.waitForWindow('gallery.html').then(this.next);
},
// Check: the image should appear in the Gallery window.
function(windowId) {
galleryAppId = windowId;
galleryApp.waitForSlideImage(
galleryAppId, 640, 480, 'image3').then(this.next);
},
// Now open a different image file in Files app.
function() {
remoteCall.callRemoteTestUtil(
'openFile', appId, [ENTRIES.desktop.targetPath], this.next);
},
// Check: the new image should appear in the Gallery window.
function() {
galleryApp.waitForSlideImage(
galleryAppId, 800, 600, 'My Desktop Background').then(this.next);
},
function() {
checkIfNoErrorsOccured(this.next);
}
]);
}
testcase.imageOpenDownloads = function() {
imageOpen(RootPath.DOWNLOADS);
};
......@@ -61,4 +111,12 @@ testcase.imageOpenDrive = function() {
imageOpen(RootPath.DRIVE);
};
testcase.imageOpenGalleryOpenDownloads = function() {
imageOpenGalleryOpen(RootPath.DOWNLOADS);
};
testcase.imageOpenGalleryOpenDrive = function() {
imageOpenGalleryOpen(RootPath.DRIVE);
};
})();
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