Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1006)

Unified Diff: chrome/test/data/extensions/api_test/file_browser/filesystem_operations_test/test.js

Issue 13149003: drive: Use "/drive/root" namespace and fix Files app and tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..012e05295305548cced06ab90ec9b15491a68f9e 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,25 @@
*
* 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 exists only for Drive.
+ * 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_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.
*/
@@ -60,13 +62,20 @@ function assertEqAndRunCallback(expectedValue, value, errorMessage,
* as an argument. For Other methods, the callback argument should be ignored.
*/
+// Gets the path for operations. The path is relative to the mount point for
+// local entries and relative to the "My Drive" root for Drive entries.
+function getPath(relativePath, isOnDrive) {
+ return (isOnDrive ? 'root/' : '') + relativePath;
+}
+
// Gets the directory mountPoint/path
function getDirectory(mountPoint, path, shouldCreate, expectSuccess, callback) {
var messagePrefix = shouldCreate ? 'Creating ' : 'Getting ';
var message = messagePrefix + 'directory: \'' + path +'\'.';
+ var isOnDrive = mountPoint.fullPath == '/drive';
mountPoint.getDirectory(
- path, {create: shouldCreate},
+ getPath(path, isOnDrive), {create: shouldCreate},
assertEqAndRunCallback.bind(null, expectSuccess, true, message, callback),
assertEqAndRunCallback.bind(null, expectSuccess, false, message,
callback, null));
@@ -76,9 +85,10 @@ function getDirectory(mountPoint, path, shouldCreate, expectSuccess, callback) {
function getFile(mountPoint, path, shouldCreate, expectSuccess, callback) {
var messagePrefix = shouldCreate ? 'Creating ' : 'Getting ';
var message = messagePrefix + 'file: \'' + path +'\'.';
+ var isOnDrive = mountPoint.fullPath == '/drive';
mountPoint.getFile(
- path, {create: shouldCreate},
+ getPath(path, isOnDrive), {create: shouldCreate},
assertEqAndRunCallback.bind(null, expectSuccess, true, message, callback),
assertEqAndRunCallback.bind(null, expectSuccess, false, message,
callback, null));
@@ -88,7 +98,6 @@ function getFile(mountPoint, path, shouldCreate, expectSuccess, callback) {
// should always succeed.
function readFileAndExpectContent(mountPoint, path, expectedContent, callback) {
var message = 'Content of the file \'' + path + '\'.';
-
getFile(mountPoint, path, false, true, function(entry) {
var reader = new FileReader();
reader.onload = function() {
@@ -147,7 +156,6 @@ function abortWriteFile(mountPoint, path, callback) {
// Truncates file mountPoint/path to lenght |lenght|.
function truncateFile(mountPoint, path, length, expectSuccess, callback) {
var message = 'Truncating file: \'' + path + '\' to length ' + length + '.';
-
getFile(mountPoint, path, false, true, function(entry) {
entry.createWriter(function(writer) {
writer.onwrite = assertEqAndRunCallback.bind(null,

Powered by Google App Engine
This is Rietveld 408576698