Commit 03ea533a authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Speed-up keyboard_operations.js copy file tests

Speed-up these copy tests by loading the one file needed for the test,
and adjust test comments.

Test: browser_tests --gtest_filter="*/FilesApp*keyboardCopy*"
Bug: 873915
Change-Id: Icbac3f7dd25dfae5b1119f021e5b336a4406ff7a
Reviewed-on: https://chromium-review.googlesource.com/1174337Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583121}
parent 398286b6
...@@ -77,41 +77,38 @@ function waitForDirectoryItemLost(windowId, name) { ...@@ -77,41 +77,38 @@ function waitForDirectoryItemLost(windowId, name) {
} }
/** /**
* Tests copying a file to the same directory and waits until the file list * Tests copying a file to the same volume path file list.
* changes.
* *
* @param {string} path Directory path to be tested, Downloads or Drive. * @param {string} path The path to be tested, Downloads or Drive.
*/ */
function keyboardCopy(path, callback) { function keyboardCopy(path, callback) {
var filename = 'world.ogv'; let fileListBefore;
var expectedFilesBefore = let appId;
TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ?
BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort();
var expectedFilesAfter =
expectedFilesBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]);
var appId;
StepsRunner.run([ StepsRunner.run([
// Open Files app on |path|. // Open Files app on |path| containing one file entry: world.
function() { function() {
setupAndWaitUntilReady(null, path, this.next); setupAndWaitUntilReady(
null, path, this.next, [ENTRIES.world], [ENTRIES.world]);
}, },
// Copy the file. // Copy the file into the same file list.
function(results) { function(results) {
appId = results.windowId; appId = results.windowId;
var fileListBefore = results.fileList; fileListBefore = results.fileList;
chrome.test.assertEq(expectedFilesBefore, fileListBefore); remoteCall.callRemoteTestUtil(
remoteCall.callRemoteTestUtil('copyFile', appId, [filename], this.next); 'copyFile', appId, ['world.ogv'], this.next);
}, },
// Wait for a file list change. // Check: the copied file should appear in the file list.
function(result) { function(result) {
chrome.test.assertTrue(result); chrome.test.assertTrue(!!result, 'copyFile failed');
remoteCall.waitForFiles( const expectedFilesAfter =
appId, expectedFilesAfter, {ignoreLastModifiedTime: true}). fileListBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]);
then(this.next); remoteCall
.waitForFiles(
appId, expectedFilesAfter, {ignoreLastModifiedTime: true})
.then(this.next);
}, },
// Verify the result. function() {
function(fileList) {
checkIfNoErrorsOccured(this.next); checkIfNoErrorsOccured(this.next);
} }
]); ]);
...@@ -121,7 +118,7 @@ function keyboardCopy(path, callback) { ...@@ -121,7 +118,7 @@ function keyboardCopy(path, callback) {
* Tests deleting an entry from the file list. The entry is also shown in the * Tests deleting an entry from the file list. The entry is also shown in the
* directory tree, and should not be shown there when it is deleted. * directory tree, and should not be shown there when it is deleted.
* *
* @param {string} path Directory path to be tested, Downloads or Drive. * @param {string} path The path to be tested, Downloads or Drive.
* @param {string} treeItem The directory tree item selector. * @param {string} treeItem The directory tree item selector.
*/ */
function keyboardDelete(path, treeItem) { function keyboardDelete(path, treeItem) {
......
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