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

Side by Side Diff: tests/standalone/io/directory_list_pause_test.dart

Issue 17232003: Increase number of files created, to avoid flakyness on linux. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 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 new Directory("").createTemp().then((d) { 13 new Directory("").createTemp().then((d) {
14 // Linux reads 2K at a time. 14 // Linux reads 2K at a time, so be sure to be >>.
15 int total = 2 * 1024 + 1; 15 int total = 4 * 1024 + 1;
16 for (int i = 0; i < total; i++) { 16 for (int i = 0; i < total; i++) {
17 new File("${d.path}/$i").createSync(); 17 new File("${d.path}/$i").createSync();
18 } 18 }
19 bool first = true; 19 bool first = true;
20 var subscription; 20 var subscription;
21 int count = 0; 21 int count = 0;
22 subscription = d.list().listen((file) { 22 subscription = d.list().listen((file) {
23 if (first) { 23 if (first) {
24 first = false; 24 first = false;
25 subscription.pause(); 25 subscription.pause();
26 Timer.run(() { 26 Timer.run(() {
27 for (int i = 0; i < total; i++) { 27 for (int i = 0; i < total; i++) {
28 new File("${d.path}/$i").deleteSync(); 28 new File("${d.path}/$i").deleteSync();
29 } 29 }
30 subscription.resume(); 30 subscription.resume();
31 }); 31 });
32 } 32 }
33 count++; 33 count++;
34 }, onDone: () { 34 }, onDone: () {
35 Expect.isTrue(count < total); 35 Expect.notEquals(total, count);
36 keepAlive.close(); 36 keepAlive.close();
37 d.delete().then((ignore) => keepAlive.close()); 37 d.delete().then((ignore) => keepAlive.close());
38 }); 38 });
39 }); 39 });
40 } 40 }
41 41
42 void main() { 42 void main() {
43 testPauseList(); 43 testPauseList();
44 } 44 }
OLDNEW
« 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