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

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

Issue 10544167: Some unit test fixes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « tests/html/cssstyledeclaration_test.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #library('fileapi'); 1 #library('fileapi');
2 #import('../../lib/unittest/unittest.dart'); 2 #import('../../lib/unittest/unittest.dart');
3 #import('../../lib/unittest/html_config.dart'); 3 #import('../../lib/unittest/html_config.dart');
4 #import('dart:html'); 4 #import('dart:html');
5 5
6 main() { 6 main() {
7 useHtmlConfiguration(); 7 useHtmlConfiguration();
8 window.webkitRequestFileSystem(Window.TEMPORARY, 100, (fs) { 8 window.webkitRequestFileSystem(Window.TEMPORARY, 100, (fs) {
9 // FIXME: add types to callback arguments after migration to wrapperless dar t:html. 9 // FIXME: add types to callback arguments after migration to wrapperless dar t:html.
10 asyncTest('getDirectory', 2, () { 10
11 Expect.throws(() => fs.root.getDirectory('directory1', {'x': true}, (e) {} )); 11 test('getDirectory', () {
12 expect(() => fs.root.getDirectory('directory1', {'x': true}, (e) {}),
13 throws);
12 14
13 fs.root.getDirectory( 15 fs.root.getDirectory(
14 'directory2', 16 'directory2',
15 flags: {}, 17 flags: {},
16 successCallback: (e) { 18 successCallback: expectAsync1((e) {
17 Expect.fail('Should not be reached'); 19 expect(false, 'Should not be reached');
18 callbackDone(); 20 }, count:0),
19 }, 21 errorCallback: expectAsync1((e) {
20 errorCallback: (e) { 22 expect(e.code, equals(FileError.NOT_FOUND_ERR));
21 Expect.equals(FileError.NOT_FOUND_ERR, e.code); 23 }));
22 callbackDone();
23 });
24 24
25 fs.root.getDirectory( 25 fs.root.getDirectory(
26 'directory3', 26 'directory3',
27 flags: {'create': true}, 27 flags: {'create': true},
28 successCallback: (e) { 28 successCallback: expectAsync1((e) {
29 Expect.equals('directory3', e.name); 29 expect(e.name, equals('directory3'));
30 callbackDone(); 30 }),
31 }, 31 errorCallback: expectAsync1((e) {
32 errorCallback: (e) { 32 expect(false, 'Got file error: ${e.code}');
33 Expect.fail('Got file error: ${e.code}'); 33 }, count:0));
34 callbackDone();
35 });
36 }); 34 });
37 35
38 asyncTest('getFile', 2, () { 36 test('getFile', () {
39 Expect.throws(() => fs.root.getFile('file1', {'x': true}, (e) {})); 37 expect(() => fs.root.getFile('file1', {'x': true}, (e) {}), throws);
40 38
41 fs.root.getDirectory( 39 fs.root.getDirectory(
42 'file2', 40 'file2',
43 flags: {}, 41 flags: {},
44 successCallback: (e) { 42 successCallback: expectAsync1((e) {
45 Expect.fail('Should not be reached'); 43 expect(false, 'Should not be reached');
46 callbackDone(); 44 }, count:0),
47 }, 45 errorCallback: expectAsync1((e) {
48 errorCallback: (e) { 46 expect(e.code, equals(FileError.NOT_FOUND_ERR));
49 Expect.equals(FileError.NOT_FOUND_ERR, e.code); 47 }));
50 callbackDone();
51 });
52 48
53 fs.root.getDirectory( 49 fs.root.getDirectory(
54 'file3', 50 'file3',
55 flags: {'create': true}, 51 flags: {'create': true},
56 successCallback: (e) { 52 successCallback: expectAsync1((e) {
57 Expect.equals('file3', e.name); 53 expect(e.name, equals('file3'));
58 callbackDone(); 54 }),
59 }, 55 errorCallback: expectAsync1((e) {
60 errorCallback: (e) { 56 expect(false, 'Got file error: ${e.code}');
61 Expect.fail('Got file error: ${e.code}'); 57 }, count:0));
62 callbackDone();
63 });
64 }); 58 });
65 }); 59 });
66 } 60 }
OLDNEW
« no previous file with comments | « tests/html/cssstyledeclaration_test.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698