cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject spec commit: CB-5404: Fix fragile file tests
Date Fri, 15 Nov 2013 16:54:35 GMT
Updated Branches:
  refs/heads/master a5d2413b5 -> e7c2630f4


CB-5404: Fix fragile file tests

Several tests are dependent on whether directory paths end in '/' or
not. Also, manually-created file and directory entries should have an
associated filesystem attribute. This patch fixes both issues.


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/e7c2630f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/e7c2630f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/e7c2630f

Branch: refs/heads/master
Commit: e7c2630f45f98fbf1e06040d228ad4f2d19b0544
Parents: a5d2413
Author: Ian Clelland <iclelland@chromium.org>
Authored: Fri Nov 15 10:15:37 2013 -0500
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Fri Nov 15 11:45:08 2013 -0500

----------------------------------------------------------------------
 autotest/tests/file.tests.js | 174 ++++++++++++++++++++------------------
 1 file changed, 93 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e7c2630f/autotest/tests/file.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/file.tests.js b/autotest/tests/file.tests.js
index 2727cef..2ccba6d 100644
--- a/autotest/tests/file.tests.js
+++ b/autotest/tests/file.tests.js
@@ -100,6 +100,16 @@ describe('File API', function() {
         });
     };
 
+    var joinURL = function(base, extension) {
+        if (base.charAt(base.length-1) !== '/' && extension.charAt(0) !== '/') {
+            return base + '/' + extension;
+        }
+        if (base.charAt(base.length-1) === '/' && extension.charAt(0) === '/') {
+            return base + exension.substring(1);
+        }
+        return base + extension;
+    };
+
     var createWin = function(module) {
         return jasmine.createSpy("Win").andCallFake(function() {
             console.log('[ERROR ' + module + '] Unexpected success callback');
@@ -287,7 +297,8 @@ describe('File API', function() {
                 waitsFor(function() { return resolveCallback.wasCalled; }, "createFile callback
never called", Tests.TEST_TIMEOUT);
             });
             it("file.spec.11 should error (NOT_FOUND_ERR) when resolving (non-existent) invalid
file name", function() {
-                var fail = jasmine.createSpy().andCallFake(function(error) {
+                var fileName = joinURL(root.toURL(), "this.is.not.a.valid.file.txt");
+                fail = jasmine.createSpy().andCallFake(function(error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
                 }),
@@ -295,7 +306,7 @@ describe('File API', function() {
 
                 // lookup file system entry
                 runs(function() {
-                    window.resolveLocalFileSystemURI("file:///this.is.not.a.valid.file.txt",
win, fail);
+                    window.resolveLocalFileSystemURI(fileName, win, fail);
                 });
 
                 waitsFor(function() { return fail.wasCalled; }, "error callback never called",
Tests.TEST_TIMEOUT);
@@ -383,7 +394,7 @@ describe('File API', function() {
     describe('DirectoryEntry', function() {
         it("file.spec.16 getFile: get Entry for file that does not exist", function() {
             var fileName = "de.no.file",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 fail = jasmine.createSpy().andCallFake(function(error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
@@ -404,7 +415,7 @@ describe('File API', function() {
         });
         it("file.spec.17 getFile: create new file", function() {
             var fileName = "de.create.file",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 win = jasmine.createSpy().andCallFake(function(entry) {
                     expect(entry).toBeDefined();
                     expect(entry.isFile).toBe(true);
@@ -430,7 +441,7 @@ describe('File API', function() {
         });
         it("file.spec.18 getFile: create new file (exclusive)", function() {
             var fileName = "de.create.exclusive.file",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 win = jasmine.createSpy().andCallFake(function(entry) {
                     expect(entry).toBeDefined();
                     expect(entry.isFile).toBe(true);
@@ -457,7 +468,7 @@ describe('File API', function() {
         });
         it("file.spec.19 getFile: create file that already exists", function() {
             var fileName = "de.create.existing.file",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 getFile = jasmine.createSpy().andCallFake(function(file) {
                     // create:true, exclusive:false, file exists
                     runs(function() {
@@ -491,7 +502,7 @@ describe('File API', function() {
         });
         it("file.spec.20 getFile: create file that already exists (exclusive)", function()
{
             var fileName = "de.create.exclusive.existing.file",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 existingFile,
                 getFile = jasmine.createSpy().andCallFake(function(file) {
                     existingFile = file;
@@ -525,7 +536,7 @@ describe('File API', function() {
         });
         it("file.spec.21 DirectoryEntry.getFile: get Entry for existing file", function()
{
             var fileName = "de.get.file",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 win = jasmine.createSpy().andCallFake(function(entry) {
                     expect(entry).toBeDefined();
                     expect(entry.isFile).toBe(true);
@@ -581,7 +592,7 @@ describe('File API', function() {
         });
         it("file.spec.23 DirectoryEntry.getDirectory: get Entry for directory that does not
exist", function() {
             var dirName = "de.no.dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 fail = jasmine.createSpy().andCallFake(function(error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
@@ -602,7 +613,7 @@ describe('File API', function() {
         });
         it("file.spec.24 DirectoryEntry.getDirectory: create new dir with space then resolveFileSystemURI",
function() {
             var dirName = "de create dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 getDir = jasmine.createSpy().andCallFake(function(dirEntry) {
                     var dirURI = dirEntry.toURL();
                     // now encode URI and try to resolve
@@ -640,7 +651,7 @@ describe('File API', function() {
         });
         it("file.spec.25 DirectoryEntry.getDirectory: create new dir with space resolveFileSystemURI
with encoded URI", function() {
             var dirName = "de create dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 getDir = jasmine.createSpy().andCallFake(function(dirEntry) {
                     var dirURI = dirEntry.toURL();
                     // now encode URI and try to resolve
@@ -676,7 +687,7 @@ describe('File API', function() {
 
         it("file.spec.26 DirectoryEntry.getDirectory: create new directory", function() {
             var dirName = "de.create.dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 win = jasmine.createSpy().andCallFake(function(directory) {
                     expect(directory).toBeDefined();
                     expect(directory.isFile).toBe(false);
@@ -706,7 +717,7 @@ describe('File API', function() {
 
         it("file.spec.27 DirectoryEntry.getDirectory: create new directory (exclusive)",
function() {
             var dirName = "de.create.exclusive.dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 win = jasmine.createSpy().andCallFake(function(directory) {
                     expect(directory).toBeDefined();
                     expect(directory.isFile).toBe(false);
@@ -734,7 +745,7 @@ describe('File API', function() {
         });
         it("file.spec.28 DirectoryEntry.getDirectory: create directory that already exists",
function() {
             var dirName = "de.create.existing.dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 getDir = jasmine.createSpy().andCallFake(function(directory) {
                     // create:true, exclusive:false, directory exists
                     runs(function() {
@@ -769,7 +780,7 @@ describe('File API', function() {
         });
         it("file.spec.29 DirectoryEntry.getDirectory: create directory that already exists
(exclusive)", function() {
             var dirName = "de.create.exclusive.existing.dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 existingDir,
                 getDir = jasmine.createSpy().andCallFake(function(directory) {
                     existingDir = directory;
@@ -803,7 +814,7 @@ describe('File API', function() {
         });
         it("file.spec.30 DirectoryEntry.getDirectory: get Entry for existing directory",
function() {
             var dirName = "de.get.dir",
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 getDir = jasmine.createSpy().andCallFake(function(directory) {
                     // create:false, exclusive:false, directory exists
                     runs(function() {
@@ -859,7 +870,7 @@ describe('File API', function() {
         it("file.spec.32 DirectoryEntry.getDirectory: get DirectoryEntry for existing file",
function() {
             var fileName = "de.existing.file",
                 existingFile,
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 getDir = jasmine.createSpy().andCallFake(function(file) {
                     existingFile = file;
                     // create:false, exclusive:false, existing file
@@ -893,7 +904,7 @@ describe('File API', function() {
         it("file.spec.33 DirectoryEntry.getFile: get FileEntry for existing directory", function()
{
             var dirName = "de.existing.dir",
                 existingDir,
-                dirPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 getFile = jasmine.createSpy().andCallFake(function(directory) {
                     existingDir = directory;
                     // create:false, exclusive:false, existing directory
@@ -927,9 +938,8 @@ describe('File API', function() {
         it("file.spec.34 DirectoryEntry.removeRecursively on directory", function() {
             var dirName = "de.removeRecursively",
                 subDirName = "dir",
-                dirPath = root.fullPath + '/' + dirName,
-                //subDirPath = this.root.fullPath + '/' + subDirName,
-                subDirPath = dirPath + '/' + subDirName,
+                dirPath = joinURL(root.fullPath, dirName),
+                subDirPath = joinURL(dirPath, subDirName),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
                     // delete directory
                     var deleteDirectory = jasmine.createSpy().andCallFake(function(directory)
{
@@ -1062,7 +1072,7 @@ describe('File API', function() {
             });
             it("file.spec.38 should read contents of directory that has been removed", function()
{
                 var dirName = "de.createReader.notfound",
-                    dirPath = root.fullPath + '/' + dirName,
+	                dirPath = joinURL(root.fullPath, dirName),
                     entryCallback = jasmine.createSpy().andCallFake(function(directory) {
                         // read entries
                         var readEntries = jasmine.createSpy().andCallFake(function() {
@@ -1261,7 +1271,7 @@ describe('File API', function() {
     describe('Entry', function() {
         it("file.spec.45 Entry object", function() {
             var fileName = "entry",
-                fullPath = root.fullPath + '/' + fileName,
+                fullPath = joinURL(root.fullPath, fileName),
                 fail = createFail('Entry'),
                 itEntry = jasmine.createSpy().andCallFake(function(entry) {
                     expect(entry).toBeDefined();
@@ -1489,7 +1499,7 @@ describe('File API', function() {
         });
         it("file.spec.53 Entry.remove on file", function() {
             var fileName = "entry.rm.file",
-                fullPath = root.fullPath + '/' + fileName,
+                fullPath = joinURL(root.fullPath, fileName),
                 win = createWin('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
                     var checkRemove = jasmine.createSpy().andCallFake(function() {
@@ -1530,7 +1540,7 @@ describe('File API', function() {
         });
         it("file.spec.54 remove on empty directory", function() {
             var dirName = "entry.rm.dir",
-                fullPath = root.fullPath + '/' + dirName,
+                dirPath = joinURL(root.fullPath, dirName),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
                     var checkRemove = jasmine.createSpy().andCallFake(function() {
                         runs(function() {
@@ -1572,8 +1582,8 @@ describe('File API', function() {
         });
         it("file.spec.55 remove on non-empty directory", function() {
             var dirName = "entry.rm.dir.not.empty",
-                fullPath = root.fullPath + '/' + dirName,
                 fileName = "remove.txt",
+                fullPath = joinURL(root.fullPath, dirName),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
                     var checkFile = jasmine.createSpy().andCallFake(function(error) {
                         expect(error).toBeDefined();
@@ -1644,7 +1654,7 @@ describe('File API', function() {
         it("file.spec.57 copyTo: file", function() {
             var file1 = "entry.copy.file1",
                 file2 = "entry.copy.file2",
-                fullPath = root.fullPath + '/' + file2,
+                fullPath = joinURL(root.fullPath, file2),
                 fail = createFail('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
                     // copy file1 to file2
@@ -1729,8 +1739,8 @@ describe('File API', function() {
             var file1 = "file1",
                 srcDir = "entry.copy.srcDir",
                 dstDir = "entry.copy.dstDir",
-                dstPath = root.fullPath + '/' + dstDir,
-                filePath = dstPath + '/' + file1,
+                dstPath = joinURL(root.fullPath, dstDir),
+                filePath = joinURL(dstPath, file1),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
                     var copyDir = jasmine.createSpy().andCallFake(function(fileEntry) {
                         // copy srcDir to dstDir
@@ -1803,8 +1813,8 @@ describe('File API', function() {
             var file1 = "file1",
                 srcDir = "entry.copy.srcDirSame",
                 dstDir = "entry.copy.srcDirSame-backup",
-                dstPath = root.fullPath + '/' + dstDir,
-                filePath = dstPath + '/' + file1,
+                dstPath = joinURL(root.fullPath, dstDir),
+                filePath = joinURL(dstPath, file1),
                 fail = createFail('Entry copyTo: directory to backup at same root'),
                 entryCallback = function(directory) {
                     var copyDir = function(fileEntry) {
@@ -1861,8 +1871,8 @@ describe('File API', function() {
         it("file.spec.61 copyTo: directory onto itself", function() {
             var file1 = "file1",
                 srcDir = "entry.copy.dos.srcDir",
-                srcPath = root.fullPath + '/' + srcDir,
-                filePath = srcPath + '/' + file1,
+                srcPath = joinURL(root.fullPath, srcDir),
+                filePath = joinURL(srcPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry copyTo: directory onto itself'),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
@@ -1928,7 +1938,7 @@ describe('File API', function() {
                 dstDir = "entry.copy.dis.dstDir",
                 fail = createFail('Entry'),
                 win = createWin('Entry'),
-                srcPath = root.fullPath + '/' + srcDir,
+                srcPath = joinURL(root.fullPath, srcDir),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
                     // copy source directory into itself
                     runs(function() {
@@ -1972,14 +1982,15 @@ describe('File API', function() {
         it("file.spec.63 copyTo: directory that does not exist", function() {
             var file1 = "entry.copy.dnf.file1",
                 dstDir = "entry.copy.dnf.dstDir",
-                filePath = root.fullPath + '/' + file1,
-                dstPath = root.fullPath + '/' + dstDir,
+                filePath = joinURL(root.fullPath, file1),
+                dstPath = joinURL(root.fullPath, dstDir),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
                     // copy file to target directory that does not exist
                     runs(function() {
                         directory = new DirectoryEntry();
+                        directory.filesystem = root.filesystem;
                         directory.fullPath = dstPath;
                         entry.copyTo(directory, null, win, itCopy);
                     });
@@ -2019,7 +2030,7 @@ describe('File API', function() {
         it("file.spec.64 copyTo: invalid target name", function() {
             var file1 = "entry.copy.itn.file1",
                 file2 = "bad:file:name",
-                filePath = root.fullPath + '/' + file1,
+                filePath = joinURL(root.fullPath, file1),
                 fail = createFail('Entry'),
                 win = createWin('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
@@ -2054,8 +2065,8 @@ describe('File API', function() {
         it("file.spec.65 moveTo: file to same parent", function() {
             var file1 = "entry.move.fsp.file1",
                 file2 = "entry.move.fsp.file2",
-                srcPath = root.fullPath + '/' + file1,
-                dstPath = root.fullPath + '/' + file2,
+                srcPath = joinURL(root.fullPath, file1),
+                dstPath = joinURL(root.fullPath, file2),
                 fail = createFail('Entry'),
                 win = createWin('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
@@ -2115,10 +2126,10 @@ describe('File API', function() {
         it("file.spec.66 moveTo: file to new parent", function() {
             var file1 = "entry.move.fnp.file1",
                 dir = "entry.move.fnp.dir",
-                srcPath = root.fullPath + '/' + file1,
+                srcPath = joinURL(root.fullPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
-                dstPath = root.fullPath + '/' + dir + '/' + file1,
+                dstPath = joinURL(joinURL(root.fullPath, dir), file1),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
                     // move file1 to new directory
                     var moveFile = jasmine.createSpy().andCallFake(function(directory) {
@@ -2188,9 +2199,9 @@ describe('File API', function() {
             var file1 = "file1",
                 srcDir = "entry.move.dsp.srcDir",
                 dstDir = "entry.move.dsp.dstDir",
-                srcPath = root.fullPath + '/' + srcDir,
-                dstPath = root.fullPath + '/' + dstDir,
-                filePath = dstPath + '/' + file1,
+                srcPath = joinURL(root.fullPath, srcDir),
+                dstPath = joinURL(root.fullPath, dstDir),
+                filePath = joinURL(dstPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
@@ -2263,9 +2274,9 @@ describe('File API', function() {
             var file1 = "file1",
                 srcDir = "entry.move.dsp.srcDir",
                 dstDir = "entry.move.dsp.srcDir-backup",
-                srcPath = root.fullPath + '/' + srcDir,
-                dstPath = root.fullPath + '/' + dstDir,
-                filePath = dstPath + '/' + file1,
+                srcPath = joinURL(root.fullPath, srcDir),
+                dstPath = joinURL(root.fullPath, dstDir),
+                filePath = joinURL(dstPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
@@ -2336,9 +2347,9 @@ describe('File API', function() {
             var file1 = "file1",
                 srcDir = "entry.move.dnp.srcDir",
                 dstDir = "entry.move.dnp.dstDir",
-                srcPath = root.fullPath + '/' + srcDir,
-                dstPath = root.fullPath + '/' + dstDir,
-                filePath = dstPath + '/' + file1,
+                srcPath = joinURL(root.fullPath, srcDir),
+                dstPath = joinURL(root.fullPath, dstDir),
+                filePath = joinURL(dstPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
@@ -2408,8 +2419,8 @@ describe('File API', function() {
         it("file.spec.70 moveTo: directory onto itself", function() {
             var file1 = "file1",
                 srcDir = "entry.move.dos.srcDir",
-                srcPath = root.fullPath + '/' + srcDir,
-                filePath = srcPath + '/' + file1,
+                srcPath = joinURL(root.fullPath, srcDir),
+                filePath = joinURL(srcPath, file1),
                 fail = createFail('Entry'),
                 win = createWin('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
@@ -2474,7 +2485,7 @@ describe('File API', function() {
         it("file.spec.71 moveTo: directory into itself", function() {
             var srcDir = "entry.move.dis.srcDir",
                 dstDir = "entry.move.dis.dstDir",
-                srcPath = root.fullPath + '/' + srcDir,
+                srcPath = joinURL(root.fullPath, srcDir),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(directory) {
@@ -2518,7 +2529,7 @@ describe('File API', function() {
         });
         it("file.spec.72 moveTo: file onto itself", function() {
             var file1 = "entry.move.fos.file1",
-                filePath = root.fullPath + '/' + file1,
+                filePath = joinURL(root.fullPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = jasmine.createSpy().andCallFake(function(entry) {
@@ -2565,8 +2576,8 @@ describe('File API', function() {
             var file1 = "entry.move.fod.file1",
                 dstDir = "entry.move.fod.dstDir",
                 subDir = "subDir",
-                dirPath = root.fullPath + '/' + dstDir + '/' + subDir,
-                filePath = root.fullPath + '/' + file1,
+                dirPath = joinURL(joinURL(root.fullPath, dstDir), subDir),
+                filePath = joinURL(root.fullPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = function(entry) {
@@ -2621,8 +2632,8 @@ describe('File API', function() {
         it("file.spec.74 moveTo: directory onto existing file", function() {
             var file1 = "entry.move.dof.file1",
                 srcDir = "entry.move.dof.srcDir",
-                dirPath = root.fullPath + '/' + srcDir,
-                filePath = root.fullPath + '/' + file1,
+                dirPath = joinURL(root.fullPath, srcDir),
+                filePath = joinURL(root.fullPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = function(entry) {
@@ -2671,8 +2682,8 @@ describe('File API', function() {
         it("file.spec.75 copyTo: directory onto existing file", function() {
             var file1 = "entry.copy.dof.file1",
                 srcDir = "entry.copy.dof.srcDir",
-                dirPath = root.fullPath + '/' + srcDir,
-                filePath = root.fullPath + '/' + file1,
+                dirPath = joinURL(root.fullPath, srcDir),
+                filePath = joinURL(root.fullPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = function(entry) {
@@ -2722,8 +2733,8 @@ describe('File API', function() {
             var srcDir = "entry.move.dod.srcDir",
                 dstDir = "entry.move.dod.dstDir",
                 subDir = "subDir",
-                srcPath = root.fullPath + '/' + srcDir,
-                dstPath = root.fullPath + '/' + dstDir + '/' + subDir,
+                srcPath = joinURL(root.fullPath, srcDir),
+                dstPath = joinURL(joinURL(root.fullPath, dstDir), subDir),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = function(entry) {
@@ -2779,8 +2790,8 @@ describe('File API', function() {
         it("file.spec.77 moveTo: file replace existing file", function() {
             var file1 = "entry.move.frf.file1",
                 file2 = "entry.move.frf.file2",
-                file1Path = root.fullPath + '/' + file1,
-                file2Path = root.fullPath + '/' + file2,
+                file1Path = joinURL(root.fullPath, file1),
+                file2Path = joinURL(root.fullPath, file2),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = function(entry) {
@@ -2833,8 +2844,8 @@ describe('File API', function() {
             var file1 = "file1",
                 srcDir = "entry.move.drd.srcDir",
                 dstDir = "entry.move.drd.dstDir",
-                srcPath = root.fullPath + '/' + srcDir,
-                dstPath = root.fullPath + '/' + dstDir,
+                srcPath = joinURL(root.fullPath, srcDir),
+                dstPath = joinURL(root.fullPath, dstDir),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 filePath = dstPath + '/' + file1,
@@ -2894,13 +2905,14 @@ describe('File API', function() {
         it("file.spec.79 moveTo: directory that does not exist", function() {
             var file1 = "entry.move.dnf.file1",
                 dstDir = "entry.move.dnf.dstDir",
-                filePath = root.fullPath + '/' + file1,
-                dstPath = root.fullPath + '/' + dstDir,
+                filePath = joinURL(root.fullPath, file1),
+                dstPath = joinURL(root.fullPath, dstDir),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = function(entry) {
                     // move file to directory that does not exist
                     directory = new DirectoryEntry();
+                    directory.filesystem = root.filesystem;
                     directory.fullPath = dstPath;
                     entry.moveTo(directory, null, win, itMove);
                 },
@@ -2928,7 +2940,7 @@ describe('File API', function() {
         it("file.spec.80 moveTo: invalid target name", function() {
             var file1 = "entry.move.itn.file1",
                 file2 = "bad:file:name",
-                filePath = root.fullPath + '/' + file1,
+                filePath = joinURL(root.fullPath, file1),
                 win = createWin('Entry'),
                 fail = createFail('Entry'),
                 entryCallback = function(entry) {
@@ -2979,7 +2991,7 @@ describe('File API', function() {
             });
             reader.onerror = verifier;
             var myFile = new File();
-            myFile.fullPath = root.fullPath + '/' + "doesnotexist.err";
+            myFile.fullPath = joinURL(root.fullPath, "doesnotexist.err");
 
             reader.readAsText(myFile);
 
@@ -3187,7 +3199,7 @@ describe('File API', function() {
         it("file.spec.96 should be able to write and append to file, createWriter", function()
{
             var fileName = "writer.append",
                 theWriter,
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 // file content
                 rule = "There is an exception to every rule.",
                 // for checkin file length
@@ -3236,7 +3248,7 @@ describe('File API', function() {
         it("file.spec.97 should be able to write and append to file, File object", function()
{
             var fileName = "writer.append",
                 theWriter,
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 // file content
                 rule = "There is an exception to every rule.",
                 // for checking file length
@@ -3282,7 +3294,7 @@ describe('File API', function() {
         });
         it("file.spec.98 should be able to seek to the middle of the file and write more
data than file.length", function() {
             var fileName = "writer.seek.write",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 theWriter,
                 // file content
                 rule = "This is our sentence.",
@@ -3330,7 +3342,7 @@ describe('File API', function() {
         });
         it("file.spec.99 should be able to seek to the middle of the file and write less
data than file.length", function() {
             var fileName = "writer.seek.write2",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 // file content
                 rule = "This is our sentence.",
                 theWriter,
@@ -3379,7 +3391,7 @@ describe('File API', function() {
         });
         it("file.spec.100 should be able to write XML data", function() {
             var fileName = "writer.xml",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 fail = createFail('FileWriter'),
                 theWriter,
                 // file content
@@ -3416,7 +3428,7 @@ describe('File API', function() {
         });
         it("file.spec.101 should be able to write JSON data", function() {
             var fileName = "writer.json",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 theWriter,
                 // file content
                 rule = '{ "name": "Guy Incognito", "email": "here@there.com" }',
@@ -3540,7 +3552,7 @@ describe('File API', function() {
                 return;
             }
             var fileName = "bufferwriter.bin",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 theWriter,
                 // file content
                 data = new ArrayBuffer(32),
@@ -3586,7 +3598,7 @@ describe('File API', function() {
                 return;
             }
             var fileName = "blobwriter.bin",
-                filePath = root.fullPath + '/' + fileName,
+                filePath = joinURL(root.fullPath, fileName),
                 theWriter,
                 fail = createFail('FileWriter'),
                 // file content
@@ -3652,7 +3664,7 @@ describe('File API', function() {
                 }),
                 writeFile = function(fileName, fileData, win) {
                     var theWriter,
-                        filePath = root.fullPath + '/' + fileName,
+                        filePath = joinURL(root.fullPath, fileName),
                         // writes file content to new file
                         write_file = function(fileEntry) {
                             writerEntry = fileEntry;
@@ -3705,7 +3717,7 @@ describe('File API', function() {
                 }),
                 writeFile = function(fileName, fileData, win) {
                     var theWriter,
-                        filePath = root.fullPath + '/' + fileName,
+                        filePath = joinURL(root.fullPath, fileName),
                         // writes file content to new file
                         write_file = function(fileEntry) {
                             writerEntry = fileEntry;
@@ -3769,7 +3781,7 @@ describe('File API', function() {
                 }),
                 writeFile = function(fileName, fileData, win) {
                     var theWriter,
-                        filePath = root.fullPath + '/' + fileName,
+                        filePath = joinURL(root.fullPath, fileName),
                         // writes file content to new file
                         write_file = function(fileEntry) {
                             writerEntry = fileEntry;


Mime
View raw message