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

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

Issue 8244001: Clean up directory listing interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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
« runtime/bin/directory.dart ('K') | « runtime/bin/directory_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.open("."); 10 Directory directory = new Directory(".");
11 11
12 directory.setDirHandler((dir) { 12 directory.setDirHandler((dir) {
13 listedSomething = true; 13 listedSomething = true;
14 }); 14 });
15 15
16 directory.setFileHandler((f) { 16 directory.setFileHandler((f) {
17 listedSomething = true; 17 listedSomething = true;
18 }); 18 });
19 19
20 directory.setDoneHandler((completed) { 20 directory.setDoneHandler((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 directory.close();
24 }); 23 });
25 24
26 directory.setDirErrorHandler((dir) { 25 directory.setErrorHandler((error) {
27 Expect.fail("error listing directory"); 26 Expect.fail("error listing directory: $error");
28 }); 27 });
29 28
30 directory.list(); 29 directory.list();
31 30
32 // Listing is asynchronous, so nothing should be listed at this 31 // Listing is asynchronous, so nothing should be listed at this
33 // point. 32 // point.
34 Expect.isFalse(listedSomething); 33 Expect.isFalse(listedSomething);
35 } 34 }
36 35
37 static void testMain() { 36 static void testMain() {
38 testListing(); 37 testListing();
39 } 38 }
40 } 39 }
41 40
42 main() { 41 main() {
43 DirectoryTest.testMain(); 42 DirectoryTest.testMain();
44 } 43 }
OLDNEW
« runtime/bin/directory.dart ('K') | « runtime/bin/directory_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698