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

Side by Side Diff: tests/html/fileapi_test.dart

Issue 11184007: Support new named arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #library('fileapi'); 1 #library('fileapi');
2 #import('../../pkg/unittest/unittest.dart'); 2 #import('../../pkg/unittest/unittest.dart');
3 #import('../../pkg/unittest/html_config.dart'); 3 #import('../../pkg/unittest/html_config.dart');
4 #import('dart:html'); 4 #import('dart:html');
5 5
6 void fail(message) { 6 void fail(message) {
7 guardAsync(() { 7 guardAsync(() {
8 Expect.fail(message); 8 Expect.fail(message);
9 }); 9 });
10 } 10 }
11 11
12 DOMFileSystem fs; 12 DOMFileSystem fs;
13 13
14 main() { 14 main() {
15 useHtmlConfiguration(); 15 useHtmlConfiguration();
16 test('getFileSystem', () { 16 test('getFileSystem', () {
17 window.webkitRequestFileSystem(LocalWindow.TEMPORARY, 100, expectAsync1( 17 window.webkitRequestFileSystem(LocalWindow.TEMPORARY, 100, expectAsync1(
18 (DOMFileSystem fileSystem) { 18 (DOMFileSystem fileSystem) {
19 fs = fileSystem; 19 fs = fileSystem;
20 }), 20 }),
21 (e) { 21 (e) {
22 fail('Got file error: ${e.code}'); 22 fail('Got file error: ${e.code}');
23 }); 23 });
24 }); 24 });
25 group('getDirectory', () { 25 group('getDirectory', () {
26 26
27 test('directoryDoesntExist', () { 27 test('directoryDoesntExist', () {
28 /* OPTIONALS
28 fs.root.getDirectory( 29 fs.root.getDirectory(
29 'directory2', 30 'directory2',
30 options: {}, 31 options: {},
31 successCallback: (e) { 32 successCallback: (e) {
32 fail('Should not be reached'); 33 fail('Should not be reached');
33 }, 34 },
34 errorCallback: expectAsync1((FileError e) { 35 errorCallback: expectAsync1((FileError e) {
35 expect(e.code, equals(FileError.NOT_FOUND_ERR)); 36 expect(e.code, equals(FileError.NOT_FOUND_ERR));
36 })); 37 }));
38 */
39 fs.root.getDirectory(
40 'directory2',
41 {},
42 (e) {
43 fail('Should not be reached');
44 },
45 expectAsync1((FileError e) {
46 expect(e.code, equals(FileError.NOT_FOUND_ERR));
47 }));
37 }); 48 });
38 49
39 test('directoryCreate', () { 50 test('directoryCreate', () {
51 /* OPTIONALS
40 fs.root.getDirectory( 52 fs.root.getDirectory(
41 'directory3', 53 'directory3',
42 options: {'create': true}, 54 options: {'create': true},
43 successCallback: expectAsync1((DirectoryEntry e) { 55 successCallback: expectAsync1((DirectoryEntry e) {
44 expect(e.name, equals('directory3')); 56 expect(e.name, equals('directory3'));
45 }), 57 }),
46 errorCallback: (e) { 58 errorCallback: (e) {
47 fail('Got file error: ${e.code}'); 59 fail('Got file error: ${e.code}');
48 }); 60 });
61 */
62 fs.root.getDirectory(
63 'directory3',
64 {'create': true},
65 expectAsync1((DirectoryEntry e) {
66 expect(e.name, equals('directory3'));
67 }),
68 (e) {
69 fail('Got file error: ${e.code}');
70 });
49 }); 71 });
50 }); 72 });
51 73
52 group('getFile', () { 74 group('getFile', () {
53 75
54 test('fileDoesntExist', () { 76 test('fileDoesntExist', () {
77 /* OPTIONALS
55 fs.root.getFile( 78 fs.root.getFile(
56 'file2', 79 'file2',
57 options: {}, 80 options: {},
58 successCallback: (e) { 81 successCallback: (e) {
59 fail('Should not be reached'); 82 fail('Should not be reached');
60 }, 83 },
61 errorCallback: expectAsync1((FileError e) { 84 errorCallback: expectAsync1((FileError e) {
62 expect(e.code, equals(FileError.NOT_FOUND_ERR)); 85 expect(e.code, equals(FileError.NOT_FOUND_ERR));
63 })); 86 }));
87 */
88 fs.root.getFile(
89 'file2',
90 {},
91 (e) {
92 fail('Should not be reached');
93 },
94 expectAsync1((FileError e) {
95 expect(e.code, equals(FileError.NOT_FOUND_ERR));
96 }));
64 }); 97 });
65 98
66 test('fileCreate', () { 99 test('fileCreate', () {
100 /* OPTIONALS
67 fs.root.getFile( 101 fs.root.getFile(
68 'file4', 102 'file4',
69 options: {'create': true}, 103 options: {'create': true},
70 successCallback: expectAsync1((FileEntry e) { 104 successCallback: expectAsync1((FileEntry e) {
71 expect(e.name, equals('file4')); 105 expect(e.name, equals('file4'));
72 expect(e.isFile, equals(true)); 106 expect(e.isFile, equals(true));
73 }), 107 }),
74 errorCallback: (e) { 108 errorCallback: (e) {
75 fail('Got file error: ${e.code}'); 109 fail('Got file error: ${e.code}');
76 }); 110 });
77 }); 111 });
112 */
113 fs.root.getFile(
114 'file4',
115 {'create': true},
116 expectAsync1((FileEntry e) {
117 expect(e.name, equals('file4'));
118 expect(e.isFile, equals(true));
119 }),
120 (e) {
121 fail('Got file error: ${e.code}');
122 });
123 });
78 }); 124 });
79 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698