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

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

Issue 9969202: Add method flush to output stream (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r8419 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/socket_stream_impl.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 // Testing file input stream, VM-only, standalone test. 4 // Testing file input stream, VM-only, standalone test.
5 5
6 #import("dart:io"); 6 #import("dart:io");
7 #import("dart:isolate"); 7 #import("dart:isolate");
8 8
9 void testOpenOutputStreamSync() { 9 void testOpenOutputStreamSync() {
10 Directory tempDirectory = new Directory('').createTempSync(); 10 Directory tempDirectory = new Directory('').createTempSync();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 openedFile.closeSync(); 62 openedFile.closeSync();
63 fileSync.deleteSync(); 63 fileSync.deleteSync();
64 done.toSendPort().send("done"); 64 done.toSendPort().send("done");
65 }; 65 };
66 }; 66 };
67 }); 67 });
68 }); 68 });
69 } 69 }
70 70
71 71
72 void testOutputStreamFlush() {
73 Directory tempDirectory = new Directory('').createTempSync();
74
75 // Create a port for waiting on the final result of this test.
76 ReceivePort done = new ReceivePort();
77 done.receive((message, replyTo) {
78 tempDirectory.deleteSync();
79 done.close();
80 });
81
82 tempDirectory.createTempSync();
83 String fileName = "${tempDirectory.path}/test";
84 File file = new File(fileName);
85 file.createSync();
86 OutputStream x = file.openOutputStream();
87 x.write([65, 66, 67]);
88 x.flush();
89 x.write([68, 69, 70]);
90 x.flush();
91 x.write([71, 72, 73]);
92 x.onClosed = () {
93 file.deleteSync();
94 done.toSendPort().send("done");
95 };
96 x.close();
97 x.onError = (e) => Expect.fail("No error expected");
98 }
99
72 main() { 100 main() {
73 testOpenOutputStreamSync(); 101 testOpenOutputStreamSync();
74 testOutputStreamNoPendingWrite(); 102 testOutputStreamNoPendingWrite();
103 testOutputStreamFlush();
75 } 104 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_stream_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698