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

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

Issue 8413034: New OutputStream interface (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 9 years, 1 month 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
« no previous file with comments | « tests/standalone/src/FileTest.dart ('k') | tests/standalone/src/ProcessStdoutTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 data[i] = STARTCHAR + i; 21 data[i] = STARTCHAR + i;
22 } 22 }
23 data[BUFFERSIZE - 1] = 10; 23 data[BUFFERSIZE - 1] = 10;
24 24
25 InputStream input = process.stderr; 25 InputStream input = process.stderr;
26 OutputStream output = process.stdin; 26 OutputStream output = process.stdin;
27 27
28 process.start(); 28 process.start();
29 29
30 int received = 0; 30 int received = 0;
31 31 void readData() {
32 void dataWritten() { 32 List<int> buffer = input.read();
33 void readData() { 33 for (int i = 0; i < buffer.length; i++) {
34 List<int> buffer = input.read(); 34 Expect.equals(data[received + i], buffer[i]);
35 for (int i = 0; i < buffer.length; i++) {
36 Expect.equals(data[received + i], buffer[i]);
37 }
38 received += buffer.length;
39 if (received == BUFFERSIZE) {
40 process.close();
41 }
42 } 35 }
43 36 received += buffer.length;
44 input.dataHandler = readData; 37 if (received == BUFFERSIZE) {
38 process.close();
39 }
45 } 40 }
46 41
47 bool written = output.write(data, 0, BUFFERSIZE, dataWritten); 42 output.write(data);
48 if (written) { 43 output.end();
49 dataWritten(); 44 input.dataHandler = readData;
50 }
51 } 45 }
52 46
53 static void testMain() { 47 static void testMain() {
54 testExit(); 48 testExit();
55 } 49 }
56 } 50 }
57 51
58 main() { 52 main() {
59 ProcessStderrTest.testMain(); 53 ProcessStderrTest.testMain();
60 } 54 }
OLDNEW
« no previous file with comments | « tests/standalone/src/FileTest.dart ('k') | tests/standalone/src/ProcessStdoutTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698