| 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 #import("dart:io"); | 10 #import("dart:io"); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 SendPort _sendPort; | 145 SendPort _sendPort; |
| 146 Socket _socket; | 146 Socket _socket; |
| 147 int _messages; | 147 int _messages; |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 // The testing server will simply pipe each connecting sockets input | 151 // The testing server will simply pipe each connecting sockets input |
| 152 // stream to its output stream. | 152 // stream to its output stream. |
| 153 class PipeServer extends TestingServer { | 153 class PipeServer extends TestingServer { |
| 154 void onConnection(Socket connection) { | 154 void onConnection(Socket connection) { |
| 155 connection.onError = () { Expect.fail("Socket error"); }; | 155 connection.onError = (Exception e) { Expect.fail("Socket error $e"); }; |
| 156 connection.inputStream.pipe(connection.outputStream); | 156 connection.inputStream.pipe(connection.outputStream); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 | 160 |
| 161 // Test piping from one file to another and closing both streams | 161 // Test piping from one file to another and closing both streams |
| 162 // after wards. | 162 // after wards. |
| 163 testFileToFilePipe1() { | 163 testFileToFilePipe1() { |
| 164 // Force test to timeout if one of the handlers is | 164 // Force test to timeout if one of the handlers is |
| 165 // not called. | 165 // not called. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 srcStream.pipe(dstStream, close: false); | 285 srcStream.pipe(dstStream, close: false); |
| 286 } | 286 } |
| 287 | 287 |
| 288 | 288 |
| 289 main() { | 289 main() { |
| 290 testFileToFilePipe1(); | 290 testFileToFilePipe1(); |
| 291 testFileToFilePipe2(); | 291 testFileToFilePipe2(); |
| 292 testFileToFilePipe3(); | 292 testFileToFilePipe3(); |
| 293 PipeServerGame echoServerGame = new PipeServerGame.start(); | 293 PipeServerGame echoServerGame = new PipeServerGame.start(); |
| 294 } | 294 } |
| OLD | NEW |