incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [9/16] changed test project to use updated tests + jasmine
Date Fri, 20 Apr 2012 21:33:30 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/d62a7909/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
index 2370fa5..e46e51c 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
@@ -1,2833 +1,3427 @@
-/**
- * Retrieves root file system entries once, so they don't have to be 
- * repeated for every test (file system shouldn't change during test run). 
- */ 
-var getFileSystemRoot = (function() {
-
-    // private
-    var temp_root, persistent_root;
-
-    var onError = function(error) {
-        console.log('unable to retrieve file system: ' + error.code);
+// Used by tests, set in file.html
+var root, temp_root, persistent_root;
+
+describe('File API', function() {
+    // HELPER FUNCTIONS
+
+    // deletes specified file or directory
+    var deleteEntry = function(name, success, error) {
+        // deletes entry, if it exists
+        window.resolveLocalFileSystemURI(root.toURL() + '/' + name, 
+            function(entry) {
+                if (entry.isDirectory === true) {
+                    entry.removeRecursively(success, error); 
+                } else {
+                    entry.remove(success, error);
+                }
+            }, success);
     };
-    
-    // one-time retrieval of the root file system entry
-    var init = function() {
-        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
-                function(fileSystem) {
-                    persistent_root = fileSystem.root;
-                }, onError);
-        window.requestFileSystem(LocalFileSystem.TEMPORARY, 0,
-                function(fileSystem) {
-                    temp_root = fileSystem.root;
-                }, onError);
+    // deletes file, if it exists, then invokes callback
+    var deleteFile = function(fileName, callback) {
+        root.getFile(fileName, null, 
+                // remove file system entry
+                function(entry) {
+                    entry.remove(callback, function() { console.log('[ERROR] deleteFile cleanup method invoked fail callback.'); });
+                },
+                // doesn't exist
+                callback);
     };
-    document.addEventListener("deviceready", init, true);
-
-    // public function returns private root entry
-    return function() {
-        // When testing, it is a good idea to run the test suite once for each
-        // file system type.  Just change the return value from this function.  
-        //return temp_root;
-        return persistent_root;
+    // deletes and re-creates the specified file
+    var createFile = function(fileName, success, error) {
+        deleteEntry(fileName, function() {
+            root.getFile(fileName, {create: true}, success, error);
+        }, error);
+    };
+    // deletes and re-creates the specified directory
+    var createDirectory = function(dirName, success, error) {
+        deleteEntry(dirName, function() {
+           root.getDirectory(dirName, {create: true}, success, error); 
+        }, error);
     };
-}()); // execute immediately
-
-Tests.prototype.FileTests = function() {
-    module('FileError interface');
-    test("FileError constants should be defined", function() {
-        expect(12);
-        equal(FileError.NOT_FOUND_ERR, 1, "FileError.NOT_FOUND_ERR should be defined");
-        equal(FileError.SECURITY_ERR, 2, "FileError.SECURITY_ERR should be defined");
-        equal(FileError.ABORT_ERR, 3, "FileError.ABORT should be defined");
-        equal(FileError.NOT_READABLE_ERR, 4, "FileError.NOT_READABLE_ERR should be defined");
-        equal(FileError.ENCODING_ERR, 5, "FileError.ENCODING_ERR should be defined");
-        equal(FileError.NO_MODIFICATION_ALLOWED_ERR, 6, "FileError.NO_MODIFICATION_ALLOWED_ERR should be defined");
-        equal(FileError.INVALID_STATE_ERR, 7, "FileError.INVALID_STATE_ERR should be defined");
-        equal(FileError.SYNTAX_ERR, 8, "FileError.SYNTAX_ERR should be defined");
-        equal(FileError.INVALID_MODIFICATION_ERR, 9, "FileError.INVALID_MODIFICATION_ERR should be defined");
-        equal(FileError.QUOTA_EXCEEDED_ERR, 10, "FileError.QUOTA_EXCEEDED_ERR should be defined");
-        equal(FileError.TYPE_MISMATCH_ERR, 11, "FileError.TYPE_MISMATCH_ERR should be defined");
-        equal(FileError.PATH_EXISTS_ERR, 12, "FileError.PATH_EXISTS_ERR should be defined");
-    });
 
-    module('LocalFileSystem interface', {
-        // setup function will run before each test
-        setup: function() {
-            var that = this;
-            this.root = getFileSystemRoot();
-            this.fail = function(error) {
-                console.log('file error: ' + error.code);
-            };
-            this.unexpectedSuccess = function() {
-                console.log('!!! success function called when not expected !!!');
-            };
-            // deletes specified file or directory
-            this.deleteEntry = function(name, success, error) {
-                // deletes entry, if it exists
-                window.resolveLocalFileSystemURI(that.root.toURL() + '/' + name, 
-                        function(entry) {
-                            console.log('Deleting: ' + entry.fullPath);
-                            if (entry.isDirectory === true) {
-                                entry.removeRecursively(success, error); 
-                            }
-                            else {
-                                entry.remove(success, error);
-                            }
-                        }, 
-                        // doesn't exist
-                        success);
-            };
-            // deletes and re-creates the specified file
-            this.createFile = function(fileName, success, error) {
-                that.deleteEntry(fileName, function() {
-                    console.log('Creating file: ' + that.root.fullPath + '/' + fileName);
-                    that.root.getFile(fileName, {create: true}, success, error);                
-                }, error);
-            };
-            // deletes and re-creates the specified directory
-            this.createDirectory = function(dirName, success, error) {
-                that.deleteEntry(dirName, function() {
-                   console.log('Creating directory: ' + that.root.fullPath + '/' + dirName);
-                   that.root.getDirectory(dirName, {create: true}, success, error); 
-                }, error);
-            };
-        }
-    });
-    test("window.requestFileSystem function should be defined", function() {
-        expect(1);
-        ok(typeof window.requestFileSystem === 'function', "window.requestFileSystem should be a function.");
-    });
-    test("window.resolveLocalFileSystemURI function should be defined", function() {
-        expect(1);
-        ok(typeof window.resolveLocalFileSystemURI === 'function', "window.resolveLocalFileSystemURI should be a function.");
-    });
-    test("File system types should be defined", function() {
-        expect(2);
-        equal(LocalFileSystem.TEMPORARY, 0, "LocalFileSystem.TEMPORARY should be defined");
-        equal(LocalFileSystem.PERSISTENT, 1, "LocalFileSystem.PERSISTENT should be defined");
-    });
-    test("retrieve PERSISTENT file system", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(4);
-
-        var testPersistent = function(fileSystem) {
-            ok(typeof fileSystem !== 'undefined' && fileSystem !== null, "window.requestFileSystem should return an object.");
-            ok(typeof fileSystem.name !== 'undefined' && fileSystem.name !== null, "filesystem should include a 'name' property.");
-            equal(fileSystem.name, "persistent", "file system 'name' attribute should be set properly");
-            ok(typeof fileSystem.root !== 'undefined' && fileSystem.root !== null, "filesystem should include a 'root' property.");
-            QUnit.start();
-        };
-        
-        // retrieve PERSISTENT file system
-        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, testPersistent, 
-                function(error) {
-                    console.log('error retrieving file system: ' + error.code);
-                });            
-    });
-    test("retrieve TEMPORARY file system", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(4);
-
-        var testTemporary = function(fileSystem) {
-            ok(typeof fileSystem !== 'undefined' && fileSystem !== null, "window.requestFileSystem should return an object.");
-            ok(typeof fileSystem.name !== 'undefined' && fileSystem.name !== null, "filesystem should include a 'name' property.");
-            equal(fileSystem.name, "temporary", "file system 'name' attribute should be set properly");
-            ok(typeof fileSystem.root !== 'undefined' && fileSystem.root !== null, "filesystem should include a 'root' property.");
-            QUnit.start();
-        };
-        
-        // Request the file system
-        window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, testTemporary, 
-                function(error) {
-                    console.log('error retrieving file system: ' + error.code);
-                });            
-    });
-    test("request a file system that is too large", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-
-        var failFS = function(error) {
-            ok(error !== null, "error should not be null.");
-            equal(error.code, FileError.QUOTA_EXCEEDED_ERR, "Shoud receive error code FileError.QUOTA_EXCEEDED_ERR");
-            QUnit.start();
-        };
-        
-        // Request the file system
-        window.requestFileSystem(LocalFileSystem.TEMPORARY, 1000000000000000, null, failFS);
-    });
-    test("request a file system that does not exist", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-
-        var failFS = function(error) {
-            ok(typeof error !== 'undefined' && error !== null, "error should not be null.");
-            equal(error.code, FileError.SYNTAX_ERR, "Shoud receive error code FileError.SYNTAX_ERR");
-            QUnit.start();
-        };
-        
-        // Request the file system
-        window.requestFileSystem(-1, 0, null, failFS);
-    });
-    test("resolve valid file name", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var fileName = "resolve.file.uri",
-            that = this,
-            resolveCallback = function(entry) {
-                // lookup file system entry
-                window.resolveLocalFileSystemURI(entry.toURI(), testEntry, this.fail);
-            },
-            testEntry = function(fileEntry) {
-                ok(typeof fileEntry !== 'undefined' && fileEntry !== null, "fileEntry should not be null.");
-                ok(fileEntry.name == fileName, "fileEntry.name should equal 'resolve.file.uri'");
-
-                // cleanup
-                that.deleteEntry(fileName);
-                QUnit.start();
-            };
-        
-        // create a new file entry
-        this.createFile(fileName, resolveCallback, this.fail);
-    });
-    test("resolve valid file name with parameters", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var fileName = "resolve.file.uri.params",
-            that = this,
-            resolveCallback = function(entry) {
-                // lookup file system entry
-                window.resolveLocalFileSystemURI(entry.toURI() + "?1234567890", testEntry, this.fail);
-            },
-            testEntry = function(fileEntry) {
-                ok(typeof fileEntry !== 'undefined' && fileEntry !== null, "fileEntry should not be null.");
-                ok(fileEntry.name == fileName, "fileEntry.name should equal 'resolve.file.uri.params'");
-
-                // cleanup
-                that.deleteEntry(fileName);
-                QUnit.start();
-            };
-        
-        // create a new file entry
-        this.createFile(fileName, resolveCallback, this.fail);
-    });
-    test("resolve invalid file name", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-
-        var failURL = function(error) {
-            ok(typeof error !== 'undefined' && error !== null, "error should not be null.");
-            equal(error.code, FileError.NOT_FOUND_ERR, "Shoud receive error code FileError.NOT_FOUND_ERR");
-            QUnit.start();
-        };
-        
-        // lookup file system entry
-        window.resolveLocalFileSystemURI("file:///this.is.not.a.valid.file.txt", null, failURL);
-    });
-    test("resolve invalid URL", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-
-        var failURL = function(error) {
-            ok(typeof error !== 'undefined' && error !== null, "error should not be null.");
-            equal(error.code, FileError.ENCODING_ERR, "Shoud receive an error code FileError.ENCODING_ERR");
-            QUnit.start();
-        };
-        
-        // lookup file system entry
-        window.resolveLocalFileSystemURI("/this.is.not.a.valid.url", null, failURL);
-    });
+    var createFail = function(module) {
+        return jasmine.createSpy().andCallFake(function(err) {
+            console.log('[ERROR ' + module + '] ' + JSON.stringify(err));
+        });
+    };
 
