| Index: chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js
|
| diff --git a/chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js b/chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js
|
| index 3d4dbf3bf4d38f96147591db19a3dedb0317615d..a70b8b77a598ac3b49906db2974bf062593a71a3 100644
|
| --- a/chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js
|
| +++ b/chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js
|
| @@ -14,23 +14,23 @@
|
| *
|
| * The test files on file systems should be created before running the test
|
| * extension. The test extension expects following hierarchy:
|
| - * mount_point_root - test_dir - - subdir
|
| - * |
|
| - * - empty_test_dir
|
| - * |
|
| - * - test_file.xul
|
| - * |
|
| - * - test_file.xul.foo
|
| - * |
|
| - * - test_file.tiff
|
| - * |
|
| - * - test_file.tiff.foo
|
| + * mount_point_root - root - test_dir - - subdir
|
| + * |
|
| + * - empty_test_dir
|
| + * |
|
| + * - test_file.xul
|
| + * |
|
| + * - test_file.xul.foo
|
| + * |
|
| + * - test_file.tiff
|
| + * |
|
| + * - test_file.tiff.foo
|
| *
|
| - * mount_point_root/test_dir/subdir/ will be used as destination dir for copy
|
| - * and move operations.
|
| - * mount_point_root/test_dir/empty_test_dir/ should be empty and will stay empty
|
| - * until the end of the test.
|
| - * mount_point_root/test_dir/test_file.xul will not change during the test.
|
| + * mount_point_root/root/test_dir/subdir/ will be used as destination dir for
|
| + * copy and move operations.
|
| + * mount_point_root/root/test_dir/empty_root/test_dir/ should be empty and will
|
| + * stay empty until the end of the test.
|
| + * mount_point_root/root/test_dir/test_file.xul will not change during the test.
|
| *
|
| * All files should initially have content: kInitialFileContent.
|
| */
|
| @@ -269,37 +269,37 @@ function collectTestsForMountPoint(mountPointName, mountPoint) {
|
| var testsToRun = [];
|
|
|
| testsToRun.push(function getDirectoryTest() {
|
| - getDirectory(mountPoint, 'test_dir', false, true, chrome.test.succeed);
|
| + getDirectory(mountPoint, 'root/test_dir', false, true, chrome.test.succeed);
|
| });
|
|
|
| testsToRun.push(function createDirectoryTest() {
|
| // callback checks whether the new directory exists after create operation.
|
| // It should exists iff the file system is not read only.
|
| var callback =
|
| - getDirectory.bind(null, mountPoint, 'new_test_dir', false, !isReadOnly,
|
| - chrome.test.succeed);
|
| + getDirectory.bind(null, mountPoint, 'root/new_test_dir', false,
|
| + !isReadOnly, chrome.test.succeed);
|
|
|
| // Create operation should succeed only for non read-only file systems.
|
| - getDirectory(mountPoint, 'new_test_dir', true, !isReadOnly, callback);
|
| + getDirectory(mountPoint, 'root/new_test_dir', true, !isReadOnly, callback);
|
| });
|
|
|
| testsToRun.push(function getFileTest() {
|
| - getFile(mountPoint, 'test_dir/test_file.xul', false, true,
|
| + getFile(mountPoint, 'root/test_dir/test_file.xul', false, true,
|
| chrome.test.succeed);
|
| });
|
|
|
| testsToRun.push(function createFileTest() {
|
| // Checks whether the new file exists after create operation.
|
| // It should exists iff the file system is not read only.
|
| - var callback = getFile.bind(null, mountPoint, 'test_dir/new_file', false,
|
| - !isReadOnly, chrome.test.succeed);
|
| + var callback = getFile.bind(null, mountPoint, 'root/test_dir/new_file',
|
| + false, !isReadOnly, chrome.test.succeed);
|
|
|
| // Create operation should succeed only for non read-only file systems.
|
| - getFile(mountPoint, 'test_dir/new_file', true, !isReadOnly, callback);
|
| + getFile(mountPoint, 'root/test_dir/new_file', true, !isReadOnly, callback);
|
| });
|
|
|
| testsToRun.push(function readFileTest() {
|
| - readFileAndExpectContent(mountPoint, 'test_dir/test_file.xul',
|
| + readFileAndExpectContent(mountPoint, 'root/test_dir/test_file.xul',
|
| kInitialFileContent, chrome.test.succeed);
|
| });
|
|
|
| @@ -309,12 +309,12 @@ function collectTestsForMountPoint(mountPointName, mountPoint) {
|
| // Check file content after write operation. The content should not change
|
| // on read-only file system.
|
| var callback = readFileAndExpectContent.bind(null,
|
| - mountPoint, 'test_dir/test_file.tiff', expectedFinalContent,
|
| + mountPoint, 'root/test_dir/test_file.tiff', expectedFinalContent,
|
| chrome.test.succeed);
|
|
|
| // Write should fail only on read-only file system.
|
| - writeFile(mountPoint, 'test_dir/test_file.tiff', kWriteOffset, kWriteData,
|
| - !isReadOnly, callback);
|
| + writeFile(mountPoint, 'root/test_dir/test_file.tiff', kWriteOffset,
|
| + kWriteData, !isReadOnly, callback);
|
| });
|
|
|
| testsToRun.push(function truncateFileShortTest() {
|
| @@ -323,12 +323,12 @@ function collectTestsForMountPoint(mountPointName, mountPoint) {
|
| // Check file content after truncate operation. The content should not
|
| // change on read-only file system.
|
| var callback = readFileAndExpectContent.bind(null,
|
| - mountPoint, 'test_dir/test_file.tiff', expectedFinalContent,
|
| + mountPoint, 'root/test_dir/test_file.tiff', expectedFinalContent,
|
| chrome.test.succeed);
|
|
|
| // Truncate should fail only on read-only file system.
|
| - truncateFile(mountPoint, 'test_dir/test_file.tiff', kTruncateShortLength,
|
| - !isReadOnly, callback);
|
| + truncateFile(mountPoint, 'root/test_dir/test_file.tiff',
|
| + kTruncateShortLength, !isReadOnly, callback);
|
| });
|
|
|
| testsToRun.push(function truncateFileLongTest() {
|
| @@ -337,23 +337,23 @@ function collectTestsForMountPoint(mountPointName, mountPoint) {
|
| // Check file content after truncate operation. The content should not
|
| // change on read-only file system.
|
| var callback = readFileAndExpectContent.bind(null,
|
| - mountPoint, 'test_dir/test_file.tiff', expectedFinalContent,
|
| + mountPoint, 'root/test_dir/test_file.tiff', expectedFinalContent,
|
| chrome.test.succeed);
|
|
|
| // Truncate should fail only on read-only file system.
|
| - truncateFile(mountPoint, 'test_dir/test_file.tiff', kTruncateLongLength,
|
| - !isReadOnly, callback);
|
| + truncateFile(mountPoint, 'root/test_dir/test_file.tiff',
|
| + kTruncateLongLength, !isReadOnly, callback);
|
| });
|
|
|
| // Skip abort tests for read-only file systems.
|
| if (!isReadOnly) {
|
| testsToRun.push(function abortWriteTest() {
|
| - abortWriteFile(mountPoint, 'test_dir/test_file.xul.foo',
|
| + abortWriteFile(mountPoint, 'root/test_dir/test_file.xul.foo',
|
| chrome.test.succeed);
|
| });
|
|
|
| testsToRun.push(function abortTruncateTest() {
|
| - abortTruncateFile(mountPoint, 'test_dir/test_file.xul.foo',
|
| + abortTruncateFile(mountPoint, 'root/test_dir/test_file.xul.foo',
|
| chrome.test.succeed);
|
| });
|
| }
|
| @@ -363,21 +363,22 @@ function collectTestsForMountPoint(mountPointName, mountPoint) {
|
| if (isReadOnly) {
|
| // If the file system is read-only, the target file should not exist after
|
| // copy operation.
|
| - verifyTarget = getFile.bind(null, mountPoint, 'test_dir/subdir/copy',
|
| + verifyTarget = getFile.bind(null, mountPoint, 'root/test_dir/subdir/copy',
|
| false, false, chrome.test.succeed);
|
| } else {
|
| // If the file system is not read-only, the target file should be created
|
| // during copy operation and its content should match the source file.
|
| verifyTarget = readFileAndExpectContent.bind(null, mountPoint,
|
| - 'test_dir/subdir/copy', kInitialFileContent, chrome.test.succeed);
|
| + 'root/test_dir/subdir/copy', kInitialFileContent,
|
| + chrome.test.succeed);
|
| }
|
|
|
| // Verify the source file stil exists and its content hasn't changed.
|
| var verifySource = readFileAndExpectContent.bind(null, mountPoint,
|
| - 'test_dir/test_file.xul', kInitialFileContent, verifyTarget);
|
| + 'root/test_dir/test_file.xul', kInitialFileContent, verifyTarget);
|
|
|
| // Copy file should fail on read-only file system.
|
| - copyFile(mountPoint, 'test_dir/test_file.xul', 'test_dir/subdir',
|
| + copyFile(mountPoint, 'root/test_dir/test_file.xul', 'root/test_dir/subdir',
|
| 'copy', !isReadOnly, chrome.test.succeed);
|
| });
|
|
|
| @@ -386,56 +387,59 @@ function collectTestsForMountPoint(mountPointName, mountPoint) {
|
| if (isReadOnly) {
|
| // If the file system is read-only, the target file should not be created
|
| // during move.
|
| - verifyTarget = getFile.bind(null, mountPoint, 'test_dir/subdir/move',
|
| + verifyTarget = getFile.bind(null, mountPoint, 'root/test_dir/subdir/move',
|
| false, false, chrome.test.succeed);
|
| } else {
|
| // If the file system is read-only, the target file should be created
|
| // during move and its content should match the source file.
|
| verifyTarget = readFileAndExpectContent.bind(null, mountPoint,
|
| - 'test_dir/subdir/move', kInitialFileContent, chrome.test.succeed);
|
| + 'root/test_dir/subdir/move', kInitialFileContent,
|
| + chrome.test.succeed);
|
| }
|
|
|
| // On read-only file system the source file should still exist. Otherwise
|
| // the source file should have been deleted during move operation.
|
| var verifySource = getFile.bind(null, mountPoint,
|
| - 'test_dir/test_file.xul', false, isReadOnly, verifyTarget);
|
| + 'root/test_dir/test_file.xul', false, isReadOnly, verifyTarget);
|
|
|
| // Copy file should fail on read-only file system.
|
| - moveFile(mountPoint, 'test_dir/test_file.xul', 'test_dir/subdir',
|
| + moveFile(mountPoint, 'root/test_dir/test_file.xul', 'root/test_dir/subdir',
|
| 'move', !isReadOnly, chrome.test.succeed);
|
| });
|
|
|
| testsToRun.push(function deleteFileTest() {
|
| // Verify that file exists after delete operation if and only if the file
|
| // system is read only.
|
| - var callback = getFile.bind(null, mountPoint, 'test_dir/test_file.xul.foo',
|
| + var callback = getFile.bind(null, mountPoint,
|
| + 'root/test_dir/test_file.xul.foo',
|
| false, isReadOnly, chrome.test.succeed);
|
|
|
| // Delete operation should fail for read-only file systems.
|
| - deleteFile(mountPoint, 'test_dir/test_file.xul.foo', !isReadOnly, callback);
|
| + deleteFile(mountPoint, 'root/test_dir/test_file.xul.foo', !isReadOnly,
|
| + callback);
|
| });
|
|
|
| testsToRun.push(function deleteEmptyDirectoryTest() {
|
| // Verify that the directory exists after delete operation if and only if
|
| // the file system is read-only.
|
| var callback = getDirectory.bind(null, mountPoint,
|
| - 'test_dir/empty_test_dir', false, isReadOnly, chrome.test.succeed);
|
| + 'root/test_dir/empty_test_dir', false, isReadOnly, chrome.test.succeed);
|
|
|
| // Deleting empty directory should fail for read-only file systems, and
|
| // succeed otherwise.
|
| - deleteDirectory(mountPoint, 'test_dir/empty_test_dir', !isReadOnly,
|
| + deleteDirectory(mountPoint, 'root/test_dir/empty_test_dir', !isReadOnly,
|
| callback);
|
| });
|
|
|
| testsToRun.push(function deleteDirectoryTest() {
|
| // The directory exists if and only if the file system is not drive.
|
| - var callback = getDirectory.bind(null, mountPoint, 'test_dir', false,
|
| + var callback = getDirectory.bind(null, mountPoint, 'root/test_dir', false,
|
| !isOnDrive, chrome.test.succeed);
|
|
|
| // The directory should still contain some files, so non-recursive delete
|
| // should fail. The drive file system does not respect is_recursive flag, so
|
| // the operation succeeds.
|
| - deleteDirectory(mountPoint, 'test_dir', isOnDrive, callback);
|
| + deleteDirectory(mountPoint, 'root/test_dir', isOnDrive, callback);
|
| });
|
|
|
| // On drive, the directory was deleted in the previous test.
|
| @@ -443,11 +447,12 @@ function collectTestsForMountPoint(mountPointName, mountPoint) {
|
| testsToRun.push(function deleteDirectoryRecursivelyTest() {
|
| // Verify that the directory exists after delete operation if and only if
|
| // the file system is read-only.
|
| - var callback = getDirectory.bind(null, mountPoint, 'test_dir', false,
|
| + var callback = getDirectory.bind(null, mountPoint, 'root/test_dir', false,
|
| isReadOnly, chrome.test.succeed);
|
|
|
| // Recursive delete dhouls fail only for read-only file system.
|
| - deleteDirectoryRecursively(mountPoint, 'test_dir', !isReadOnly, callback);
|
| + deleteDirectoryRecursively(mountPoint, 'root/test_dir', !isReadOnly,
|
| + callback);
|
| });
|
| }
|
|
|
|
|