Updated Branches: refs/heads/master 35a3f3f4a -> c3225a50f
described test condition, updated to test for NOT_FOUND_ERR Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/c3225a50 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/c3225a50 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/c3225a50 Branch: refs/heads/master Commit: c3225a50f48649bc66fd6c4e99b3e959d06a13b8 Parents: 35a3f3f Author: Jesse MacFadyen <purplecabb...@gmail.com> Authored: Tue May 8 17:16:43 2012 -0700 Committer: Jesse MacFadyen <purplecabb...@gmail.com> Committed: Tue May 8 17:16:43 2012 -0700 ---------------------------------------------------------------------- autotest/tests/file.tests.js | 272 ++++++++++++++++++------------------ 1 files changed, 136 insertions(+), 136 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/c3225a50/autotest/tests/file.tests.js ---------------------------------------------------------------------- diff --git a/autotest/tests/file.tests.js b/autotest/tests/file.tests.js index de37980..860a6c1 100644 --- a/autotest/tests/file.tests.js +++ b/autotest/tests/file.tests.js @@ -31,10 +31,10 @@ describe('File API', function() { // deletes specified file or directory var deleteEntry = function(name, success, error) { // deletes entry, if it exists - window.resolveLocalFileSystemURI(root.toURL() + '/' + name, + window.resolveLocalFileSystemURI(root.toURL() + '/' + name, function(entry) { if (entry.isDirectory === true) { - entry.removeRecursively(success, error); + entry.removeRecursively(success, error); } else { entry.remove(success, error); } @@ -42,7 +42,7 @@ describe('File API', function() { }; // deletes file, if it exists, then invokes callback var deleteFile = function(fileName, callback) { - root.getFile(fileName, null, + root.getFile(fileName, null, // remove file system entry function(entry) { entry.remove(callback, function() { console.log('[ERROR] deleteFile cleanup method invoked fail callback.'); }); @@ -59,7 +59,7 @@ describe('File API', function() { // deletes and re-creates the specified directory var createDirectory = function(dirName, success, error) { deleteEntry(dirName, function() { - root.getDirectory(dirName, {create: true}, success, error); + root.getDirectory(dirName, {create: true}, success, error); }, error); }; @@ -111,7 +111,7 @@ describe('File API', function() { expect(fileSystem.root).toBeDefined(); }), fail = createFail('window.requestFileSystem'); - + // retrieve PERSISTENT file system runs(function() { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, win, fail); @@ -134,7 +134,7 @@ describe('File API', function() { fail = createFail('window.requestFileSystem'); // Request the file system - runs(function() { + runs(function() { window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, win, fail); }); @@ -206,7 +206,7 @@ describe('File API', function() { }); waitsFor(function() { return win.wasCalled; }, "resolveLocalFileSystemURI callback never called", Tests.TEST_TIMEOUT); - + runs(function() { expect(win).toHaveBeenCalled(); expect(fail).not.toHaveBeenCalled(); @@ -237,13 +237,13 @@ describe('File API', function() { }); waitsFor(function() { return win.wasCalled; }, "resolveLocalFileSystemURI callback never called", Tests.TEST_TIMEOUT); - + runs(function() { expect(win).toHaveBeenCalled(); expect(fail).not.toHaveBeenCalled(); }); }); - + // create a new file entry runs(function() { createFile(fileName, resolveCallback, fail); @@ -251,13 +251,13 @@ describe('File API', function() { waitsFor(function() { return resolveCallback.wasCalled; }, "createFile callback never called", Tests.TEST_TIMEOUT); }); - it("should error out when resolving invalid file name", function() { + it("should error (NOT_FOUND_ERR) when resolving (non-existent) invalid file name", function() { var fail = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); }), win = createWin('window.resolveLocalFileSystemURI'); - + // lookup file system entry runs(function() { window.resolveLocalFileSystemURI("file:///this.is.not.a.valid.file.txt", win, fail); @@ -270,10 +270,10 @@ describe('File API', function() { expect(win).not.toHaveBeenCalled(); }); }); - it("resolve invalid URL", function() { + it("should error (NOT_FOUND_ERR) when resolving (non-existent) invalid URL", function() { var fail = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); - expect(error).toBeFileError(FileError.ENCODING_ERR); + expect(error).toBeFileError(FileError.NOT_FOUND_ERR); }), win = createWin('window.resolveLocalFileSystemURI'); @@ -331,7 +331,7 @@ describe('File API', function() { expect(entry.removeRecursively).toBeDefined(); }), fail = createFail('FileSystem'); - + runs(function() { window.resolveLocalFileSystemURI(root.toURL(), win, fail); }); @@ -357,7 +357,7 @@ describe('File API', function() { // create:false, exclusive:false, file does not exist runs(function() { - root.getFile(fileName, {create:false}, win, fail); + root.getFile(fileName, {create:false}, win, fail); }); waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT); @@ -380,10 +380,10 @@ describe('File API', function() { entry.remove(null, null); }), fail = createFail('DirectoryEntry'); - + // create:true, exclusive:false, file does not exist runs(function() { - root.getFile(fileName, {create: true}, win, fail); + root.getFile(fileName, {create: true}, win, fail); }); waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT); @@ -402,7 +402,7 @@ describe('File API', function() { expect(entry.isDirectory).toBe(false); expect(entry.name).toBe(fileName); expect(entry.fullPath).toBe(filePath); - + // cleanup entry.remove(null, null); }), @@ -443,7 +443,7 @@ describe('File API', function() { expect(entry.isDirectory).toBe(false); expect(entry.name).toBe(fileName); expect(entry.fullPath).toBe(filePath); - + // cleanup entry.remove(null, fail); }); @@ -475,12 +475,12 @@ describe('File API', function() { fail = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.PATH_EXISTS_ERR); - + // cleanup existingFile.remove(null, fail); }), win = createWin('DirectoryEntry'); - + // create file to kick off it runs(function() { root.getFile(fileName, {create:true}, getFile, fail); @@ -497,7 +497,7 @@ describe('File API', function() { expect(entry.isDirectory).toBe(false); expect(entry.name).toBe(fileName); expect(entry.fullPath).toBe(filePath); - + entry.remove(null, fail); //clean up }), fail = createFail('DirectoryEntry'), @@ -514,7 +514,7 @@ describe('File API', function() { expect(fail).not.toHaveBeenCalled(); }); }); - + // create file to kick off it runs(function() { root.getFile(fileName, {create:true}, getFile, fail); @@ -529,7 +529,7 @@ describe('File API', function() { expect(error).toBeFileError(FileError.ENCODING_ERR); }), win = createWin('DirectoryEntry'); - + // create:false, exclusive:false, invalid path runs(function() { root.getFile(fileName, {create:false}, win, fail); @@ -551,7 +551,7 @@ describe('File API', function() { expect(error).toBeFileError(FileError.NOT_FOUND_ERR); }), win = createWin('DirectoryEntry'); - + // create:false, exclusive:false, directory does not exist runs(function() { root.getDirectory(dirName, {create:false}, win, fail); @@ -580,19 +580,19 @@ describe('File API', function() { expect(win).toHaveBeenCalled(); expect(fail).not.toHaveBeenCalled(); }); - + }), win = jasmine.createSpy().andCallFake(function(directory) { expect(directory).toBeDefined(); expect(directory.isFile).toBe(false); expect(directory.isDirectory).toBe(true); expect(directory.name).toBe(dirName); expect(directory.fullPath).toBe(dirPath); - + // cleanup directory.remove(null, fail); }), fail = createFail('DirectoryEntry'); - + // create:true, exclusive:false, directory does not exist runs(function() { root.getDirectory(dirName, {create: true}, getDir, fail); @@ -627,7 +627,7 @@ describe('File API', function() { directory.remove(null, fail); }), fail = createFail('DirectoryEntry'); - + // create:true, exclusive:false, directory does not exist runs(function() { root.getDirectory(dirName, {create: true}, getDir, fail); @@ -645,15 +645,15 @@ describe('File API', function() { expect(directory.isDirectory).toBe(true); expect(directory.name).toBe(dirName); expect(directory.fullPath).toBe(dirPath); - + // cleanup directory.remove(null, fail); }), fail = createFail('DirectoryEntry'); - + // create:true, exclusive:false, directory does not exist runs(function() { - root.getDirectory(dirName, {create: true}, win, fail); + root.getDirectory(dirName, {create: true}, win, fail); }); waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT); @@ -663,7 +663,7 @@ describe('File API', function() { expect(fail).not.toHaveBeenCalled(); }); }); - + it("DirectoryEntry.getDirectory: create new directory (exclusive)", function() { var dirName = "de.create.exclusive.dir", dirPath = root.fullPath + '/' + dirName, @@ -673,14 +673,14 @@ describe('File API', function() { expect(directory.isDirectory).toBe(true); expect(directory.name).toBe(dirName); expect(directory.fullPath).toBe(dirPath); - + // cleanup directory.remove(null, fail); }), fail = createFail('DirectoryEntry'); // create:true, exclusive:true, directory does not exist runs(function() { - root.getDirectory(dirName, {create: true, exclusive:true}, win, fail); + root.getDirectory(dirName, {create: true, exclusive:true}, win, fail); }); waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT); @@ -712,15 +712,15 @@ describe('File API', function() { expect(directory.isDirectory).toBe(true); expect(directory.name).toBe(dirName); expect(directory.fullPath).toBe(dirPath); - + // cleanup directory.remove(null, fail); }), fail = createFail('DirectoryEntry'); - + // create directory to kick off it runs(function() { - root.getDirectory(dirName, {create:true}, getDir, this.fail); + root.getDirectory(dirName, {create:true}, getDir, this.fail); }); waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT); @@ -746,17 +746,17 @@ describe('File API', function() { fail = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.PATH_EXISTS_ERR); - + // cleanup existingDir.remove(null, fail); }), win = createWin('DirectoryEntry'); - + // create directory to kick off it runs(function() { root.getDirectory(dirName, {create:true}, getDir, fail); }); - + waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT); }); it("DirectoryEntry.getDirectory: get Entry for existing directory", function() { @@ -780,14 +780,14 @@ describe('File API', function() { expect(directory.isFile).toBe(false); expect(directory.isDirectory).toBe(true); expect(directory.name).toBe(dirName); - + expect(directory.fullPath).toBe(dirPath); - + // cleanup directory.remove(null, fail); }), fail = createFail('DirectoryEntry'); - + // create directory to kick off it root.getDirectory(dirName, {create:true}, getDir, fail); }); @@ -798,10 +798,10 @@ describe('File API', function() { expect(error).toBeFileError(FileError.ENCODING_ERR); }), win = createWin('DirectoryEntry'); - + // create:false, exclusive:false, invalid path runs(function() { - root.getDirectory(dirName, {create:false}, win, fail); + root.getDirectory(dirName, {create:false}, win, fail); }); waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT); @@ -832,12 +832,12 @@ describe('File API', function() { fail = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR); - + // cleanup existingFile.remove(null, null); }), win = createWin('DirectoryEntry'); - + // create file to kick off it runs(function() { root.getFile(fileName, {create:true}, getDir, fail); @@ -866,12 +866,12 @@ describe('File API', function() { fail = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR); - + // cleanup existingDir.remove(null, null); }), win = createWin('DirectoryEntry'); - + // create directory to kick off it runs(function() { root.getDirectory(dirName, {create:true}, getFile, fail); @@ -929,7 +929,7 @@ describe('File API', function() { waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT); }); it("createReader: create reader on existing directory", function() { - // create reader for root directory + // create reader for root directory var reader = root.createReader(); expect(reader).toBeDefined(); expect(typeof reader.readEntries).toBe('function'); @@ -964,8 +964,8 @@ describe('File API', function() { expect(entries instanceof Array).toBe(true); }), fail = createFail('DirectoryReader'); - - // create reader for root directory + + // create reader for root directory reader = root.createReader(); // read entries runs(function() { @@ -986,7 +986,7 @@ describe('File API', function() { // read entries var readEntries = jasmine.createSpy().andCallFake(function() { var reader = directory.createReader(); - + runs(function() { reader.readEntries(win, itReader); }); @@ -1055,12 +1055,12 @@ describe('File API', function() { expect(fileEntry).toBeDefined(); expect(typeof fileEntry.createWriter).toBe('function'); expect(typeof fileEntry.file).toBe('function'); - - // cleanup + + // cleanup fileEntry.remove(null, fail); }), fail = createFail('FileEntry'); - + // create a new file entry to kick off it runs(function() { root.getFile(fileName, {create:true}, itFileEntry, fail); @@ -1093,12 +1093,12 @@ describe('File API', function() { itWriter = jasmine.createSpy().andCallFake(function(writer) { expect(writer).toBeDefined(); expect(writer instanceof FileWriter).toBe(true); - - // cleanup + + // cleanup itFile.remove(null, fail); }), fail = createFail('FileEntry'); - + // create a new file entry to kick off it runs(function() { root.getFile(fileName, {create:true}, entryCallback, fail); @@ -1111,7 +1111,7 @@ describe('File API', function() { newFile, entryCallback = jasmine.createSpy().andCallFake(function(fileEntry) { newFile = fileEntry; - + runs(function() { fileEntry.file(itFile, fail); }); @@ -1126,12 +1126,12 @@ describe('File API', function() { itFile = jasmine.createSpy().andCallFake(function(file) { expect(file).toBeDefined(); expect(file instanceof File).toBe(true); - - // cleanup + + // cleanup newFile.remove(null, fail); }), fail = createFail('FileEntry'); - + // create a new file entry to kick off it runs(function() { root.getFile(fileName, {create:true}, entryCallback, fail); @@ -1168,7 +1168,7 @@ describe('File API', function() { }), fail = createFail('FileEntry'), win = createWin('FileEntry'); - + // create a new file entry to kick off it runs(function() { root.getFile(fileName, {create:true}, entryCallback, fail); @@ -1236,7 +1236,7 @@ describe('File API', function() { // cleanup deleteEntry(fileName); }); - + // create a new file entry createFile(fileName, entryCallback, fail); }); @@ -1262,7 +1262,7 @@ describe('File API', function() { // cleanup deleteEntry(dirName); }); - + // create a new directory entry runs(function() { createDirectory(dirName, entryCallback, fail); @@ -1293,7 +1293,7 @@ describe('File API', function() { // cleanup deleteEntry(fileName); }); - + // create a new file entry runs(function() { createFile(fileName, entryCallback, fail); @@ -1364,7 +1364,7 @@ describe('File API', function() { deleteEntry(fileName); }), fail = createFail('Entry'); - + // create a new file entry runs(function() { createFile(fileName, itURL, fail); @@ -1421,7 +1421,7 @@ describe('File API', function() { }); }); expect(entry).toBeDefined(); - + runs(function() { entry.remove(checkRemove, fail); }); @@ -1435,7 +1435,7 @@ describe('File API', function() { deleteEntry(fileName); }), fail = createFail('Entry'); - + // create a new file entry runs(function() { createFile(fileName, entryCallback, fail); @@ -1594,7 +1594,7 @@ describe('File API', function() { expect(entry2.isDirectory).toBe(false); expect(entry2.fullPath).toBe(fullPath); expect(entry2.name).toBe(file2); - + // cleanup deleteEntry(file1); deleteEntry(file2); @@ -1669,7 +1669,7 @@ describe('File API', function() { expect(directory.isDirectory).toBe(true); expect(directory.fullPath).toBe(dstPath); expect(directory.name).toBe(dstDir); - + runs(function() { root.getDirectory(dstDir, {create:false}, itDirExists, fail); }); @@ -1682,7 +1682,7 @@ describe('File API', function() { expect(dirEntry.isDirectory).toBe(true); expect(dirEntry.fullPath).toBe(dstPath); expect(dirEntry.name).toBe(dstDir); - + runs(function() { dirEntry.getFile(file1, {create:false}, itFileExists, fail); }); @@ -1735,7 +1735,7 @@ describe('File API', function() { expect(directory.isDirectory).toBe(true); expect(directory.fullPath).toBe(dstPath); expect(directory.name).toBe(dstDir); - + root.getDirectory(dstDir, {create:false}, itDirExists, fail); }, itDirExists = function(dirEntry) { @@ -1744,7 +1744,7 @@ describe('File API', function() { expect(dirEntry.isDirectory).toBe(true); expect(dirEntry.fullPath).toBe(dstPath); expect(dirEntry.name).toBe(dstDir); - + dirEntry.getFile(file1, {create:false}, itFileExists, fail); }, itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) { @@ -1784,7 +1784,7 @@ describe('File API', function() { var copyDir = jasmine.createSpy().andCallFake(function(fileEntry) { // copy srcDir onto itself runs(function() { - directory.copyTo(root, null, win, itCopy); + directory.copyTo(root, null, win, itCopy); }); waitsFor(function() { return itCopy.wasCalled; }, "itCopy never called", Tests.TEST_TIMEOUT); @@ -1799,8 +1799,8 @@ describe('File API', function() { itCopy = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); - - runs(function() { + + runs(function() { root.getDirectory(srcDir, {create:false}, itDirectoryExists, fail); }); @@ -1810,7 +1810,7 @@ describe('File API', function() { // returning confirms existence so just check fullPath entry expect(dirEntry).toBeDefined(); expect(dirEntry.fullPath).toBe(srcPath); - + runs(function() { dirEntry.getFile(file1, {create:false}, itFileExists, fail); }); @@ -1826,7 +1826,7 @@ describe('File API', function() { itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(filePath); - + // cleanup deleteEntry(srcDir); }); @@ -1855,7 +1855,7 @@ describe('File API', function() { itCopy = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); - + runs(function() { root.getDirectory(srcDir, {create:false}, itDirectoryExists, fail); }); @@ -1885,7 +1885,7 @@ describe('File API', function() { waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT); }); it("copyTo: directory that does not exist", function() { - var file1 = "entry.copy.dnf.file1", + var file1 = "entry.copy.dnf.file1", dstDir = "entry.copy.dnf.dstDir", filePath = root.fullPath + '/' + file1, dstPath = root.fullPath + '/' + dstDir, @@ -1987,7 +1987,7 @@ describe('File API', function() { expect(entry.isDirectory).toBe(false); expect(entry.fullPath).toBe(dstPath); expect(entry.name).toBe(file2); - + runs(function() { root.getFile(file2, {create:false}, itMovedExists, fail); }); @@ -1997,7 +1997,7 @@ describe('File API', function() { itMovedExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(dstPath); - + runs(function() { root.getFile(file1, {create:false}, win, itOrig); }); @@ -2014,7 +2014,7 @@ describe('File API', function() { //expect(navigator.fileMgr.itFileExists(srcPath) === false, "original file should not exist."); expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); - + // cleanup deleteEntry(file1); deleteEntry(file2); @@ -2057,7 +2057,7 @@ describe('File API', function() { waitsFor(function() { return itMove.wasCalled; }, "itMove never called", Tests.TEST_TIMEOUT); }); - + // create a parent directory to move file to runs(function() { root.getDirectory(dir, {create: true}, moveFile, fail); @@ -2068,7 +2068,7 @@ describe('File API', function() { itMovedExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(dstPath); - + runs(function() { root.getFile(file1, {create:false}, win, itOrig); }); @@ -2084,7 +2084,7 @@ describe('File API', function() { itOrig = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); - + // cleanup deleteEntry(file1); deleteEntry(dir); @@ -2131,7 +2131,7 @@ describe('File API', function() { expect(directory.fullPath).toBe(dstPath); expect(directory.name).toBe(dstDir); // it that moved file exists in destination dir - + runs(function() { directory.getFile(file1, {create:false}, itMovedExists, fail); }); @@ -2158,7 +2158,7 @@ describe('File API', function() { itOrig = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); - + // cleanup deleteEntry(srcDir); deleteEntry(dstDir); @@ -2231,7 +2231,7 @@ describe('File API', function() { itOrig = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); - + // cleanup deleteEntry(srcDir); deleteEntry(dstDir); @@ -2304,7 +2304,7 @@ describe('File API', function() { itOrig = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); - + // cleanup deleteEntry(srcDir); deleteEntry(dstDir); @@ -2346,7 +2346,7 @@ describe('File API', function() { itMove = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); - + // it that original dir still exists runs(function() { root.getDirectory(srcDir, {create:false}, itDirectoryExists, fail); @@ -2358,7 +2358,7 @@ describe('File API', function() { // returning confirms existence so just check fullPath entry expect(dirEntry).toBeDefined(); expect(dirEntry.fullPath).toBe(srcPath); - + runs(function() { dirEntry.getFile(file1, {create:false}, itFileExists, fail); }); @@ -2374,7 +2374,7 @@ describe('File API', function() { itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(filePath); - + // cleanup deleteEntry(srcDir); }); @@ -2419,7 +2419,7 @@ describe('File API', function() { itDirectoryExists = jasmine.createSpy().andCallFake(function(entry) { expect(entry).toBeDefined(); expect(entry.fullPath).toBe(srcPath); - + // cleanup deleteEntry(srcDir); }); @@ -2447,7 +2447,7 @@ describe('File API', function() { itMove = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); - + //it that original file still exists runs(function() { root.getFile(file1, {create:false}, itFileExists, fail); @@ -2464,7 +2464,7 @@ describe('File API', function() { itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(filePath); - + // cleanup deleteEntry(file1); }); @@ -2496,10 +2496,10 @@ describe('File API', function() { // move file1 onto sub-directory entry.moveTo(directory, subDir, win, itMove); }; - // create sub-directory + // create sub-directory directory.getDirectory(subDir, {create: true}, moveFile, fail); }; - // create top level directory + // create top level directory root.getDirectory(dstDir, {create: true}, createSubDirectory, fail); }, itDirectoryExists = function(dirEntry) { @@ -2526,7 +2526,7 @@ describe('File API', function() { }); waitsFor(function() { return itFileExists.wasCalled; }, "itFileExists never called", Tests.TEST_TIMEOUT); - + runs(function() { expect(itFileExists).toHaveBeenCalled(); expect(win).not.toHaveBeenCalled(); @@ -2564,7 +2564,7 @@ describe('File API', function() { itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(filePath); - + // cleanup deleteEntry(file1); deleteEntry(srcDir); @@ -2614,7 +2614,7 @@ describe('File API', function() { itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(filePath); - + // cleanup deleteEntry(file1); deleteEntry(srcDir); @@ -2650,14 +2650,14 @@ describe('File API', function() { var itMove = function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); - + // it that destination directory still exists directory.getDirectory(subDir, {create:false}, itDirectoryExists, fail); }; - // create sub-directory + // create sub-directory directory.getDirectory(subDir, {create: true}, moveDir, fail); }; - // create top level directory + // create top level directory root.getDirectory(dstDir, {create: true}, createSubDirectory, fail); }, itDirectoryExists = function(dirEntry) { @@ -2712,7 +2712,7 @@ describe('File API', function() { expect(entry.isDirectory).toBe(false); expect(entry.fullPath).toBe(file2Path); expect(entry.name).toBe(file2); - + // it that old file does not exists root.getFile(file1, {create:false}, win, itFileMoved); }, @@ -2725,7 +2725,7 @@ describe('File API', function() { itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(file2Path); - + // cleanup deleteEntry(file1); deleteEntry(file2); @@ -2777,14 +2777,14 @@ describe('File API', function() { itFileExists = function(fileEntry) { expect(fileEntry).toBeDefined(); expect(fileEntry.fullPath).toBe(filePath); - + // check that old directory no longer exists root.getDirectory(srcDir, {create:false}, win, itRemoved); }, itRemoved = jasmine.createSpy().andCallFake(function(error){ expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); - + // cleanup deleteEntry(srcDir); deleteEntry(dstDir); @@ -2807,7 +2807,7 @@ describe('File API', function() { }); }); it("moveTo: directory that does not exist", function() { - var file1 = "entry.move.dnf.file1", + var file1 = "entry.move.dnf.file1", dstDir = "entry.move.dnf.dstDir", filePath = root.fullPath + '/' + file1, dstPath = root.fullPath + '/' + dstDir, @@ -2822,7 +2822,7 @@ describe('File API', function() { itMove = jasmine.createSpy().andCallFake(function(error) { expect(error).toBeDefined(); expect(error).toBeFileError(FileError.NOT_FOUND_ERR); - + // cleanup deleteEntry(file1); }); @@ -2912,10 +2912,10 @@ describe('File API', function() { reader.onloadend = verifier; var myFile = new File(); - myFile.fullPath = filePath; + myFile.fullPath = filePath; reader.readAsText(myFile); }; - + // create a file, write to it, and read it in again runs(function() { root.getFile(fileName, {create: true}, create_writer, fail); @@ -2944,10 +2944,10 @@ describe('File API', function() { var reader = new FileReader(); reader.onloadend = verifier; var myFile = new File(); - myFile.fullPath = filePath; + myFile.fullPath = filePath; reader.readAsText(myFile); }; - + // create a file, write to it, and read it in again runs(function() { root.getFile(fileName, {create: true}, read_file, fail); @@ -2968,7 +2968,7 @@ describe('File API', function() { }); reader.onerror = verifier; var myFile = new File(); - myFile.fullPath = root.fullPath + '/' + "doesnotexist.err"; + myFile.fullPath = root.fullPath + '/' + "doesnotexist.err"; runs(function() { reader.readAsText(myFile); @@ -2993,7 +2993,7 @@ describe('File API', function() { }, // writes file and reads it back in write_file = function(writer) { - writer.onwriteend = read_file; + writer.onwriteend = read_file; writer.write(rule); }, verifier = jasmine.createSpy().andCallFake(function(evt) { @@ -3005,10 +3005,10 @@ describe('File API', function() { var reader = new FileReader(); reader.onloadend = verifier; var myFile = new File(); - myFile.fullPath = filePath; + myFile.fullPath = filePath; reader.readAsDataURL(myFile); }; - + // create a file, write to it, and read it in again runs(function() { root.getFile(fileName, {create: true}, create_writer, fail); @@ -3089,7 +3089,7 @@ describe('File API', function() { writer.write(rule); }, fail); }; - + // create file, then write and append to it runs(function() { createFile(fileName, write_file); @@ -3120,7 +3120,7 @@ describe('File API', function() { theWriter.onwriteend = anotherVerifier; length += exception.length; theWriter.seek(theWriter.length); - theWriter.write(exception); + theWriter.write(exception); }), anotherVerifier = jasmine.createSpy().andCallFake(function(evt) { expect(theWriter.length).toBe(length); @@ -3135,7 +3135,7 @@ describe('File API', function() { theWriter.onwriteend = verifier; theWriter.write(rule); }; - + // create file, then write and append to it runs(function() { var file = new File(); @@ -3168,7 +3168,7 @@ describe('File API', function() { theWriter.onwriteend = anotherVerifier; length = 12 + exception.length; theWriter.seek(12); - theWriter.write(exception); + theWriter.write(exception); }), anotherVerifier = jasmine.createSpy().andCallFake(function(evt) { expect(theWriter.length).toBe(length); @@ -3185,7 +3185,7 @@ describe('File API', function() { theWriter.write(rule); }, fail); }; - + // create file, then write and append to it runs(function() { createFile(fileName, write_file); @@ -3216,7 +3216,7 @@ describe('File API', function() { theWriter.onwriteend = anotherVerifier; length = 8 + exception.length; theWriter.seek(8); - theWriter.write(exception); + theWriter.write(exception); }), anotherVerifier = jasmine.createSpy().andCallFake(function(evt) { expect(theWriter.length).toBe(length); @@ -3233,7 +3233,7 @@ describe('File API', function() { theWriter.write(rule); }, fail); }; - + // create file, then write and append to it runs(function() { createFile(fileName, write_file); @@ -3271,7 +3271,7 @@ describe('File API', function() { theWriter.write(rule); }, fail); }; - + // creates file, then write XML data runs(function() { createFile(fileName, write_file); @@ -3305,10 +3305,10 @@ describe('File API', function() { fileEntry.createWriter(function(writer) { theWriter = writer; theWriter.onwriteend = verifier; - theWriter.write(rule); + theWriter.write(rule); }, fail); }; - + // creates file, then write JSON content runs(function() { createFile(fileName, write_file); @@ -3341,7 +3341,7 @@ describe('File API', function() { // writes file and reads it back in write_file = function(writer) { theWriter = writer; - theWriter.onwriteend = read_file; + theWriter.onwriteend = read_file; theWriter.write(rule); }, // reads file and compares content to what was written @@ -3395,7 +3395,7 @@ describe('File API', function() { theWriter.write(rule); }, fail); }; - + // creates file, then write JSON content runs(function() { createFile(fileName, seek_file); @@ -3413,20 +3413,20 @@ describe('File API', function() { rule = "There is an exception to every rule. Except this one.", fail = createFail('FileWRiter'), theWriter, - // writes file content + // writes file content write_file = function(fileEntry) { fileEntry.createWriter(function(writer) { theWriter = writer; theWriter.onwriteend = function(evt) { truncate_file(theWriter); - }; + }; theWriter.write(rule); }, fail); }, verifier = jasmine.createSpy().andCallFake(function(evt) { expect(theWriter.length).toBe(36); expect(theWriter.position).toBe(36); - + // cleanup deleteFile(fileName); }),