-    module('Metadata interface');
-    test("Metadata constructor should exist", function() {
-        expect(2);
-        var metadata = new Metadata();
-        ok(metadata !== null, "Metadata object should not be null.");
-        ok(typeof metadata.modificationTime !== 'undefined', "Metadata object should have a 'modificationTime' property.");
-    });
-    module('Flags interface');
-    test("Flags constructor should exist", function() {
-        expect(5);
-        var flags = new Flags(false, true);
-        ok(flags !== null, "Flags object should not be null.");
-        ok(typeof flags.create !== 'undefined' && flags.create !== null, "Flags object should have a 'create' property.");
-        equal(flags.create, false, "Flags.create should be set properly");
-        ok(typeof flags.exclusive !== 'undefined' && flags.exclusive !== null, "Flags object should have an 'exclusive' property.");
-        equal(flags.exclusive, true, "flags.exclusive should be set properly");
-    });
-    module('FileSystem interface');
-    test("FileSystem root should be a DirectoryEntry", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(15);
-
-        var root = getFileSystemRoot(),
-            testFSRoot = function(entry) {
-                ok(typeof entry !== 'undefined' && entry !== null, "entry should be non-null");
-                equal(entry.isFile, false, "entry.isFile should be false");
-                equal(entry.isDirectory, true, "entry.isDirectory should be true");
-                ok(typeof entry.name !== 'undefined' && entry.name !== null, "entry should include a 'name' property.");
-                ok(typeof entry.fullPath !== 'undefined' && entry.fullPath !== null, "entry should include a 'fullPath' property.");
-                ok(typeof entry.getMetadata === 'function', "entry object should have a 'getMetadata' function.");
-                ok(typeof entry.moveTo === 'function', "entry object should have a 'moveTo' function.");
-                ok(typeof entry.copyTo === 'function', "entry object should have a 'copyTo' function.");
-                ok(typeof entry.toURL === 'function', "entry object should have a 'toURL' function.");
-                ok(typeof entry.remove === 'function', "entry object should have a 'remove' function.");
-                ok(typeof entry.getParent === 'function', "entry object should have a 'getParent' function.");
-                ok(typeof entry.createReader === 'function', "entry object should have a 'createReader' function.");
-                ok(typeof entry.getFile === 'function', "entry object should have a 'getFile' function.");
-                ok(typeof entry.getDirectory === 'function', "entry object should have a 'getDirectory' function.");
-                ok(typeof entry.removeRecursively === 'function', "entry object should have a 'removeRecursively' function.");
-                QUnit.start();
-        };
-    
-        window.resolveLocalFileSystemURI(root.toURL(), testFSRoot, null);
+    var createWin = function(module) {
+        return jasmine.createSpy().andCallFake(function() {
+            console.log('[ERROR ' + module + '] Unexpected success callback');
+        });
+    };
 
-    });
-    module('DirectoryEntry interface', {
-        // setup function will run before each test
-        setup: function() {
-            this.root = getFileSystemRoot();
-            this.fail = function(error) {
-                console.log('file error: ' + error.code);
-            };
-            this.unexpectedSuccess = function() {
-                console.log('!!! success function called when not expected !!!');
-            };
-        }
-    });
-    test("DirectoryEntry.getFile: get Entry for file that does not exist", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var fileName = "de.no.file",
-            filePath = this.root.fullPath + '/' + fileName,
-            that = this,
-            testFile = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "retrieving a file that does not exist is an error");
-                equal(error.code, FileError.NOT_FOUND_ERR, "error code should be FileError.NOT_FOUND_ERR");
-                
-                // cleanup
-                QUnit.start();
-            };
-                
-        // create:false, exclusive:false, file does not exist
-        this.root.getFile(fileName, {create:false}, null, testFile); 
-    });
-    test("DirectoryEntry.getFile: create new file", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var fileName = "de.create.file",
-            filePath = this.root.fullPath + '/' + fileName,
-            that = this,
-            testFile = function(entry) {
-                ok(typeof entry !== 'undefined' && entry !== null, "file entry should not be null");
-                equal(entry.isFile, true, "entry 'isFile' attribute should be true");
-                equal(entry.isDirectory, false, "entry 'isDirectory' attribute should be false");
-                equal(entry.name, fileName, "entry 'name' attribute should be set");
-                equal(entry.fullPath, filePath, "entry 'fullPath' attribute should be set");
-                
-                // cleanup
-                entry.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create:true, exclusive:false, file does not exist
-        this.root.getFile(fileName, {create: true}, testFile, this.fail); 
-    });
-    test("DirectoryEntry.getFile: create new file (exclusive)", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var fileName = "de.create.exclusive.file",
-            filePath = this.root.fullPath + '/' + fileName,
-            that = this,
-            testFile = function(entry) {
-                ok(typeof entry !== 'undefined' && entry !== null, "file entry should not be null");
-                equal(entry.isFile, true, "entry 'isFile' attribute should be true");
-                equal(entry.isDirectory, false, "entry 'isDirectory' attribute should be false");
-                equal(entry.name, fileName, "entry 'name' attribute should be set");
-                equal(entry.fullPath, filePath, "entry 'fullPath' attribute should be set");
-                
-                // cleanup
-                entry.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create:true, exclusive:true, file does not exist
-        this.root.getFile(fileName, {create: true, exclusive:true}, testFile, this.fail); 
-    });
-    test("DirectoryEntry.getFile: create file that already exists", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var fileName = "de.create.existing.file",
-            filePath = this.root.fullPath + '/' + fileName,
-            that = this,
-            getFile = function(file) {
-                // create:true, exclusive:false, file exists
-                that.root.getFile(fileName, {create:true}, testFile, that.fail);             
-            },
-            testFile = function(entry) {
-                ok(typeof entry !== 'undefined' && entry !== null, "file entry should not be null");
-                equal(entry.isFile, true, "entry 'isFile' attribute should be true");
-                equal(entry.isDirectory, false, "entry 'isDirectory' attribute should be false");
-                equal(entry.name, fileName, "entry 'name' attribute should be set");
-                equal(entry.fullPath, filePath, "entry 'fullPath' attribute should be set");
-                
-                // cleanup
-                entry.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create file to kick off test
-        this.root.getFile(fileName, {create:true}, getFile, this.fail); 
-    });
-    test("DirectoryEntry.getFile: create file that already exists (exclusive)", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var fileName = "de.create.exclusive.existing.file",
-            filePath = this.root.fullPath + '/' + fileName,
-            that = this,
-            existingFile,
-            getFile = function(file) {
-                existingFile = file;
-                // create:true, exclusive:true, file exists
-                that.root.getFile(fileName, {create:true, exclusive:true}, null, testFile);             
-            },
-            testFile = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "creating exclusive file that already exists is an error");
-                equal(error.code, FileError.PATH_EXISTS_ERR, "error code should be FileError.PATH_EXISTS_ERR");
-               
-                // cleanup
-                existingFile.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create file to kick off test
-        this.root.getFile(fileName, {create:true}, getFile, this.fail); 
-    });
-    test("DirectoryEntry.getFile: get Entry for existing file", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var fileName = "de.get.file",
-            filePath = this.root.fullPath + '/' + fileName,
-            that = this,
-            getFile = function(file) {
-                // create:false, exclusive:false, file exists
-                that.root.getFile(fileName, {create:false}, testFile, that.fail);             
-            },
-            testFile = function(entry) {
-                ok(typeof entry !== 'undefined' && entry !== null, "file entry should not be null");
-                equal(entry.isFile, true, "entry 'isFile' attribute should be true");
-                equal(entry.isDirectory, false, "entry 'isDirectory' attribute should be false");
-                equal(entry.name, fileName, "entry 'name' attribute should be set");
-                equal(entry.fullPath, filePath, "entry 'fullPath' attribute should be set");
-                
-                // cleanup
-                entry.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create file to kick off test
-        this.root.getFile(fileName, {create:true}, getFile, this.fail); 
-    });
-    test("DirectoryEntry.getFile: get FileEntry for invalid path", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var fileName = "de:invalid:path",
-            that = this,
-            testFile = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "retrieving a file using an invalid path is an error");
-                equal(error.code, FileError.ENCODING_ERR, "error code should be FileError.ENCODING_ERR");
-                
-                // cleanup
-                QUnit.start();
-            };
-                
-        // create:false, exclusive:false, invalid path
-        this.root.getFile(fileName, {create:false}, null, testFile); 
-    });
-    test("DirectoryEntry.getDirectory: get Entry for directory that does not exist", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var dirName = "de.no.dir",
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            testDir = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "retrieving a directory that does not exist is an error");
-                equal(error.code, FileError.NOT_FOUND_ERR, "error code should be FileError.NOT_FOUND_ERR");
-                
-                // cleanup
-                QUnit.start();
-            };
+    describe('FileError object', function() {
+        it("should define FileError constants", function() {
+            expect(FileError.NOT_FOUND_ERR).toBe(1);
+            expect(FileError.SECURITY_ERR).toBe(2);
+            expect(FileError.ABORT_ERR).toBe(3);
+            expect(FileError.NOT_READABLE_ERR).toBe(4);
+            expect(FileError.ENCODING_ERR).toBe(5);
+            expect(FileError.NO_MODIFICATION_ALLOWED_ERR).toBe(6);
+            expect(FileError.INVALID_STATE_ERR).toBe(7);
+            expect(FileError.SYNTAX_ERR).toBe(8);
+            expect(FileError.INVALID_MODIFICATION_ERR).toBe(9);
+            expect(FileError.QUOTA_EXCEEDED_ERR).toBe(10);
+            expect(FileError.TYPE_MISMATCH_ERR).toBe(11);
+            expect(FileError.PATH_EXISTS_ERR).toBe(12);
+        });
+    });
+
+    describe('LocalFileSystem', function() {
+
+        it("should define LocalFileSystem constants", function() {
+            expect(LocalFileSystem.TEMPORARY).toBe(0);
+            expect(LocalFileSystem.PERSISTENT).toBe(1);
+        });
+
+        describe('window.requestFileSystem', function() {
+            it("should be defined", function() {
+                expect(window.requestFileSystem).toBeDefined();
+            });
+            it("should be able to retrieve a PERSISTENT file system", function() {
+                var win = jasmine.createSpy().andCallFake(function(fileSystem) {
+                    expect(fileSystem).toBeDefined();
+                    expect(fileSystem.name).toBeDefined();
+                    expect(fileSystem.name).toBe("persistent");
+                    expect(fileSystem.root).toBeDefined();
+                }),
+                fail = createFail('window.requestFileSystem');
+          
+                // retrieve PERSISTENT file system
+                runs(function() {
+                    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, win, fail);
+                });
+
+                waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
+
+                runs(function() {
+                    expect(fail).not.toHaveBeenCalled();
+                    expect(win).toHaveBeenCalled();
+                });
+            });
+            it("should be able to retrieve a TEMPORARY file system", function() {
+                var win = jasmine.createSpy().andCallFake(function(fileSystem) {
+                    expect(fileSystem).toBeDefined();
+                    expect(fileSystem.name).toBeDefined();
+                    expect(fileSystem.name).toBe("temporary");
+                    expect(fileSystem.root).toBeDefined();
+                }),
+                fail = createFail('window.requestFileSystem');
+
+                // Request the file system
+                runs(function() { 
+                    window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, win, fail);
+                });
+
+                waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
+
+                runs(function() {
+                    expect(fail).not.toHaveBeenCalled();
+                    expect(win).toHaveBeenCalled();
+                });
+            });
+            it("should error if you request a file system that is too large", function() {
+                var fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.QUOTA_EXCEEDED_ERR);
+                }),
+                win = createWin('window.requestFileSystem');
+
+                // Request the file system
+                runs(function() {
+                    window.requestFileSystem(LocalFileSystem.TEMPORARY, 1000000000000000, win, fail);
+                });
+
+                waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
+
+                runs(function() {
+                    expect(win).not.toHaveBeenCalled();
+                    expect(fail).toHaveBeenCalled();
+                });
+            });
+            it("should error out if you request a file system that does not exist", function() {
+                var fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.SYNTAX_ERR);
+                }),
+                win = createWin('window.requestFileSystem');
+
+                // Request the file system
+                runs(function() {
+                    window.requestFileSystem(-1, 0, win, fail);
+                });
+
+                waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
+
+                runs(function() {
+                    expect(win).not.toHaveBeenCalled();
+                    expect(fail).toHaveBeenCalled();
+                });
+            });
+        });
+
+        describe('window.resolveLocalFileSystemURI', function() {
+            it("should be defined", function() {
+                expect(window.resolveLocalFileSystemURI).toBeDefined();
+            });
+            it("should resolve a valid file name", function() {
+                var fileName = "resolve.file.uri",
+                win = jasmine.createSpy().andCallFake(function(fileEntry) {
+                    expect(fileEntry).toBeDefined();
+                    expect(fileEntry.name).toBe(fileName);
+
+                    // cleanup
+                    deleteEntry(fileName);
+                }),
+                fail = createFail('window.resolveLocalFileSystemURI');
+                resolveCallback = jasmine.createSpy().andCallFake(function(entry) {
+                    // lookup file system entry
+                    runs(function() {
+                        window.resolveLocalFileSystemURI(entry.toURL(), win, fail);
+                    });
+
+                    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);
+                });
+
+                waitsFor(function() { return resolveCallback.wasCalled; }, "createFile callback never called", Tests.TEST_TIMEOUT);
+            });
+            it("resolve valid file name with parameters", function() {
+                var fileName = "resolve.file.uri.params",
+                win = jasmine.createSpy().andCallFake(function(fileEntry) {
+                    expect(fileEntry).toBeDefined();
+                    expect(fileEntry.name).toBe(fileName);
+
+                    // cleanup
+                    deleteEntry(fileName);
+                }),
+                fail = createFail('window.resolveLocalFileSystemURI');
+                resolveCallback = jasmine.createSpy().andCallFake(function(entry) {
+                    // lookup file system entry
+                    runs(function() {
+                        window.resolveLocalFileSystemURI(entry.toURL() + "?1234567890", win, fail);
+                    });
+
+                    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);
+                });
+
+                waitsFor(function() { return resolveCallback.wasCalled; }, "createFile callback never called", Tests.TEST_TIMEOUT);
+            });
+            it("should error out when resolving invalid file name", function() {
+                var fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.NOT_FOUND_ERR);
+                }),
+                win = createWin('window.resolveLocalFileSystemURI');
                 
