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

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

Issue 10832188: Add an OutputStream.closed getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 8 years, 4 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 | « tests/standalone/io/file_output_stream_test.dart ('k') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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:io"); 5 #import("dart:io");
6 #import("dart:isolate"); 6 #import("dart:isolate");
7 7
8 void testEmptyListOutputStream1() { 8 void testEmptyListOutputStream1() {
9 ListOutputStream stream = new ListOutputStream(); 9 ListOutputStream stream = new ListOutputStream();
10 Expect.equals(null, stream.read()); 10 Expect.equals(null, stream.read());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 new Timer(0, (_) { 132 new Timer(0, (_) {
133 result.add(3); 133 result.add(3);
134 stream.write([4]); 134 stream.write([4]);
135 stream.close(); 135 stream.close();
136 }); 136 });
137 }); 137 });
138 138
139 donePort.receive((x,y) => donePort.close()); 139 donePort.receive((x,y) => donePort.close());
140 } 140 }
141 141
142 void testListOutputStream5() {
143 ListOutputStream stream = new ListOutputStream();
144 ReceivePort donePort = new ReceivePort();
145
146 stream.onClosed = () {
147 Expect.isTrue(stream.closed);
148 var contents = stream.read();
149 Expect.equals(3, contents.length);
150 for (var i = 0; i < contents.length; i++) Expect.equals(i + 1, contents[i]);
151 donePort.toSendPort().send(null);
152 };
153
154 Expect.isFalse(stream.closed);
155 stream.write([1, 2, 3]);
156 Expect.isFalse(stream.closed);
157 stream.close();
158 Expect.isTrue(stream.closed);
159 Expect.throws(() => stream.write([4, 5, 6]));
160
161 donePort.receive((x,y) => donePort.close());
162 }
163
142 main() { 164 main() {
143 testEmptyListOutputStream1(); 165 testEmptyListOutputStream1();
144 testEmptyListOutputStream2(); 166 testEmptyListOutputStream2();
145 testListOutputStream1(); 167 testListOutputStream1();
146 testListOutputStream2(); 168 testListOutputStream2();
147 testListOutputStream3(); 169 testListOutputStream3();
148 testListOutputStream4(); 170 testListOutputStream4();
171 testListOutputStream5();
149 } 172 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_output_stream_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698