Chromium Code Reviews| Index: tests/html/fileapi_test.dart |
| diff --git a/tests/html/fileapi_test.dart b/tests/html/fileapi_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0e1f5eacdebce48bfc2b55417b4bae5202ce9002 |
| --- /dev/null |
| +++ b/tests/html/fileapi_test.dart |
| @@ -0,0 +1,50 @@ |
| +#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', {}, (e) { |
|
Anton Muhin
2012/05/15 18:32:23
this is very hard to read, but luckily starting fr
podivilov
2012/05/16 13:49:25
Done.
|
| + Expect.fail('Should not be reached'); |
| + callbackDone(); |
| + }, (e) { |
| + Expect.equals(FileError.NOT_FOUND_ERR, e.code); |
| + callbackDone(); |
| + }); |
| + |
| + fs.root.getDirectory('directory3', {'create': true}, (e) { |
| + Expect.equals('directory3', e.name); |
| + callbackDone(); |
| + }, (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', {}, (e) { |
| + Expect.fail('Should not be reached'); |
| + callbackDone(); |
| + }, (e) { |
| + Expect.equals(FileError.NOT_FOUND_ERR, e.code); |
| + callbackDone(); |
| + }); |
| + |
| + fs.root.getDirectory('file3', {'create': true}, (e) { |
| + Expect.equals('file3', e.name); |
| + callbackDone(); |
| + }, (e) { |
| + Expect.fail('Got file error: ${e.code}'); |
| + callbackDone(); |
| + }); |
| + }); |
| + }); |
| +} |