-        // create:false, exclusive:false, directory does not exist
-        this.root.getDirectory(dirName, {create:false}, null, testDir); 
-    });
-    test("DirectoryEntry.getDirectory: create new dir with space then resolveFileSystemURL", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var dirName = "de create dir",
-        dirPath = this.root.fullPath + '/' + dirName,
-        that = this,
-        getDir = function(dirEntry) {
+                // lookup file system entry
+                runs(function() {
+                    window.resolveLocalFileSystemURI("file:///this.is.not.a.valid.file.txt", win, fail);
+                });
+
+                waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
+
+                runs(function() {
+                    expect(fail).toHaveBeenCalled();
+                    expect(win).not.toHaveBeenCalled();
+                });
+            });
+            it("resolve invalid URL", function() {
+                var fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.ENCODING_ERR);
+                }),
+                win = createWin('window.resolveLocalFileSystemURI');
+
+                // lookup file system entry
+                runs(function() {
+                    window.resolveLocalFileSystemURI("/this.is.not.a.valid.url", win, fail);
+                });
+
+                waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
+
+                runs(function() {
+                    expect(fail).toHaveBeenCalled();
+                    expect(win).not.toHaveBeenCalled();
+                });
+            });
+        });
+    });
+
+    describe('Metadata interface', function() {
+        it("should exist and have the right properties", function() {
+            var metadata = new Metadata();
+            expect(metadata).toBeDefined();
+            expect(metadata.modificationTime).toBeDefined();
+        });
+    });
+
+    describe('Flags interface', function() {
+        it("should exist and have the right properties", function() {
+            var flags = new Flags(false, true);
+            expect(flags).toBeDefined();
+            expect(flags.create).toBeDefined();
+            expect(flags.create).toBe(false);
+            expect(flags.exclusive).toBeDefined();
+            expect(flags.exclusive).toBe(true);
+        });
+    });
+
+    describe('FileSystem interface', function() {
+        it("should have a root that is a DirectoryEntry", function() {
+            var win = jasmine.createSpy().andCallFake(function(entry) {
+                expect(entry).toBeDefined();
+                expect(entry.isFile).toBe(false);
+                expect(entry.isDirectory).toBe(true);
+                expect(entry.name).toBeDefined();
+                expect(entry.fullPath).toBeDefined();
+                expect(entry.getMetadata).toBeDefined();
+                expect(entry.moveTo).toBeDefined();
+                expect(entry.copyTo).toBeDefined();
+                expect(entry.toURL).toBeDefined();
+                expect(entry.remove).toBeDefined();
+                expect(entry.getParent).toBeDefined();
+                expect(entry.createReader).toBeDefined();
+                expect(entry.getFile).toBeDefined();
+                expect(entry.getDirectory).toBeDefined();
+                expect(entry.removeRecursively).toBeDefined();
+            }),
+            fail = createFail('FileSystem');
+ 
+            runs(function() {
+                window.resolveLocalFileSystemURI(root.toURL(), win, fail);
+            });
+
+            waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(fail).not.toHaveBeenCalled();
+                expect(win).toHaveBeenCalled();
+            });
+        });
+    });
+
+    describe('DirectoryEntry', function() {
+        it("getFile: get Entry for file that does not exist", function() {
+            var fileName = "de.no.file",
+                filePath = root.fullPath + '/' + fileName,
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.NOT_FOUND_ERR);
+                }),
+                win = createWin('DirectoryEntry');
+
+            // create:false, exclusive:false, file does not exist
+            runs(function() {
+                root.getFile(fileName, {create:false}, win, fail); 
+            });
+
+            waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(fail).toHaveBeenCalled();
+                expect(win).not.toHaveBeenCalled();
+            });
+        });
+        it("etFile: create new file", function() {
+            var fileName = "de.create.file",
+                filePath = root.fullPath + '/' + fileName,
+                win = jasmine.createSpy().andCallFake(function(entry) {
+                    expect(entry).toBeDefined();
+                    expect(entry.isFile).toBe(true);
+                    expect(entry.isDirectory).toBe(false);
+                    expect(entry.name).toBe(fileName);
+                    expect(entry.fullPath).toBe(filePath);
+                    // cleanup
+                    entry.remove(null, null);
+                }),
+                fail = createFail('DirectoryEntry');
+                    
+            // create:true, exclusive:false, file does not exist
+            runs(function() {
+                root.getFile(fileName, {create: true}, win, fail); 
+            });
+
+            waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(win).toHaveBeenCalled();
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("getFile: create new file (exclusive)", function() {
+            var fileName = "de.create.exclusive.file",
+                filePath = root.fullPath + '/' + fileName,
+                win = jasmine.createSpy().andCallFake(function(entry) {
+                    expect(entry).toBeDefined();
+                    expect(entry.isFile).toBe(true);
+                    expect(entry.isDirectory).toBe(false);
+                    expect(entry.name).toBe(fileName);
+                    expect(entry.fullPath).toBe(filePath);
+                    
+                    // cleanup
+                    entry.remove(null, null);
+                }),
+                fail = createFail('DirectoryEntry');
+
+            // create:true, exclusive:true, file does not exist
+            runs(function() {
+                root.getFile(fileName, {create: true, exclusive:true}, win, fail);
+            });
+
+            waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(win).toHaveBeenCalled();
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("getFile: create file that already exists", function() {
+            var fileName = "de.create.existing.file",
+                filePath = root.fullPath + '/' + fileName,
+                getFile = jasmine.createSpy().andCallFake(function(file) {
+                    // create:true, exclusive:false, file exists
+                    runs(function() {
+                        root.getFile(fileName, {create:true}, win, fail);
+                    });
+
+                    waitsFor(function() { return win.wasCalled; }, "win was never called", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(win).toHaveBeenCalled();
+                        expect(fail).not.toHaveBeenCalled();
+                    });
+                }),
+                fail = createFail('DirectoryEntry'),
+                win = jasmine.createSpy().andCallFake(function(entry) {
+                    expect(entry).toBeDefined();
+                    expect(entry.isFile).toBe(true);
+                    expect(entry.isDirectory).toBe(false);
+                    expect(entry.name).toBe(fileName);
+                    expect(entry.fullPath).toBe(filePath);
+                    
+                    // cleanup
+                    entry.remove(null, fail);
+                });
+            // create file to kick off it
+            runs(function() {
+                root.getFile(fileName, {create:true}, getFile, fail);
+            });
+
+            waitsFor(function() { return getFile.wasCalled; }, "getFile was never called", Tests.TEST_TIMEOUT);
+        });
+        it("getFile: create file that already exists (exclusive)", function() {
+            var fileName = "de.create.exclusive.existing.file",
+                filePath = root.fullPath + '/' + fileName,
+                existingFile,
+                getFile = jasmine.createSpy().andCallFake(function(file) {
+                    existingFile = file;
+                    // create:true, exclusive:true, file exists
+                    runs(function() {
+                        root.getFile(fileName, {create:true, exclusive:true}, win, fail);
+                    });
+
+                    waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(fail).toHaveBeenCalled();
+                        expect(win).not.toHaveBeenCalled();
+                    });
+                }),
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(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);
+            });
+
+            waitsFor(function() { return getFile.wasCalled; }, "getFile never called", Tests.TEST_TIMEOUT);
+        });
+        it("getFile: get Entry for existing file", function() {
+            var fileName = "de.get.file",
+                filePath = root.fullPath + '/' + fileName,
+                win = jasmine.createSpy().andCallFake(function(entry) {
+                    expect(entry).toBeDefined();
+                    expect(entry.isFile).toBe(true);
+                    expect(entry.isDirectory).toBe(false);
+                    expect(entry.name).toBe(fileName);
+                    expect(entry.fullPath).toBe(filePath);
             
-            var dirURL = dirEntry.toURL();
-            // now encode URL and try to resolve
-            window.resolveLocalFileSystemURI(dirURL, testDirFromURL, that.fail);
+                    entry.remove(null, fail); //clean up
+                }),
+                fail = createFail('DirectoryEntry'),
+                getFile = jasmine.createSpy().andCallFake(function(file) {
+                    // create:false, exclusive:false, file exists
+                    runs(function() {
+                        root.getFile(fileName, {create:false}, win, fail);
+                    });
+
+                    waitsFor(function() { return win.wasCalled; }, "getFile success callback", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(win).toHaveBeenCalled();
+                        expect(fail).not.toHaveBeenCalled();
+                    });
+                });
             
-        },
-        testDirFromURL = function(directory) {
-            ok(typeof directory !== 'undefined' && directory !== null, "directory entry should not be null");
-            equal(directory.isFile, false, "directory 'isFile' attribute should be false");
-            equal(directory.isDirectory, true, "directory 'isDirectory' attribute should be true");
-            equal(directory.name, dirName, "directory 'name' attribute should be set");
-            equal(directory.fullPath, dirPath, "directory 'fullPath' attribute should be set");
+            // create file to kick off it
+            runs(function() {
+                root.getFile(fileName, {create:true}, getFile, fail);
+            });
+
+            waitsFor(function() { return getFile.wasCalled; }, "file creation", Tests.TEST_TIMEOUT);
+        });
+        it("DirectoryEntry.getFile: get FileEntry for invalid path", function() {
+            var fileName = "de:invalid:path",
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.ENCODING_ERR);
+                }),
+                win = createWin('DirectoryEntry');
             
