| 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 import "dart:io"; | 5 import "dart:io"; |
| 6 import "dart:isolate"; | 6 import "dart:isolate"; |
| 7 | 7 |
| 8 void testEmptyListInputStream() { | 8 void testEmptyListInputStream() { |
| 9 ListInputStream stream = new ListInputStream(); | 9 ListInputStream stream = new ListInputStream(); |
| 10 stream.write([]); | 10 stream.write([]); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void testListInputStream2() { | 72 void testListInputStream2() { |
| 73 List<int> data = [0x00, 0x01, 0x10, 0x11, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff]; | 73 List<int> data = [0x00, 0x01, 0x10, 0x11, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff]; |
| 74 ListInputStream stream = new ListInputStream(); | 74 ListInputStream stream = new ListInputStream(); |
| 75 stream.write(data); | 75 stream.write(data); |
| 76 stream.markEndOfStream(); | 76 stream.markEndOfStream(); |
| 77 int count = 0; | 77 int count = 0; |
| 78 ReceivePort donePort = new ReceivePort(); | 78 ReceivePort donePort = new ReceivePort(); |
| 79 | 79 |
| 80 void onData() { | 80 void onData() { |
| 81 List<int> x = new List<int>(2); | 81 List<int> x = new List<int>.fixedLength(2); |
| 82 var bytesRead = stream.readInto(x); | 82 var bytesRead = stream.readInto(x); |
| 83 Expect.equals(2, bytesRead); | 83 Expect.equals(2, bytesRead); |
| 84 Expect.equals(data[count++], x[0]); | 84 Expect.equals(data[count++], x[0]); |
| 85 Expect.equals(data[count++], x[1]); | 85 Expect.equals(data[count++], x[1]); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void onClosed() { | 88 void onClosed() { |
| 89 Expect.equals(data.length, count); | 89 Expect.equals(data.length, count); |
| 90 donePort.toSendPort().send(count); | 90 donePort.toSendPort().send(count); |
| 91 } | 91 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 testListInputStream1(); | 282 testListInputStream1(); |
| 283 testListInputStream2(); | 283 testListInputStream2(); |
| 284 testListInputStreamPipe1(); | 284 testListInputStreamPipe1(); |
| 285 testListInputStreamPipe2(); | 285 testListInputStreamPipe2(); |
| 286 testListInputClose1(); | 286 testListInputClose1(); |
| 287 testListInputClose2(); | 287 testListInputClose2(); |
| 288 testDynamicListInputStream(); | 288 testDynamicListInputStream(); |
| 289 testDynamicListInputClose1(); | 289 testDynamicListInputClose1(); |
| 290 testDynamicListInputClose2(); | 290 testDynamicListInputClose2(); |
| 291 } | 291 } |
| OLD | NEW |