529add3834
R=vsm@google.com Change-Id: I27ede73ac84a72ee9b5e8b3b0a706ade82b2aa59 Reviewed-on: https://dart-review.googlesource.com/25500 Commit-Queue: Terry Lucas <terry@google.com> Reviewed-by: Vijay Menon <vsm@google.com>
43 lines
909 B
Dart
43 lines
909 B
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';
|
|
|
|
|
|
Future<FileSystem> _fileSystem;
|
|
|
|
Future<FileSystem> get fileSystem async {
|
|
if (_fileSystem != null) return _fileSystem;
|
|
|
|
_fileSystem = window.requestFileSystem(100);
|
|
|
|
var fs = await _fileSystem;
|
|
expect(fs != null, true);
|
|
expect(fs.root != null, true);
|
|
expect(fs.runtimeType, FileSystem);
|
|
expect(fs.root.runtimeType, DirectoryEntry);
|
|
|
|
return _fileSystem;
|
|
}
|
|
|
|
main() {
|
|
useHtmlConfiguration();
|
|
|
|
test('supported', () {
|
|
expect(FileSystem.supported, true);
|
|
});
|
|
|
|
test('requestFileSystem', () async {
|
|
var expectation = FileSystem.supported ? returnsNormally : throws;
|
|
expect(() async {
|
|
var fs = await fileSystem;
|
|
expect(fs.root != null, true);
|
|
}, expectation);
|
|
});
|
|
}
|
|
|