d7a8aa155f
R=vsm@google.com Change-Id: I77881201f1e89f731476655476eb865e10d581a1 Reviewed-on: https://dart-review.googlesource.com/38164 Commit-Queue: Terry Lucas <terry@google.com> Reviewed-by: Vijay Menon <vsm@google.com>
46 lines
1.1 KiB
Dart
46 lines
1.1 KiB
Dart
library fileapi;
|
|
|
|
import 'dart:async';
|
|
import 'dart:html';
|
|
|
|
import 'package:unittest/unittest.dart';
|
|
import 'package:unittest/html_config.dart';
|
|
import 'package:async_helper/async_helper.dart';
|
|
|
|
class FileAndDir {
|
|
FileEntry file;
|
|
DirectoryEntry dir;
|
|
FileAndDir(this.file, this.dir);
|
|
}
|
|
|
|
FileSystem fs;
|
|
|
|
main() async {
|
|
useHtmlConfiguration();
|
|
|
|
getFileSystem() async {
|
|
var fileSystem = await window.requestFileSystem(100);
|
|
fs = fileSystem;
|
|
}
|
|
|
|
// Do the boilerplate to get several files and directories created to then
|
|
// test the functions that use those items.
|
|
Future doDirSetup(String testName) async {
|
|
await getFileSystem();
|
|
|
|
var file = await fs.root.createFile('file_$testName');
|
|
var dir = await fs.root.createDirectory('dir_$testName');
|
|
return new Future.value(new FileAndDir(file, dir));
|
|
}
|
|
|
|
if (FileSystem.supported) {
|
|
test('readEntries', () async {
|
|
var fileAndDir = await doDirSetup('readEntries');
|
|
var reader = await fileAndDir.dir.createReader();
|
|
var entries = await reader.readEntries();
|
|
expect(entries is List, true);
|
|
});
|
|
}
|
|
}
|
|
|