Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: LayoutTests/fast/filesystem/script-tests/read-directory.js

Issue 22436002: Replace EntryArray type by an Entry[] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description("DirectoryReader.readEntries() test."); 1 description("DirectoryReader.readEntries() test.");
2 var fileSystem = null; 2 var fileSystem = null;
3 var reader = null; 3 var reader = null;
4 var resultEntries = []; 4 var resultEntries = [];
5 5
6 var readEntriesCount = 0; 6 var readEntriesCount = 0;
7 var entriesCallbackCount = 0; 7 var entriesCallbackCount = 0;
8 8
9 // path: isDirectory map. 9 // path: isDirectory map.
10 var testEntries = { 10 var testEntries = {
(...skipping 24 matching lines...) Expand all
35 shouldBe('readEntriesCount', 'entriesCallbackCount'); 35 shouldBe('readEntriesCount', 'entriesCallbackCount');
36 shouldBe('resultEntries.length', 'testEntriesCount'); 36 shouldBe('resultEntries.length', 'testEntriesCount');
37 resultEntries.sort(function(a, b) { return (a.fullPath > b.fullPath) ? 1 : ( a.fullPath < b.fullPath) ? -1 : 0; }); 37 resultEntries.sort(function(a, b) { return (a.fullPath > b.fullPath) ? 1 : ( a.fullPath < b.fullPath) ? -1 : 0; });
38 for (i = 0; i < resultEntries.length; ++i) { 38 for (i = 0; i < resultEntries.length; ++i) {
39 entry = resultEntries[i]; 39 entry = resultEntries[i];
40 debug('Entry:' + entry.fullPath + ' isDirectory:' + entry.isDirectory); 40 debug('Entry:' + entry.fullPath + ' isDirectory:' + entry.isDirectory);
41 shouldBe('testEntries[entry.fullPath]', 'entry.isDirectory'); 41 shouldBe('testEntries[entry.fullPath]', 'entry.isDirectory');
42 } 42 }
43 } 43 }
44 44
45 function entriesCallback(entries) 45 var entries;
46 function entriesCallback(_entries)
46 { 47 {
47 entriesCallbackCount++; 48 entriesCallbackCount++;
48 49 entries = _entries;
49 for (var i = 0; i < entries.length; ++i) 50 shouldBe("entries.__proto__", "Array.prototype");
50 resultEntries.push(entries[i]); 51 resultEntries.push.apply(resultEntries, entries);
51 52
52 if (entries.length) { 53 if (entries.length) {
53 readEntriesCount++; 54 readEntriesCount++;
54 reader.readEntries(entriesCallback, errorCallback); 55 reader.readEntries(entriesCallback, errorCallback);
55 } else { 56 } else {
56 // Must have read all the entries. 57 // Must have read all the entries.
57 verifyTestResult(); 58 verifyTestResult();
58 endTest(); 59 endTest();
59 } 60 }
60 } 61 }
(...skipping 25 matching lines...) Expand all
86 fileSystem = fs; 87 fileSystem = fs;
87 debug("Successfully obtained Persistent FileSystem:" + fileSystem.name); 88 debug("Successfully obtained Persistent FileSystem:" + fileSystem.name);
88 removeAllInDirectory(fileSystem.root, prepareForTest, errorCallback); 89 removeAllInDirectory(fileSystem.root, prepareForTest, errorCallback);
89 } 90 }
90 91
91 if (window.webkitRequestFileSystem) { 92 if (window.webkitRequestFileSystem) {
92 webkitRequestFileSystem(window.TEMPORARY, 100, successCallback, errorCallbac k); 93 webkitRequestFileSystem(window.TEMPORARY, 100, successCallback, errorCallbac k);
93 window.jsTestIsAsync = true; 94 window.jsTestIsAsync = true;
94 } else 95 } else
95 debug("This test requires FileSystem API support."); 96 debug("This test requires FileSystem API support.");
OLDNEW
« no previous file with comments | « LayoutTests/fast/filesystem/resources/op-tests-helper.js ('k') | Source/bindings/scripts/code_generator_v8.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698