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

Side by Side Diff: tests/standalone/src/StreamPipeTest.dart

Issue 9474004: Make FileInputStream and FileOutputStream actually asynchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove accidental edit Created 8 years, 9 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 // 4 //
5 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 9
10 #library("StreamPipeTest"); 10 #library("StreamPipeTest");
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 var tempDir = new Directory(''); 191 var tempDir = new Directory('');
192 tempDir.createTempSync(); 192 tempDir.createTempSync();
193 var dstFileName = tempDir.path + "/readline_test1.dat"; 193 var dstFileName = tempDir.path + "/readline_test1.dat";
194 var dstFile = new File(dstFileName); 194 var dstFile = new File(dstFileName);
195 dstFile.createSync(); 195 dstFile.createSync();
196 var dstStream = dstFile.openOutputStreamSync(); 196 var dstStream = dstFile.openOutputStreamSync();
197 197
198 srcStream.closeHandler = () { 198 srcStream.closeHandler = () {
199 dstStream.write([32]); 199 dstStream.write([32]);
200 dstStream.close(); 200 dstStream.close();
201 var src = srcFile.openSync(); 201 dstStream.closeHandler = () {
202 var dst = dstFile.openSync(); 202 var src = srcFile.openSync();
203 var srcLength = src.lengthSync(); 203 var dst = dstFile.openSync();
204 var dstLength = dst.lengthSync(); 204 var srcLength = src.lengthSync();
205 Expect.equals(srcLength + 1, dstLength); 205 var dstLength = dst.lengthSync();
206 Expect.isTrue(compareFileContent(srcFileName, 206 Expect.equals(srcLength + 1, dstLength);
207 dstFileName, 207 Expect.isTrue(compareFileContent(srcFileName,
208 count: srcLength)); 208 dstFileName,
209 dst.setPositionSync(srcLength); 209 count: srcLength));
210 var data = new List<int>(1); 210 dst.setPositionSync(srcLength);
211 var read2 = dst.readListSync(data, 0, 1); 211 var data = new List<int>(1);
212 Expect.equals(32, data[0]); 212 var read2 = dst.readListSync(data, 0, 1);
213 src.closeSync(); 213 Expect.equals(32, data[0]);
214 dst.closeSync(); 214 src.closeSync();
215 dstFile.deleteSync(); 215 dst.closeSync();
216 tempDir.deleteSync(); 216 dstFile.deleteSync();
217 tempDir.deleteSync();
218 };
217 }; 219 };
218 220
219 srcStream.pipe(dstStream, close: false); 221 srcStream.pipe(dstStream, close: false);
220 } 222 }
221 223
222 224
223 // Test piping two copies of one file to another. 225 // Test piping two copies of one file to another.
224 testFileToFilePipe3() { 226 testFileToFilePipe3() {
225 String srcFileName = 227 String srcFileName =
226 getDataFilename("tests/standalone/src/readline_test1.dat"); 228 getDataFilename("tests/standalone/src/readline_test1.dat");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 srcStream.pipe(dstStream, close: false); 265 srcStream.pipe(dstStream, close: false);
264 } 266 }
265 267
266 268
267 main() { 269 main() {
268 testFileToFilePipe1(); 270 testFileToFilePipe1();
269 testFileToFilePipe2(); 271 testFileToFilePipe2();
270 testFileToFilePipe3(); 272 testFileToFilePipe3();
271 PipeServerGame echoServerGame = new PipeServerGame.start(); 273 PipeServerGame echoServerGame = new PipeServerGame.start();
272 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698