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

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

Issue 10536168: Close a _FileInputStream only immediately before onClosed is called, so .closed returns false befor… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix extra line break. Created 8 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 | « runtime/bin/stream_util.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 // Dart test program for testing file I/O. 5 // Dart test program for testing file I/O.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("dart:isolate"); 8 #import("dart:isolate");
9 9
10 class MyListOfOneElement implements List { 10 class MyListOfOneElement implements List {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 bytesRead = input.readInto(inputBuffer, offset: position, 219 bytesRead = input.readInto(inputBuffer, offset: position,
220 len: inputBuffer.length - position); 220 len: inputBuffer.length - position);
221 position += bytesRead; 221 position += bytesRead;
222 // The buffer is large enough to hold all available data. 222 // The buffer is large enough to hold all available data.
223 // So there should be no data left to read. 223 // So there should be no data left to read.
224 Expect.equals(0, input.available()); 224 Expect.equals(0, input.available());
225 bytesRead = input.readInto(inputBuffer, offset: position, 225 bytesRead = input.readInto(inputBuffer, offset: position,
226 len: expectedLength - position); 226 len: expectedLength - position);
227 Expect.equals(0, bytesRead); 227 Expect.equals(0, bytesRead);
228 Expect.equals(0, input.available()); 228 Expect.equals(0, input.available());
229 Expect.isFalse(input.closed);
229 }; 230 };
230 input.onClosed = () { 231 input.onClosed = () {
231 Expect.equals(0, input.available()); 232 Expect.equals(0, input.available());
232 Expect.isTrue(input.closed); 233 Expect.isTrue(input.closed);
233 input.close(); // This should be safe to call. 234 input.close(); // This should be safe to call.
234 235
235 Expect.equals(expectedLength, position); 236 Expect.equals(expectedLength, position);
236 for (int i = 0; i < position; ++i) { 237 for (int i = 0; i < position; ++i) {
237 Expect.equals(buffer[i % buffer.length], inputBuffer[i]); 238 Expect.equals(buffer[i % buffer.length], inputBuffer[i]);
238 } 239 }
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 testWriteVariousLists(); 1217 testWriteVariousLists();
1217 testDirectory(); 1218 testDirectory();
1218 testDirectorySync(); 1219 testDirectorySync();
1219 }); 1220 });
1220 } 1221 }
1221 } 1222 }
1222 1223
1223 main() { 1224 main() {
1224 FileTest.testMain(); 1225 FileTest.testMain();
1225 } 1226 }
OLDNEW
« no previous file with comments | « runtime/bin/stream_util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698