| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Process test program to test process communication. | 5 // Process test program to test process communication. |
| 6 // | 6 // |
| 7 // VMOptions= | 7 // VMOptions= |
| 8 // VMOptions=--short_socket_read | 8 // VMOptions=--short_socket_read |
| 9 // VMOptions=--short_socket_write | 9 // VMOptions=--short_socket_write |
| 10 // VMOptions=--short_socket_read --short_socket_write | 10 // VMOptions=--short_socket_read --short_socket_write |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 process.start(); | 28 process.start(); |
| 29 | 29 |
| 30 int received = 0; | 30 int received = 0; |
| 31 | 31 |
| 32 void readData() { | 32 void readData() { |
| 33 List<int> buffer = input.read(); | 33 List<int> buffer = input.read(); |
| 34 for (int i = 0; i < buffer.length; i++) { | 34 for (int i = 0; i < buffer.length; i++) { |
| 35 Expect.equals(data[received + i], buffer[i]); | 35 Expect.equals(data[received + i], buffer[i]); |
| 36 } | 36 } |
| 37 received += buffer.length; | 37 received += buffer.length; |
| 38 if (received == BUFFERSIZE) { | |
| 39 process.close(); | |
| 40 } | |
| 41 } | 38 } |
| 42 | 39 |
| 43 void streamClosed() { | 40 void streamClosed() { |
| 44 Expect.equals(BUFFERSIZE, received); | 41 Expect.equals(BUFFERSIZE, received); |
| 42 process.close(); |
| 45 } | 43 } |
| 46 | 44 |
| 47 output.write(data); | 45 output.write(data); |
| 48 output.end(); | 46 output.close(); |
| 49 input.dataHandler = readData; | 47 input.dataHandler = readData; |
| 50 input.closeHandler = streamClosed; | 48 input.closeHandler = streamClosed; |
| 51 } | 49 } |
| 52 | 50 |
| 53 static void testMain() { | 51 static void testMain() { |
| 54 testStdout(); | 52 testStdout(); |
| 55 } | 53 } |
| 56 } | 54 } |
| 57 | 55 |
| 58 main() { | 56 main() { |
| 59 ProcessStdoutTest.testMain(); | 57 ProcessStdoutTest.testStdout(); |
| 60 } | 58 } |
| OLD | NEW |