| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:async"; | 6 import "dart:async"; |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 import "dart:isolate"; | 8 import "dart:isolate"; |
| 9 | 9 |
| 10 | 10 |
| 11 void testPauseList() { | 11 void testPauseList() { |
| 12 var keepAlive = new ReceivePort(); | 12 var keepAlive = new ReceivePort(); |
| 13 // TOTAL should be bigger the our directory listing buffer. | 13 // TOTAL should be bigger the our directory listing buffer. |
| 14 const int TOTAL = 256; | 14 const int TOTAL = 128; |
| 15 new Directory("").createTemp().then((d) { | 15 new Directory("").createTemp().then((d) { |
| 16 for (int i = 0; i < TOTAL; i++) { | 16 for (int i = 0; i < TOTAL; i++) { |
| 17 new Directory("${d.path}/$i").createSync(); | 17 new Directory("${d.path}/$i").createSync(); |
| 18 new File("${d.path}/$i/file").createSync(); | 18 new File("${d.path}/$i/file").createSync(); |
| 19 } | 19 } |
| 20 bool first = true; | 20 bool first = true; |
| 21 var subscription; | 21 var subscription; |
| 22 int count = 0; | 22 int count = 0; |
| 23 subscription = d.list(recursive: true).listen((file) { | 23 subscription = d.list(recursive: true).listen((file) { |
| 24 if (file is File) { | 24 if (file is File) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 Expect.notEquals(TOTAL, count); | 38 Expect.notEquals(TOTAL, count); |
| 39 Expect.isTrue(count > 0); | 39 Expect.isTrue(count > 0); |
| 40 d.delete(recursive: true).then((ignore) => keepAlive.close()); | 40 d.delete(recursive: true).then((ignore) => keepAlive.close()); |
| 41 }); | 41 }); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void main() { | 45 void main() { |
| 46 testPauseList(); | 46 testPauseList(); |
| 47 } | 47 } |
| OLD | NEW |