-            // cleanup
-            directory.remove(null, that.fail);
-            QUnit.start();
-        };
-        
-        // create:true, exclusive:false, directory does not exist
-        this.root.getDirectory(dirName, {create: true}, getDir, this.fail); 
-    });
-    test("DirectoryEntry.getDirectory: create new dir with space resolveFileSystemURL with encoded URL", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var dirName = "de create dir",
-        dirPath = this.root.fullPath + '/' + dirName,
-        that = this,
-        getDir = function(dirEntry) {
+            // create:false, exclusive:false, invalid path
+            runs(function() {
+                root.getFile(fileName, {create:false}, win, fail);
+            });
+
+            waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(fail).toHaveBeenCalled();
+                expect(win).not.toHaveBeenCalled();
+            });
+
+        });
+        it("DirectoryEntry.getDirectory: get Entry for directory that does not exist", function() {
+            var dirName = "de.no.dir",
+                dirPath = root.fullPath + '/' + dirName,
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.NOT_FOUND_ERR);
+                }),
+                win = createWin('DirectoryEntry');
+                    
+            // create:false, exclusive:false, directory does not exist
+            runs(function() {
+                root.getDirectory(dirName, {create:false}, win, fail);
+            });
+
+            waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(fail).toHaveBeenCalled();
+                expect(win).not.toHaveBeenCalled();
+            });
+        });
+        it("DirectoryEntry.getDirectory: create new dir with space then resolveFileSystemURL", function() {
+            var dirName = "de create dir",
+                dirPath = root.fullPath + '/' + dirName,
+                getDir = jasmine.createSpy().andCallFake(function(dirEntry) {
+                    var dirURL = dirEntry.toURL();
+                    // now encode URL and try to resolve
+                    runs(function() {
+                        window.resolveLocalFileSystemURI(dirURL, win, fail);
+                    });
+
+                    waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+                    runs(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');
             
-            var dirURL = dirEntry.toURL();
-            // now encode URL and try to resolve
-            window.resolveLocalFileSystemURI(encodeURI(dirURL), testDirFromURL, that.fail);
+            // create:true, exclusive:false, directory does not exist
+            runs(function() {
+                root.getDirectory(dirName, {create: true}, getDir, fail);
+            });
+
+            waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT);
+        });
+        it("DirectoryEntry.getDirectory: create new dir with space resolveFileSystemURL with encoded URL", function() {
+            var dirName = "de create dir",
+                dirPath = root.fullPath + '/' + dirName,
+                getDir = jasmine.createSpy().andCallFake(function(dirEntry) {
+                    var dirURL = dirEntry.toURL();
+                    // now encode URL and try to resolve
+                    runs(function() {
+                        window.resolveLocalFileSystemURI(encodeURI(dirURL), win, fail);
+                    });
+
+                    waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+                    runs(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');
             
-        },
-        testDirFromURL = function(directory) {
-            ok(typeof directory !== 'undefined' && directory !== null, "directory entry should not be null");
-            equal(directory.isFile, false, "directory 'isFile' attribute should be false");
-            equal(directory.isDirectory, true, "directory 'isDirectory' attribute should be true");
-            equal(directory.name, dirName, "directory 'name' attribute should be set");
-            equal(directory.fullPath, dirPath, "directory 'fullPath' attribute should be set");
-        
-            // cleanup
-            directory.remove(null, that.fail);
-            QUnit.start();
-        };
-        
-        // create:true, exclusive:false, directory does not exist
-        this.root.getDirectory(dirName, {create: true}, getDir, this.fail); 
-    });
-
-    test("DirectoryEntry.getDirectory: create new directory", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var dirName = "de.create.dir",
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            testDir = function(directory) {
-                ok(typeof directory !== 'undefined' && directory !== null, "directory entry should not be null");
-                equal(directory.isFile, false, "directory 'isFile' attribute should be false");
-                equal(directory.isDirectory, true, "directory 'isDirectory' attribute should be true");
-                equal(directory.name, dirName, "directory 'name' attribute should be set");
-                equal(directory.fullPath, dirPath, "directory 'fullPath' attribute should be set");
-                
-                // cleanup
-                directory.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create:true, exclusive:false, directory does not exist
-        this.root.getDirectory(dirName, {create: true}, testDir, this.fail); 
-    });
-    
-    test("DirectoryEntry.getDirectory: create new directory (exclusive)", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var dirName = "de.create.exclusive.dir",
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            testDir = function(directory) {
-                ok(typeof directory !== 'undefined' && directory !== null, "directory entry should not be null");
-                equal(directory.isFile, false, "directory 'isFile' attribute should be false");
-                equal(directory.isDirectory, true, "directory 'isDirectory' attribute should be true");
-                equal(directory.name, dirName, "directory 'name' attribute should be set");
-                equal(directory.fullPath, dirPath, "directory 'fullPath' attribute should be set");
-               
-                // cleanup
-                directory.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create:true, exclusive:true, directory does not exist
-        this.root.getDirectory(dirName, {create: true, exclusive:true}, testDir, this.fail); 
-    });
-    test("DirectoryEntry.getDirectory: create directory that already exists", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var dirName = "de.create.existing.dir",
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            getDir = function(directory) {
-                // create:true, exclusive:false, directory exists
-                that.root.getDirectory(dirName, {create:true}, testDir, that.fail);             
-            },
-            testDir = function(directory) {
-                ok(typeof directory !== 'undefined' && directory !== null, "directory entry should not be null");
-                equal(directory.isFile, false, "directory 'isFile' attribute should be false");
-                equal(directory.isDirectory, true, "directory 'isDirectory' attribute should be true");
-                equal(directory.name, dirName, "directory 'name' attribute should be set");
-                equal(directory.fullPath, dirPath, "directory 'fullPath' attribute should be set");
-                
-                // cleanup
-                directory.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create directory to kick off test
-        this.root.getDirectory(dirName, {create:true}, getDir, this.fail); 
-    });
-    test("DirectoryEntry.getDirectory: create directory that already exists (exclusive)", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var dirName = "de.create.exclusive.existing.dir",
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            existingDir,
-            getDir = function(directory) {
-                existingDir = directory;
-                // create:true, exclusive:true, directory exists
-                that.root.getDirectory(dirName, {create:true, exclusive:true}, null, testDir);             
-            },
-            testDir = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "creating exclusive directory that already exists is an error");
-                equal(error.code, FileError.PATH_EXISTS_ERR, "error code should be FileError.PATH_EXISTS_ERR");
-                
-                // cleanup
-                existingDir.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create directory to kick off test
-        this.root.getDirectory(dirName, {create:true}, getDir, this.fail); 
-    });
-    test("DirectoryEntry.getDirectory: get Entry for existing directory", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(5);
-        
-        var dirName = "de.get.dir",
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            getDir = function(directory) {
-                // create:false, exclusive:false, directory exists
-                that.root.getDirectory(dirName, {create:false}, testDir, that.fail);             
-            },
-            testDir = function(directory) {
-                ok(typeof directory !== 'undefined' && directory !== null, "directory entry should not be null");
-                equal(directory.isFile, false, "directory 'isFile' attribute should be false");
-                equal(directory.isDirectory, true, "directory 'isDirectory' attribute should be true");
-                equal(directory.name, dirName, "directory 'name' attribute should be set");
-                equal(directory.fullPath, dirPath, "directory 'fullPath' attribute should be set");
-                
-                // cleanup
-                directory.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create directory to kick off test
-        this.root.getDirectory(dirName, {create:true}, getDir, this.fail); 
-    });
-    test("DirectoryEntry.getDirectory: get DirectoryEntry for invalid path", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var dirName = "de:invalid:path",
-            that = this,
-            testDir = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "retrieving a directory using an invalid path is an error");
-                equal(error.code, FileError.ENCODING_ERR, "error code should be FileError.ENCODING_ERR");
-                
-                // cleanup
-                QUnit.start();
-            };
-                
-        // create:false, exclusive:false, invalid path
-        this.root.getDirectory(dirName, {create:false}, null, testDir); 
-    });
-    test("DirectoryEntry.getDirectory: get DirectoryEntry for existing file", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var fileName = "de.existing.file",
-            existingFile,
-            filePath = this.root.fullPath + '/' + fileName,
-            that = this,
-            getDir = function(file) {
-                existingFile = file;
-                // create:false, exclusive:false, existing file
-                that.root.getDirectory(fileName, {create:false}, null, testDir);             
-            },
-            testDir = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "retrieving directory for existing file is an error");
-                equal(error.code, FileError.TYPE_MISMATCH_ERR, "error code should be FileError.TYPE_MISMATCH_ERR");
-                
-                // cleanup
-                existingFile.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create file to kick off test
-        this.root.getFile(fileName, {create:true}, getDir, this.fail); 
-    });
-    test("DirectoryEntry.getFile: get FileEntry for existing directory", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var dirName = "de.existing.dir",
-            existingDir,
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            getFile = function(directory) {
-                existingDir = directory;
-                // create:false, exclusive:false, existing directory
-                that.root.getFile(dirName, {create:false}, null, testFile);             
-            },
-            testFile = function(error) {
-                ok(typeof error !== 'undefined' && error !== null, "retrieving file for existing directory is an error");
-                equal(error.code, FileError.TYPE_MISMATCH_ERR, "error code should be FileError.TYPE_MISMATCH_ERR");
-               
-                // cleanup
-                existingDir.remove(null, that.fail);
-                QUnit.start();
-            };
-                
-        // create directory to kick off test
-        this.root.getDirectory(dirName, {create:true}, getFile, this.fail); 
-    });
-    test("DirectoryEntry.removeRecursively on directory", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(2);
-        
-        var dirName = "de.removeRecursively",
-            subDirName = "dir",
-            dirPath = this.root.fullPath + '/' + dirName,
-            //subDirPath = this.root.fullPath + '/' + subDirName,
-            subDirPath = dirPath + '/' + subDirName,
-            that = this,
-            entryCallback = function(entry) {
-                // delete directory
-                var deleteDirectory = function(directory) {
-                    entry.removeRecursively(testRemove, that.fail);  
-                }; 
-                // create a sub-directory within directory
-                entry.getDirectory(subDirName, {create: true}, deleteDirectory, that.fail);
-                },
-                testRemove = function() {
-                    // test that removed directory no longer exists
-                    that.root.getDirectory(dirName, {create:false}, null, testDirExists);
-                },
-                testDirExists = function(error){
-                    ok(typeof error !== 'undefined' && error !== null, "removed directory should not exist");
-                    equal(error.code, FileError.NOT_FOUND_ERR, "error code should be FileError.NOT_FOUND_ERR");
-                    QUnit.start();
-                };
-
-        // create a new directory entry to kick off test
-        this.root.getDirectory(dirName, {create:true}, entryCallback, this.fail);
-    });
-    test("DirectoryEntry.createReader: create reader on existing directory", function() {
-        expect(2);
-        
-        // create reader for root directory 
-        var reader = this.root.createReader();
-        ok(typeof reader !== 'undefined' && reader !== null, "reader object should not be null");
-        ok(typeof reader.readEntries === 'function', "reader object should have a 'readEntries' method");
-    });
-    module('DirectoryReader interface', {
-        // setup function will run before each test
-        setup: function() {
-            this.root = getFileSystemRoot();
-            this.fail = function(error) {
-                console.log('file error: ' + error.code);
-            };   
-        }
-    });
-    test("DirectoryReader.readEntries: read contents of existing directory", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(4);
-        
-        var reader,
-         testEntries = function(entries) {
-                ok(typeof entries !== 'undefined' && entries !== null, "directory entries should not be null");
-                ok(entries.constructor === Array, "readEntries should return an array of entries");
-                QUnit.start();
-            };
+            // create:true, exclusive:false, directory does not exist
+            runs(function() {
+                root.getDirectory(dirName, {create: true}, getDir, fail);
+            });
+
+            waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT);
+        });
+
+        it("DirectoryEntry.getDirectory: create new directory", function() {
+            var dirName = "de.create.dir",
+                dirPath = root.fullPath + '/' + dirName,
+                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}, win, fail); 
+            });
+
+            waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(win).toHaveBeenCalled();
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        
+        it("DirectoryEntry.getDirectory: create new directory (exclusive)", function() {
+            var dirName = "de.create.exclusive.dir",
+                dirPath = root.fullPath + '/' + dirName,
+                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:true, directory does not exist
+            runs(function() {
+                root.getDirectory(dirName, {create: true, exclusive:true}, win, fail); 
+            });
+
+            waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(win).toHaveBeenCalled();
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("DirectoryEntry.getDirectory: create directory that already exists", function() {
+            var dirName = "de.create.existing.dir",
+                dirPath = root.fullPath + '/' + dirName,
+                getDir = jasmine.createSpy().andCallFake(function(directory) {
+                    // create:true, exclusive:false, directory exists
+                    runs(function() {
+                        root.getDirectory(dirName, {create:true}, win, fail);
+                    });
+
+                    waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+                    runs(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 directory to kick off it
+            runs(function() {
+                root.getDirectory(dirName, {create:true}, getDir, this.fail); 
+            });
+
+            waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT);
+        });
+        it("DirectoryEntry.getDirectory: create directory that already exists (exclusive)", function() {
+            var dirName = "de.create.exclusive.existing.dir",
+                dirPath = root.fullPath + '/' + dirName,
+                existingDir,
+                getDir = jasmine.createSpy().andCallFake(function(directory) {
+                    existingDir = directory;
+                    // create:true, exclusive:true, directory exists
+                    runs(function() {
+                        root.getDirectory(dirName, {create:true, exclusive:true}, win, fail);
+                    });
+
+                    waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(fail).toHaveBeenCalled();
+                        expect(win).not.toHaveBeenCalled();
+                    });
+                }),
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(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() {
+            var dirName = "de.get.dir",
+                dirPath = root.fullPath + '/' + dirName,
+                getDir = jasmine.createSpy().andCallFake(function(directory) {
+                    // create:false, exclusive:false, directory exists
+                    runs(function() {
+                        root.getDirectory(dirName, {create:false}, win, fail);
+                    });
+
+                    waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+                    runs(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 directory to kick off it
+            root.getDirectory(dirName, {create:true}, getDir, fail);
+        });
+        it("DirectoryEntry.getDirectory: get DirectoryEntry for invalid path", function() {
+            var dirName = "de:invalid:path",
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.ENCODING_ERR);
+                }),
+                win = createWin('DirectoryEntry');
+                    
+            // create:false, exclusive:false, invalid path
+            runs(function() {
+                root.getDirectory(dirName, {create:false}, win, fail); 
+            });
+
+            waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(fail).toHaveBeenCalled();
+                expect(win).not.toHaveBeenCalled();
+            });
+        });
+        it("DirectoryEntry.getDirectory: get DirectoryEntry for existing file", function() {
+            var fileName = "de.existing.file",
+                existingFile,
+                filePath = root.fullPath + '/' + fileName,
+                getDir = jasmine.createSpy().andCallFake(function(file) {
+                    existingFile = file;
+                    // create:false, exclusive:false, existing file
+                    runs(function() {
+                        root.getDirectory(fileName, {create:false}, win, fail);
+                    });
+
+                    waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(fail).toHaveBeenCalled();
+                        expect(win).not.toHaveBeenCalled();
+                    });
+                }),
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(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);
+            });
+
+            waitsFor(function() { return getDir.wasCalled; }, "getDir was called", Tests.TEST_TIMEOUT);
+        });
+        it("DirectoryEntry.getFile: get FileEntry for existing directory", function() {
+            var dirName = "de.existing.dir",
+                existingDir,
+                dirPath = root.fullPath + '/' + dirName,
+                getFile = jasmine.createSpy().andCallFake(function(directory) {
+                    existingDir = directory;
+                    // create:false, exclusive:false, existing directory
+                    runs(function() {
+                        root.getFile(dirName, {create:false}, win, fail);
+                    });
+
+                    waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(fail).toHaveBeenCalled();
+                        expect(win).not.toHaveBeenCalled();
+                    });
+                }),
+                fail = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(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);
+            });
+
+            waitsFor(function() { return getFile.wasCalled; }, "getFile never called", Tests.TEST_TIMEOUT);
+        });
+        it("DirectoryEntry.removeRecursively on directory", function() {
+            var dirName = "de.removeRecursively",
+                subDirName = "dir",
+                dirPath = root.fullPath + '/' + dirName,
+                //subDirPath = this.root.fullPath + '/' + subDirName,
+                subDirPath = dirPath + '/' + subDirName,
+                entryCallback = jasmine.createSpy().andCallFake(function(entry) {
+                    // delete directory
+                    var deleteDirectory = jasmine.createSpy().andCallFake(function(directory) {
+                        runs(function() {
+                            entry.removeRecursively(remove, fail);
+                        });
+
+                        waitsFor(function() { return remove.wasCalled; }, "remove never called", Tests.TEST_TIMEOUT);
+                    });
+                    // create a sub-directory within directory
+                    runs(function() {
+                        entry.getDirectory(subDirName, {create: true}, deleteDirectory, fail);
+                    });
+
+                    waitsFor(function() { return deleteDirectory.wasCalled; }, "deleteDirectory never called", Tests.TEST_TIMEOUT);
+                }),
+                remove = jasmine.createSpy().andCallFake(function() {
+                    // it that removed directory no longer exists
+                    runs(function() {
+                        root.getDirectory(dirName, {create:false}, win, dirExists);
+                    });
+
+                    waitsFor(function() { return dirExists.wasCalled; }, "dirExists never called", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(dirExists).toHaveBeenCalled();
+                        expect(win).not.toHaveBeenCalled();
+                    });
+                }),
+                dirExists = jasmine.createSpy().andCallFake(function(error){
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.NOT_FOUND_ERR);
+                }),
+                fail = createFail('DirectoryEntry'),
+                win = createWin('DirectoryEntry');
+
+            // create a new directory entry to kick off it
+            runs(function() {
+                root.getDirectory(dirName, {create:true}, entryCallback, fail);
+            });
+
+            waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
+        });
+        it("createReader: create reader on existing directory", function() {
+            // create reader for root directory 
+            var reader = root.createReader();
+            expect(reader).toBeDefined();
+            expect(typeof reader.readEntries).toBe('function');
+        });
+        it("removeRecursively on root file system", function() {
+            var remove = jasmine.createSpy().andCallFake(function(error) {
+                    expect(error).toBeDefined();
+                    expect(error.code).toBe(FileError.NO_MODIFICATION_ALLOWED_ERR);
+                }),
+                win = createWin('DirectoryEntry');
+
+            // remove root file system
+            runs(function() {
+                root.removeRecursively(win, remove);
+            });
+
+            waitsFor(function() { return remove.wasCalled; }, "remove never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(win).not.toHaveBeenCalled();
+                expect(remove).toHaveBeenCalled();
+            });
+        });
+    });
+
+    describe('DirectoryReader interface', function() {
+        describe("readEntries", function() {
+            it("should read contents of existing directory", function() {
+                var reader,
+                    win = jasmine.createSpy().andCallFake(function(entries) {
+                        expect(entries).toBeDefined();
+                        expect(entries instanceof Array).toBe(true);
+                    }),
+                    fail = createFail('DirectoryReader');
                 
-        // create reader for root directory 
-        reader = this.root.createReader();
-        ok(typeof reader !== 'undefined' && reader !== null, "reader object should not be null");
-        ok(typeof reader.readEntries === 'function', "reader object should have a 'readEntries' method");
-        
-        // read entries
-        reader.readEntries(testEntries, this.fail);
-    });
-    test("DirectoryReader.readEntries: read contents of directory that has been removed", function() {
-        QUnit.stop(Tests.TEST_TIMEOUT);
-        expect(4);
-        
-        var dirName = "de.createReader.notfound",
-            dirPath = this.root.fullPath + '/' + dirName,
-            that = this,
-            entryCallback = function(directory) {
+                // create reader for root directory 
+                reader = root.createReader();
                 // read entries
-                var readEntries = function() {
-                    var reader = directory.createReader();
-                    reader.readEntries(null, testReader);
-                };
-                // delete directory
-                directory.removeRecursively(readEntries, that.fail);  
-            },
-            testReader = function(error) {
-                var testDirectoryExists = function(error) {
-                    ok(typeof error !== 'undefined' && error !== null, "reading entries on a directory that does not exist is an error")
-                    equal(error.code, FileError.NOT_FOUND_ERR, "removed directory should not exist");
-                    QUnit.start();
-                };
-                ok(typeof error !== 'undefined' && error !== null, "reading entries on a directory that does not exist is an error")
-                equal(error.code, FileError.NOT_FOUND_ERR, "error code should be FileError.NOT_FOUND_ERR");
-                that.root.getDirectory(dirName, {create:false}, null, testDirectoryExists);
-            };
+                runs(function() {
+                    reader.readEntries(win, fail);
+                });
+
+                waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+                runs(function() {
+                    expect(win).toHaveBeenCalled();
+                    expect(fail).not.toHaveBeenCalled();
+                });
+            });
+            it("should read contents of directory that has been removed", function() {
+                var dirName = "de.createReader.notfound",
+                    dirPath = root.fullPath + '/' + dirName,
+                    entryCallback = jasmine.createSpy().andCallFake(function(directory) {
+                        // read entries
+                        var readEntries = jasmine.createSpy().andCallFake(function() {
+                            var reader = directory.createReader();
+                            
+                            runs(function() {
+                                reader.readEntries(win, itReader);
+                            });
+
+                            waitsFor(function() { return itReader.wasCalled; }, "itReader never called", Tests.TEST_TIMEOUT);
+                        });
+                        // delete directory
+                        runs(function() {
+                            directory.removeRecursively(readEntries, fail);
+                        });
+
+                        waitsFor(function() { return readEntries.wasCalled; }, "readEntries never called", Tests.TEST_TIMEOUT);
+                    }),
+                    itReader = jasmine.createSpy().andCallFake(function(error) {
+                        var itDirectoryExists = jasmine.createSpy().andCallFake(function(error) {
+                            expect(error).toBeDefined();
+                            expect(error.code).toBe(FileError.NOT_FOUND_ERR);
+                        });
+
+                        expect(error).toBeDefined();
+                        expect(error.code).toBe(FileError.NOT_FOUND_ERR);
+
+                        runs(function() {
+                            root.getDirectory(dirName, {create:false}, win, itDirectoryExists);
+                        });
+
+                        waitsFor(function() { return itDirectoryExists.wasCalled; }, "itDirectoryExists never called", Tests.TEST_TIMEOUT);
+
+                        runs(function() {
+                            expect(itDirectoryExists).toHaveBeenCalled();
+                            expect(win).not.toHaveBeenCalled();
+                        });
+                    }),
+                    fail = createFail('DirectoryReader'),
+                    win = createWin('DirectoryReader');
+
+                // create a new directory entry to kick off it
+                runs(function() {
+                    root.getDirectory(dirName, {create:true}, entryCallback, fail);
+                });
+
+                waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
+            });
+        });
+    });
+
+    describe('File', function() {
+        it("constructor should be defined", function() {
+            expect(File).toBeDefined();
+            expect(typeof File).toBe('function');
+        });
+        it("should be define File attributes", function() {
+            var file = new File();
+            expect(file.name).toBeDefined();
+            expect(file.fullPath).toBeDefined();
+            expect(file.type).toBeDefined();
+            expect(file.lastModifiedDate).toBeDefined();
+            expect(file.size).toBeDefined();
+        });
+    });
+
+    describe('FileEntry', function() {
+        it("should be define FileEntry methods", function() {
+            var fileName = "fe.methods",
+                itFileEntry = jasmine.createSpy().andCallFake(function(fileEntry) {
+                    expect(fileEntry).toBeDefined();
+                    expect(typeof fileEntry.createWriter).toBe('function');
+                    expect(typeof fileEntry.file).toBe('function');
+                    
+                    // 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);
+            });
+
+            waitsFor(function() { return itFileEntry.wasCalled; }, "itFileEntry never called", Tests.TEST_TIMEOUT);
+
+            runs(function() {
+                expect(itFileEntry).toHaveBeenCalled();
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("createWriter should return a FileWriter object", function() {
+            var fileName = "fe.createWriter",
+                itFile,
+                entryCallback = jasmine.createSpy().andCallFake(function(fileEntry) {
+                    itFile = fileEntry;
+
+                    runs(function() {
+                        fileEntry.createWriter(itWriter, fail);
+                    });
+
+                    waitsFor(function() { return itWriter.wasCalled; }, "itWriter", Tests.TEST_TIMEOUT);
+
+                    runs(function() {
+                        expect(itWriter).toHaveBeenCalled();
+                        expect(fail).not.toHaveBeenCalled();
+                    });
+                }),
+                itWriter = jasmine.createSpy().andCallFake(function(writer) {
+                    expect(writer).toBeDefined();
+                    expect(writer instanceof FileWriter).toBe(true);
+                    
+                    // 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);
+            });
+
+            waitsFor(function() 

<TRUNCATED>

Mime
View raw message