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

Unified Diff: tests/standalone/src/ProcessStderrTest.dart

Issue 8318009: Update the streams interfaces (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Starting implementation Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: tests/standalone/src/ProcessStderrTest.dart
diff --git a/tests/standalone/src/ProcessStderrTest.dart b/tests/standalone/src/ProcessStderrTest.dart
index 80dfc269b2b4da6a572d425ff8cda6169118f440..d5536bf4995cad13eb5ad0ddbfc8e86e971b2a6d 100644
--- a/tests/standalone/src/ProcessStderrTest.dart
+++ b/tests/standalone/src/ProcessStderrTest.dart
@@ -16,32 +16,34 @@ class ProcessStderrTest {
const ["1", "1", "99", "0"]);
final int BUFFERSIZE = 10;
final int STARTCHAR = 65;
- List<int> buffer = new List<int>(BUFFERSIZE);
+ List<int> data = new List<int>(BUFFERSIZE);
for (int i = 0; (i < BUFFERSIZE - 1); i++) {
- buffer[i] = STARTCHAR + i;
+ data[i] = STARTCHAR + i;
}
- buffer[BUFFERSIZE - 1] = 10;
+ data[BUFFERSIZE - 1] = 10;
- SocketInputStream input = process.stderrStream;
- SocketOutputStream output = process.stdinStream;
+ InputStream2 input = process.stderrStream1;
+ OutputStream output = process.stdinStream;
process.start();
- List<int> readBuffer = new List<int>(BUFFERSIZE);
+ int received = 0;
void dataWritten() {
void readData() {
- for (int i = 0; i < BUFFERSIZE; i++) {
- Expect.equals(buffer[i], readBuffer[i]);
+ List<int> buffer = input.read();
+ for (int i = 0; i < buffer.length; i++) {
+ Expect.equals(data[received + i], buffer[i]);
+ }
+ received += buffer.length;
+ if (received == BUFFERSIZE) {
+ process.close();
}
- process.close();
}
- bool read = input.read(readBuffer, 0, BUFFERSIZE, readData);
- if (read) {
- readData();
- }
+ input.dataHandler = readData;
}
+
bool written = output.write(buffer, 0, BUFFERSIZE, dataWritten);
if (written) {
dataWritten();

Powered by Google App Engine
This is Rietveld 408576698