b101a7d002
Change-Id: Ib33169c3e0ffc870915c189404074a1dea472546 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196548 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Leaf Petersen <leafp@google.com>
42 lines
864 B
Dart
42 lines
864 B
Dart
|
|
// @dart = 2.9
|
|
library fileapi;
|
|
|
|
import 'dart:async';
|
|
import 'dart:html';
|
|
|
|
import 'package:async_helper/async_helper.dart';
|
|
import 'package:async_helper/async_minitest.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() {
|
|
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);
|
|
});
|
|
}
|
|
|