| OLD | NEW |
| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 tempDir.createTempSync(); | 90 tempDir.createTempSync(); |
| 91 var dstFileName = tempDir.path + "/readline_test1.dat"; | 91 var dstFileName = tempDir.path + "/readline_test1.dat"; |
| 92 var dstFile = new File(dstFileName); | 92 var dstFile = new File(dstFileName); |
| 93 dstFile.createSync(); | 93 dstFile.createSync(); |
| 94 var fileOutput = dstFile.openOutputStreamSync(); | 94 var fileOutput = dstFile.openOutputStreamSync(); |
| 95 | 95 |
| 96 socketInput.closeHandler = () { | 96 socketInput.closeHandler = () { |
| 97 // Check that the resulting file is equal to the initial | 97 // Check that the resulting file is equal to the initial |
| 98 // file. | 98 // file. |
| 99 bool result = compareFileContent(srcFileName, dstFileName); | 99 bool result = compareFileContent(srcFileName, dstFileName); |
| 100 new File(dstFileName).deleteSync(); | 100 fileOutput.closeHandler = () { |
| 101 tempDir.deleteSync(); | 101 new File(dstFileName).deleteSync(); |
| 102 Expect.isTrue(result); | 102 tempDir.deleteSync(); |
| 103 Expect.isTrue(result); |
| 103 | 104 |
| 104 _socket.close(); | 105 _socket.close(); |
| 105 | 106 |
| 106 // Run this twice. | 107 // Run this twice. |
| 107 if (count++ < 2) { | 108 if (count++ < 2) { |
| 108 runTest(); | 109 runTest(); |
| 109 } else { | 110 } else { |
| 110 shutdown(); | 111 shutdown(); |
| 111 } | 112 } |
| 113 }; |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 socketInput.pipe(fileOutput); | 116 socketInput.pipe(fileOutput); |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 fileInput.pipe(socketOutput); | 119 fileInput.pipe(socketOutput); |
| 118 } | 120 } |
| 119 | 121 |
| 120 // Connect to the server. | 122 // Connect to the server. |
| 121 _socket = new Socket(TestingServer.HOST, _port); | 123 _socket = new Socket(TestingServer.HOST, _port); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 srcStream.pipe(dstStream, close: false); | 286 srcStream.pipe(dstStream, close: false); |
| 285 } | 287 } |
| 286 | 288 |
| 287 | 289 |
| 288 main() { | 290 main() { |
| 289 testFileToFilePipe1(); | 291 testFileToFilePipe1(); |
| 290 testFileToFilePipe2(); | 292 testFileToFilePipe2(); |
| 291 testFileToFilePipe3(); | 293 testFileToFilePipe3(); |
| 292 PipeServerGame echoServerGame = new PipeServerGame.start(); | 294 PipeServerGame echoServerGame = new PipeServerGame.start(); |
| 293 } | 295 } |
| OLD | NEW |