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

Side by Side Diff: tests/standalone/src/io/FileOutputStreamTest.dart

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

Powered by Google App Engine
This is Rietveld 408576698