Updated Branches: refs/heads/master f990e841d -> 69520560d
[CB-4017] Added a DirectoryReader test. Second and subsequent calls to DirectoryReader.readEntries return an empty list. Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/69520560 Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/69520560 Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/69520560 Branch: refs/heads/master Commit: 69520560d203b6d52c4c73849297952cc41a4076 Parents: f990e84 Author: Max Woghiren <[email protected]> Authored: Mon Jul 8 13:59:10 2013 -0400 Committer: Max Woghiren <[email protected]> Committed: Mon Jul 8 14:03:31 2013 -0400 ---------------------------------------------------------------------- autotest/tests/file.tests.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/69520560/autotest/tests/file.tests.js ---------------------------------------------------------------------- diff --git a/autotest/tests/file.tests.js b/autotest/tests/file.tests.js index ac63518..d742e13 100644 --- a/autotest/tests/file.tests.js +++ b/autotest/tests/file.tests.js @@ -1013,6 +1013,37 @@ describe('File API', function() { expect(fail).not.toHaveBeenCalled(); }); }); + it("file.spec.109 should return an empty entry list on the second call", function() { + var reader, + initialWin = jasmine.createSpy().andCallFake(function(entries) { + expect(entries).toBeDefined(); + expect(entries instanceof Array).toBe(true); + expect(entries.length).not.toBe(0); + // Run it again! + reader.readEntries(finalWin, fail); + }), + finalWin = jasmine.createSpy().andCallFake(function(entries) { + expect(entries).toBeDefined(); + expect(entries instanceof Array).toBe(true); + expect(entries.length).toBe(0); + }), + fail = createFail('DirectoryReader'); + + // create reader for root directory + reader = root.createReader(); + // read entries + runs(function() { + reader.readEntries(initialWin, fail); + }); + + waitsFor(function() { return finalWin.wasCalled; }, "finalWin never called", Tests.TEST_TIMEOUT); + + runs(function() { + expect(initialWin).toHaveBeenCalled(); + expect(finalWin).toHaveBeenCalled(); + expect(fail).not.toHaveBeenCalled(); + }); + }); it("file.spec.38 should read contents of directory that has been removed", function() { var dirName = "de.createReader.notfound", dirPath = root.fullPath + '/' + dirName,
