Files
sdk/tests/html/fileapi_test.dart
T
antonm@google.com 39dacd1f90 Fix fileapi_test.dart.
Now options are named options, not flags.

R=podivilov@chromium.org,sra@google.com

Review URL: https://chromiumcodereview.appspot.com//10824374

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10958 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 13:35:34 +00:00

61 lines
1.8 KiB
Dart

#library('fileapi');
#import('../../pkg/unittest/unittest.dart');
#import('../../pkg/unittest/html_config.dart');
#import('dart:html');
main() {
useHtmlConfiguration();
window.webkitRequestFileSystem(Window.TEMPORARY, 100, (fs) {
// FIXME: add types to callback arguments after migration to wrapperless dart:html.
test('getDirectory', () {
expect(() => fs.root.getDirectory('directory1', {'x': true}, (e) {}),
throws);
fs.root.getDirectory(
'directory2',
options: {},
successCallback: expectAsync1((e) {
expect(false, 'Should not be reached');
}, count:0),
errorCallback: expectAsync1((e) {
expect(e.code, equals(FileError.NOT_FOUND_ERR));
}));
fs.root.getDirectory(
'directory3',
options: {'create': true},
successCallback: expectAsync1((e) {
expect(e.name, equals('directory3'));
}),
errorCallback: expectAsync1((e) {
expect(false, 'Got file error: ${e.code}');
}, count:0));
});
test('getFile', () {
expect(() => fs.root.getFile('file1', {'x': true}, (e) {}), throws);
fs.root.getDirectory(
'file2',
options: {},
successCallback: expectAsync1((e) {
expect(false, 'Should not be reached');
}, count:0),
errorCallback: expectAsync1((e) {
expect(e.code, equals(FileError.NOT_FOUND_ERR));
}));
fs.root.getDirectory(
'file3',
options: {'create': true},
successCallback: expectAsync1((e) {
expect(e.name, equals('file3'));
}),
errorCallback: expectAsync1((e) {
expect(false, 'Got file error: ${e.code}');
}, count:0));
});
});
}