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

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

Issue 51883004: Let the stream of File:openRead handle cancel correctly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « sdk/lib/io/file_impl.dart ('k') | tests/standalone/io/file_stream_test.dart » ('j') | 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 "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
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 void testListIsEmpty() { 76 void testListIsEmpty() {
77 asyncStart(); 77 asyncStart();
78 // TOTAL should be bigger the our directory listing buffer. 78 // TOTAL should be bigger the our directory listing buffer.
79 const int TOTAL = 128; 79 const int TOTAL = 128;
80 Directory.systemTemp.createTemp('dart_directory_list_pause').then((d) { 80 Directory.systemTemp.createTemp('dart_directory_list_pause').then((d) {
81 for (int i = 0; i < TOTAL; i++) { 81 for (int i = 0; i < TOTAL; i++) {
82 new Directory("${d.path}/$i").createSync(); 82 new Directory("${d.path}/$i").createSync();
83 new File("${d.path}/$i/file").createSync(); 83 new File("${d.path}/$i/file").createSync();
84 } 84 }
85 // isEmpty will cancel the stream after first data event.
85 d.list(recursive: true).isEmpty.then((empty) { 86 d.list(recursive: true).isEmpty.then((empty) {
86 Expect.isFalse(empty); 87 Expect.isFalse(empty);
87 d.deleteSync(recursive: true); 88 d.deleteSync(recursive: true);
88 asyncEnd(); 89 asyncEnd();
89 }); 90 });
90 }); 91 });
91 } 92 }
92 93
93 void main() { 94 void main() {
94 testPauseList(); 95 testPauseList();
95 testPauseResumeCancelList(); 96 testPauseResumeCancelList();
96 testListIsEmpty(); 97 testListIsEmpty();
97 } 98 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | tests/standalone/io/file_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698