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

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

Issue 8989019: Implement list based output stream and add pipe to list based input streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 9 years 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
« no previous file with comments | « runtime/bin/stream_util.dart ('k') | tests/standalone/src/ListOutputStreamTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/ListInputStreamTest.dart
diff --git a/tests/standalone/src/ListInputStreamTest.dart b/tests/standalone/src/ListInputStreamTest.dart
index c90cc74d1ccf1b2657e7097bd02f57b5160661a4..b9df1a5a2e5e5815cf55a00bbc9f0bf4dc481fdd 100644
--- a/tests/standalone/src/ListInputStreamTest.dart
+++ b/tests/standalone/src/ListInputStreamTest.dart
@@ -7,7 +7,7 @@ void testEmptyListInputStream() {
ReceivePort donePort = new ReceivePort();
void onData() {
- throw "On data expected";
+ throw "No data expected";
}
void onClose() {
@@ -25,7 +25,7 @@ void testEmptyDynamicListInputStream() {
ReceivePort donePort = new ReceivePort();
void onData() {
- throw "On data expected";
+ throw "No data expected";
}
void onClose() {
@@ -87,6 +87,55 @@ void testListInputStream2() {
donePort.receive((x,y) => donePort.close());
}
+void testListInputStreamPipe1() {
+ List<int> data = [0x00, 0x01, 0x10, 0x11, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff];
+ InputStream input = new ListInputStream(data);
+ OutputStream output = new ListOutputStream();
+ ReceivePort donePort = new ReceivePort();
+
+ void onClose() {
+ var contents = output.contents();
+ Expect.equals(data.length, contents.length);
+ donePort.toSendPort().send(null);
+ }
+
+ input.closeHandler = onClose;
+ input.pipe(output);
+
+ donePort.receive((x,y) => donePort.close());
+}
+
+void testListInputStreamPipe2() {
+ List<int> data = [0x00, 0x01, 0x10, 0x11, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff];
+ OutputStream output = new ListOutputStream();
+ ReceivePort donePort = new ReceivePort();
+ int count = 0;
+
+ void onClose() {
+ if (count < 10) {
+ InputStream input = new ListInputStream(data);
+ input.closeHandler = onClose;
+ if (count < 9) {
+ input.pipe(output, close: false);
+ } else {
+ input.pipe(output);
+ }
+ count++;
+ } else {
+ var contents = output.contents();
+ Expect.equals(data.length * 10, contents.length);
+ donePort.toSendPort().send(null);
+ }
+ }
+
+ InputStream input = new ListInputStream(data);
+ input.closeHandler = onClose;
+ input.pipe(output, close: false);
+ count++;
+
+ donePort.receive((x,y) => donePort.close());
+}
+
void testDynamicListInputStream1() {
List<int> data = [0x00, 0x01, 0x10, 0x11, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff];
InputStream stream = new DynamicListInputStream();
@@ -123,5 +172,7 @@ main() {
testEmptyDynamicListInputStream();
testListInputStream1();
testListInputStream2();
+ testListInputStreamPipe1();
+ testListInputStreamPipe2();
testDynamicListInputStream1();
}
« no previous file with comments | « runtime/bin/stream_util.dart ('k') | tests/standalone/src/ListOutputStreamTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698