1 description("This tests if Entries returned by callbacks keep functioning even after we lose a reference to the filesystem in the script.");
3 var testDirectory = null;
4 var testEntries = null;
6 function errorCallback(error)
8 testFailed("Error occurred: " + error.name);
12 function runTest1(root)
14 debug("Running runTest1()...");
15 var helper = new JoinHelper();
16 var done = function() { helper.done(); };
18 helper.run(function() { root.getFile('a', {create:true}, done, errorCallback); });
19 helper.run(function() { root.getDirectory('b', {create:true}, done, errorCallback); });
20 helper.run(function() { root.getDirectory('c', {create:true}, done, errorCallback); });
23 helper.join(function() { runTest2(root); });
26 function runTest2(root)
28 debug("Running runTest2()...");
29 var helper = new JoinHelper();
30 var done = function() { helper.done(); };
32 helper.run(function() { root.getFile('/b/1', {create:true}, done, errorCallback); });
33 helper.run(function() { root.getFile('/b/2', {create:true}, done, errorCallback); });
34 helper.run(function() { root.getFile('/b/3', {create:true}, done, errorCallback); });
35 helper.run(function() { root.getFile('/b/4', {create:true}, done, errorCallback); });
36 helper.run(function() { root.getDirectory('b', {create:false}, function(entry) { testDirectory = entry; helper.done(); }, errorCallback); });
39 helper.join(function() { runTest3(); });
44 debug("Running runTest3()...");
45 testDirectory.createReader().readEntries(entriesCallback, errorCallback);
50 function entriesCallback(entries)
52 debug("Running runTest4()...");
53 testEntries = entries;
54 shouldBe("testEntries.length", "4");
58 function fileSystemCallback(fs)
61 removeAllInDirectory(fs.root, function() { runTest1(root); }, errorCallback);
66 if (window.webkitRequestFileSystem) {
67 window.jsTestIsAsync = true;
68 webkitRequestFileSystem(window.TEMPORARY, 100, fileSystemCallback, errorCallback);
70 debug("This test requires FileSystem API support.");