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