| Index: tests/standalone/io/directory_list_pause_test.dart
|
| diff --git a/tests/standalone/io/directory_list_pause_test.dart b/tests/standalone/io/directory_list_pause_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..86ff1566d87a6979dbc1b0fb6c46840853505674
|
| --- /dev/null
|
| +++ b/tests/standalone/io/directory_list_pause_test.dart
|
| @@ -0,0 +1,44 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +import "package:expect/expect.dart";
|
| +import "dart:async";
|
| +import "dart:io";
|
| +import "dart:isolate";
|
| +
|
| +
|
| +void testPauseList() {
|
| + var keepAlive = new ReceivePort();
|
| + new Directory("").createTemp().then((d) {
|
| + // Linux reads 2K at a time.
|
| + int total = 2 * 1024 + 1;
|
| + for (int i = 0; i < total; i++) {
|
| + new File("${d.path}/$i").createSync();
|
| + }
|
| + bool first = true;
|
| + var subscription;
|
| + int count = 0;
|
| + subscription = d.list().listen((file) {
|
| + if (first) {
|
| + first = false;
|
| + subscription.pause();
|
| + Timer.run(() {
|
| + for (int i = 0; i < total; i++) {
|
| + new File("${d.path}/$i").deleteSync();
|
| + }
|
| + subscription.resume();
|
| + });
|
| + }
|
| + count++;
|
| + }, onDone: () {
|
| + Expect.isTrue(count < total);
|
| + keepAlive.close();
|
| + d.delete().then((ignore) => keepAlive.close());
|
| + });
|
| + });
|
| +}
|
| +
|
| +void main() {
|
| + testPauseList();
|
| +}
|
|
|