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

Side by Side Diff: tests/standalone/src/DirectoryTest.dart

Issue 8386029: Consistently use setters to set event handlers in native APIs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Directory listing test. 5 // Directory listing test.
6 6
7 class DirectoryTest { 7 class DirectoryTest {
8 static void testListing() { 8 static void testListing() {
9 bool listedSomething = false; 9 bool listedSomething = false;
10 Directory directory = new Directory("."); 10 Directory directory = new Directory(".");
11 11
12 directory.setDirHandler((dir) { 12 directory.dirHandler = (dir) {
13 listedSomething = true; 13 listedSomething = true;
14 }); 14 };
15 15
16 directory.setFileHandler((f) { 16 directory.fileHandler = (f) {
17 listedSomething = true; 17 listedSomething = true;
18 }); 18 };
19 19
20 directory.setDoneHandler((completed) { 20 directory.doneHandler = (completed) {
21 Expect.isTrue(completed, "directory listing did not complete"); 21 Expect.isTrue(completed, "directory listing did not complete");
22 Expect.isTrue(listedSomething, "empty directory"); 22 Expect.isTrue(listedSomething, "empty directory");
23 }); 23 };
24 24
25 directory.setErrorHandler((error) { 25 directory.errorHandler = (error) {
26 Expect.fail("error listing directory: $error"); 26 Expect.fail("error listing directory: $error");
27 }); 27 };
28 28
29 directory.list(); 29 directory.list();
30 30
31 // Listing is asynchronous, so nothing should be listed at this 31 // Listing is asynchronous, so nothing should be listed at this
32 // point. 32 // point.
33 Expect.isFalse(listedSomething); 33 Expect.isFalse(listedSomething);
34 } 34 }
35 35
36 static void testExistsCreateDelete() { 36 static void testExistsCreateDelete() {
37 // TODO(ager): This should be creating temporary directories. 37 // TODO(ager): This should be creating temporary directories.
38 Directory d = new Directory("____DIRECTORY_TEST_DIRECTORY____"); 38 Directory d = new Directory("____DIRECTORY_TEST_DIRECTORY____");
39 Expect.isFalse(d.exists()); 39 Expect.isFalse(d.existsSync());
40 d.create(); 40 d.createSync();
41 Expect.isTrue(d.exists()); 41 Expect.isTrue(d.existsSync());
42 d.delete(); 42 d.deleteSync();
43 Expect.isFalse(d.exists()); 43 Expect.isFalse(d.existsSync());
44 } 44 }
45 45
46 static void testMain() { 46 static void testMain() {
47 testListing(); 47 testListing();
48 testExistsCreateDelete(); 48 testExistsCreateDelete();
49 } 49 }
50 } 50 }
51 51
52 main() { 52 main() {
53 DirectoryTest.testMain(); 53 DirectoryTest.testMain();
54 } 54 }
OLDNEW
« no previous file with comments | « tests/standalone/src/DirectoryInvalidArgumentsTest.dart ('k') | tests/standalone/src/EchoServerStreamTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698