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; Future 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); }); }