ef6273cba0
This is a migration of 13 Chrome release about 1.5 years of Chrome releases. Update PYTHON scripts for cleaner and easier rolling. Here's a doc on the changes that might affect Dart users: https://docs.google.com/document/d/1Kj0nk3SueO3JKub8im7z3znu9j5oiI7vf49ejZrMxuE/edit# Change-Id: I768fbd09b04fe6884af36ac102d5813f67bae426 Reviewed-on: https://dart-review.googlesource.com/24501 Commit-Queue: Terry Lucas <terry@google.com> Reviewed-by: Terry Lucas <terry@google.com>
54 lines
1.2 KiB
Dart
54 lines
1.2 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;
|
|
}
|
|
|
|
if (FileSystem.supported) {
|
|
await getFileSystem();
|
|
|
|
test('fileDoesntExist', () async {
|
|
try {
|
|
var fileObj = await fs.root.getFile('file2');
|
|
fail("file found");
|
|
} catch (error) {
|
|
expect(true, error is DomException);
|
|
expect(DomException.NOT_FOUND, error.name);
|
|
}
|
|
});
|
|
|
|
test('fileCreate', () async {
|
|
var fileObj = await fs.root.createFile('file4');
|
|
expect(fileObj.name, equals('file4'));
|
|
expect(fileObj.isFile, isTrue);
|
|
|
|
var metadata = await fileObj.getMetadata();
|
|
var changeTime = metadata.modificationTime;
|
|
|
|
// Increased Windows buildbots can sometimes be particularly slow.
|
|
expect(new DateTime.now().difference(changeTime).inMinutes, lessThan(4));
|
|
expect(metadata.size, equals(0));
|
|
});
|
|
}
|
|
}
|
|
|