Files
sdk/tests/html/fileapi_test.dart
T
vsm@google.com 6129f24038 Revert "Removed asyncTest and improved comments."
This reverts commit r8170 while we figure out dartium breakage.

TBR=gram

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8176 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-31 21:34:23 +00:00

67 lines
1.9 KiB
Dart

#library('fileapi');
#import('../../lib/unittest/unittest.dart');
#import('../../lib/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.
asyncTest('getDirectory', 2, () {
Expect.throws(() => fs.root.getDirectory('directory1', {'x': true}, (e) {}));
fs.root.getDirectory(
'directory2',
flags: {},
successCallback: (e) {
Expect.fail('Should not be reached');
callbackDone();
},
errorCallback: (e) {
Expect.equals(FileError.NOT_FOUND_ERR, e.code);
callbackDone();
});
fs.root.getDirectory(
'directory3',
flags: {'create': true},
successCallback: (e) {
Expect.equals('directory3', e.name);
callbackDone();
},
errorCallback: (e) {
Expect.fail('Got file error: ${e.code}');
callbackDone();
});
});
asyncTest('getFile', 2, () {
Expect.throws(() => fs.root.getFile('file1', {'x': true}, (e) {}));
fs.root.getDirectory(
'file2',
flags: {},
successCallback: (e) {
Expect.fail('Should not be reached');
callbackDone();
},
errorCallback: (e) {
Expect.equals(FileError.NOT_FOUND_ERR, e.code);
callbackDone();
});
fs.root.getDirectory(
'file3',
flags: {'create': true},
successCallback: (e) {
Expect.equals('file3', e.name);
callbackDone();
},
errorCallback: (e) {
Expect.fail('Got file error: ${e.code}');
callbackDone();
});
});
});
}