Commit 6f413cc6 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Improve OpenImageFiles FilesAppBrowserTest speed

Significant test-time can be shaved by testing one image for now since
testing two images (previous code) makes MSAN unhappy. Some better way
for testing the gallery-open-select-image case seems possible, and one
that could also be fast (that case is being removed in the CL).

That may be the focus of a future CL, but here our goal is to make the
test suite fast by testing one thing in a fixture, not multiple things
(see previous code). Herein, test open-an-image-in-gallery meaning one
image only, not two (since two costs us 2 x O(1)secs [1]), which might
help to get this test re-enabled on MSAN again (issue 837551).

As a reminder to future readers, this FilesApp test fixture only tests
opening and closing the Gallery from FileApp and that's all that needs
testing here. Refer to GalleryBrowserTest for the integration tests of
the Gallery features.

[1] The time it takes to decode and draw the JPEG image (~1sec) in the
test step is way longer than the time it takes libjpeg_turbo to decode
it (at most 10ms). Something else is taking up a lot of time, but I am
not sure what it is yet: thumb-nailing? image resizing? ...

Bug: 837551
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I9ac3b0433d8f5fbd2f04516af21bf17482eb8401
Reviewed-on: https://chromium-review.googlesource.com/1106178
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568798}
parent f8fc6394
......@@ -7,72 +7,47 @@
(function() {
/**
* Tests if the gallery shows up for the selected image and is loaded
* successfully.
* Tests opening (then closing) the image Gallery from Files app.
*
* @param {string} path Directory path to be tested.
* @param {string} path Directory path (Downloads or Drive).
*/
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.image3.getExpectedRow()]).sort();
let appId;
let galleryAppId;
StepsRunner.run([
// Open Files.App on |path|, add image3 to Downloads and Drive.
function() {
setupAndWaitUntilReady(null, path, this.next);
setupAndWaitUntilReady(
null, path, this.next, [ENTRIES.image3], [ENTRIES.image3]);
},
// Select the song.
// Open the image file in Files app.
function(results) {
appId = results.windowId;
// Add an additional image file.
addEntries(['local', 'drive'], [ENTRIES.image3], 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 the Files app.
remoteCall.callRemoteTestUtil(
'openFile', appId, ['My Desktop Background.png'], this.next);
'openFile', appId, [ENTRIES.image3.targetPath], this.next);
},
// Check: the Gallery window should open.
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 the Files app.
remoteCall.callRemoteTestUtil(
'openFile', appId, ['image3.jpg'], this.next);
},
function(result) {
chrome.test.assertTrue(result);
// Wait for the file opened.
// Check: the image should appear in the Gallery window.
function(windowId) {
galleryAppId = windowId;
galleryApp.waitForSlideImage(
galleryAppId, 640, 480, 'image3').then(this.next);
},
// Close the Gallery window.
function() {
// Close window
galleryApp.closeWindowAndWait(galleryAppId).then(this.next);
},
// Wait for closing.
// Check: the Gallery window should close.
function(result) {
chrome.test.assertTrue(result, 'Fail to close the window');
chrome.test.assertTrue(result, 'Failed to close Gallery window');
this.next();
},
function() {
checkIfNoErrorsOccured(this.next);
}
]);
......
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