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

Unified Diff: tests/standalone/io/directory_list_pause_test.dart

Issue 16825003: Use directories with content, to avoid very large folder and flakyness. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 178f59f45e7e052768617634235e715f1e14e421..74779abf676412b10a77b787664cff699c9e028e 100644
--- a/tests/standalone/io/directory_list_pause_test.dart
+++ b/tests/standalone/io/directory_list_pause_test.dart
@@ -10,31 +10,35 @@ import "dart:isolate";
void testPauseList() {
var keepAlive = new ReceivePort();
+ // TOTAL should be bigger the our directory listing buffer.
+ const int TOTAL = 128;
new Directory("").createTemp().then((d) {
- // Linux reads 2K at a time, so be sure to be >>.
- int total = 4 * 1024 + 1;
- for (int i = 0; i < total; i++) {
- new File("${d.path}/$i").createSync();
+ for (int i = 0; i < TOTAL; i++) {
+ new Directory("${d.path}/$i").createSync();
+ new File("${d.path}/$i/file").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();
- });
+ subscription = d.list(recursive: true).listen((file) {
+ if (file is File) {
+ if (first) {
+ first = false;
+ subscription.pause();
+ Timer.run(() {
+ for (int i = 0; i < TOTAL; i++) {
+ new File("${d.path}/$i/file").deleteSync();
+ }
+ subscription.resume();
+ });
+ }
+ count++;
}
- count++;
}, onDone: () {
- Expect.notEquals(total, count);
+ Expect.notEquals(TOTAL, count);
+ Expect.isTrue(count > 0);
keepAlive.close();
- d.delete().then((ignore) => keepAlive.close());
+ d.delete(recursive: true).then((ignore) => keepAlive.close());
});
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698