Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: tests/html/fileapi_test.dart

Issue 10886017: Fixing up file API tests to run (or fail) appropriately. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixing bad merge. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/fileapi_test.dart
diff --git a/tests/html/fileapi_test.dart b/tests/html/fileapi_test.dart
index 6b85308493fee4975d8bf7d0a5fc5b176d3d12ed..2eeeee02b87cfcc7e6d1113ab2b15b282742a356 100644
--- a/tests/html/fileapi_test.dart
+++ b/tests/html/fileapi_test.dart
@@ -3,58 +3,77 @@
#import('../../pkg/unittest/html_config.dart');
#import('dart:html');
+void fail(message) {
+ guardAsync(() {
+ Expect.fail(message);
+ });
+}
+
+DOMFileSystem fs;
+
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);
+ test('getFileSystem', () {
+ window.webkitRequestFileSystem(Window.TEMPORARY, 100, expectAsync1(
+ (DOMFileSystem fileSystem) {
+ fs = fileSystem;
+ }),
+ (e) {
+ fail('Got file error: ${e.code}');
+ });
+ });
+ group('getDirectory', () {
+ test('directoryDoesntExist', () {
fs.root.getDirectory(
'directory2',
options: {},
- successCallback: expectAsync1((e) {
- expect(false, 'Should not be reached');
- }, count:0),
- errorCallback: expectAsync1((e) {
+ successCallback: (e) {
+ fail('Should not be reached');
+ },
+ errorCallback: expectAsync1((FileError e) {
expect(e.code, equals(FileError.NOT_FOUND_ERR));
}));
+ });
+ test('directoryCreate', () {
fs.root.getDirectory(
'directory3',
options: {'create': true},
- successCallback: expectAsync1((e) {
+ successCallback: expectAsync1((DirectoryEntry e) {
expect(e.name, equals('directory3'));
}),
- errorCallback: expectAsync1((e) {
- expect(false, 'Got file error: ${e.code}');
- }, count:0));
+ errorCallback: (e) {
+ fail('Got file error: ${e.code}');
+ });
});
+ });
- test('getFile', () {
- expect(() => fs.root.getFile('file1', {'x': true}, (e) {}), throws);
+ group('getFile', () {
- fs.root.getDirectory(
+ test('fileDoesntExist', () {
+ fs.root.getFile(
'file2',
options: {},
- successCallback: expectAsync1((e) {
- expect(false, 'Should not be reached');
- }, count:0),
- errorCallback: expectAsync1((e) {
+ successCallback: (e) {
+ fail('Should not be reached');
+ },
+ errorCallback: expectAsync1((FileError e) {
expect(e.code, equals(FileError.NOT_FOUND_ERR));
}));
+ });
- fs.root.getDirectory(
- 'file3',
+ test('fileCreate', () {
+ fs.root.getFile(
+ 'file4',
options: {'create': true},
- successCallback: expectAsync1((e) {
- expect(e.name, equals('file3'));
+ successCallback: expectAsync1((FileEntry e) {
+ expect(e.name, equals('file4'));
+ expect(e.isFile, equals(true));
}),
- errorCallback: expectAsync1((e) {
- expect(false, 'Got file error: ${e.code}');
- }, count:0));
- });
+ errorCallback: (e) {
+ fail('Got file error: ${e.code}');
+ });
+ });
});
}
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698