OLD | NEW |
1 library fileapi; | 1 library fileapi; |
2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
3 import '../../pkg/unittest/lib/html_individual_config.dart'; | 3 import '../../pkg/unittest/lib/html_individual_config.dart'; |
4 import 'dart:html'; | 4 import 'dart:html'; |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 class FileAndDir { | 7 class FileAndDir { |
8 FileEntry file; | 8 FileEntry file; |
9 DirectoryEntry dir; | 9 DirectoryEntry dir; |
10 FileAndDir(this.file, this.dir); | 10 FileAndDir(this.file, this.dir); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Do the boilerplate to get several files and directories created to then | 93 // Do the boilerplate to get several files and directories created to then |
94 // test the functions that use those items. | 94 // test the functions that use those items. |
95 Future doDirSetup() { | 95 Future doDirSetup() { |
96 return fs.root.createFile( | 96 return fs.root.createFile( |
97 'file4') | 97 'file4') |
98 .then((FileEntry file) { | 98 .then((FileEntry file) { |
99 return fs.root.createDirectory( | 99 return fs.root.createDirectory( |
100 'directory3') | 100 'directory3') |
101 .then((DirectoryEntry dir) { | 101 .then((DirectoryEntry dir) { |
102 return new Future.immediate(new FileAndDir(file, dir)); | 102 return new Future.value(new FileAndDir(file, dir)); |
103 }); | 103 }); |
104 }); | 104 }); |
105 } | 105 } |
106 | 106 |
107 group('directoryReader', () { | 107 group('directoryReader', () { |
108 if (FileSystem.supported) { | 108 if (FileSystem.supported) { |
109 test('getFileSystem', getFileSystem); | 109 test('getFileSystem', getFileSystem); |
110 | 110 |
111 test('readEntries', () { | 111 test('readEntries', () { |
112 return doDirSetup() | 112 return doDirSetup() |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 expect(fileObj.name, fileAndDir.file.name); | 189 expect(fileObj.name, fileAndDir.file.name); |
190 expect(fileObj.relativePath, ''); | 190 expect(fileObj.relativePath, ''); |
191 expect(new DateTime.now().difference( | 191 expect(new DateTime.now().difference( |
192 fileObj.lastModifiedDate).inSeconds, lessThan(60)); | 192 fileObj.lastModifiedDate).inSeconds, lessThan(60)); |
193 }); | 193 }); |
194 }); | 194 }); |
195 }); | 195 }); |
196 } | 196 } |
197 }); | 197 }); |
198 } | 198 } |
OLD | NEW |