OLD | NEW |
1 if (this.importScripts) { | 1 if (this.importScripts) { |
2 importScripts('../resources/fs-worker-common.js'); | 2 importScripts('../resources/fs-worker-common.js'); |
3 importScripts('../../js/resources/js-test-pre.js'); | 3 importScripts('../../js/resources/js-test-pre.js'); |
4 importScripts('../resources/fs-test-util.js'); | 4 importScripts('../resources/fs-test-util.js'); |
5 } | 5 } |
6 | 6 |
7 description("Test making multiple synchronous FileSystem operations."); | 7 description("Test making multiple synchronous FileSystem operations."); |
8 | 8 |
9 var fileSystem = webkitRequestFileSystemSync(this.TEMPORARY, 100); | 9 var fileSystem = webkitRequestFileSystemSync(this.TEMPORARY, 100); |
10 removeAllInDirectorySync(fileSystem.root); | 10 removeAllInDirectorySync(fileSystem.root); |
11 | 11 |
12 // Stage 1 (prepare) | 12 // Stage 1 (prepare) |
13 var a = fileSystem.root.getFile('a', {create:true}); | 13 var a = fileSystem.root.getFile('a', {create:true}); |
14 var b = fileSystem.root.getDirectory('b', {create:true}); | 14 var b = fileSystem.root.getDirectory('b', {create:true}); |
15 var c = fileSystem.root.getDirectory('c', {create:true}); | 15 var c = fileSystem.root.getDirectory('c', {create:true}); |
16 var d = fileSystem.root.getFile('d', {create:true}); | 16 var d = fileSystem.root.getFile('d', {create:true}); |
17 | 17 |
18 // Stage 2 (test) | 18 // Stage 2 (test) |
19 var a_copy = a.copyTo(b, 'tmp'); | 19 var a_copy = a.copyTo(b, 'tmp'); |
20 var metadata = a.getMetadata(); | 20 var metadata = a.getMetadata(); |
21 var b_parent = b.getParent(); | 21 var b_parent = b.getParent(); |
22 var c_copy = c.copyTo(fileSystem.root, 'f'); | 22 var c_copy = c.copyTo(fileSystem.root, 'f'); |
23 var d_new = d.moveTo(fileSystem.root, 'd2'); | 23 var d_new = d.moveTo(fileSystem.root, 'd2'); |
24 var e = fileSystem.root.getFile('e', {create:true}); | 24 var e = fileSystem.root.getFile('e', {create:true}); |
25 | 25 |
26 // Verify | 26 // Verify |
27 var reader = fileSystem.root.createReader(); | 27 var reader = fileSystem.root.createReader(); |
28 var dirsCount = 0; | 28 var dirsCount = 0; |
29 var paths = []; | 29 var paths = []; |
| 30 var entries; |
30 do { | 31 do { |
31 var entries = reader.readEntries(); | 32 entries = reader.readEntries(); |
| 33 shouldBe('entries.__proto__', 'Array.prototype'); |
32 for (var i = 0; i < entries.length; ++i) { | 34 for (var i = 0; i < entries.length; ++i) { |
33 paths.push(entries[i].fullPath); | 35 paths.push(entries[i].fullPath); |
34 if (entries[i].isDirectory) | 36 if (entries[i].isDirectory) |
35 dirsCount++; | 37 dirsCount++; |
36 } | 38 } |
37 } while (entries.length); | 39 } while (entries.length); |
38 | 40 |
39 paths.sort(); | 41 paths.sort(); |
40 shouldBe('"' + paths.join(',') + '"', '"/a,/b,/c,/d2,/e,/f"'); | 42 shouldBe('"' + paths.join(',') + '"', '"/a,/b,/c,/d2,/e,/f"'); |
41 shouldBe("dirsCount", "3"); | 43 shouldBe("dirsCount", "3"); |
42 removeAllInDirectorySync(fileSystem.root); | 44 removeAllInDirectorySync(fileSystem.root); |
43 finishJSTest(); | 45 finishJSTest(); |
OLD | NEW |