| 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 #import("dart:io"); |
| 6 |
| 5 void test1() { | 7 void test1() { |
| 6 void testWithChunkSize(var data, int chunkSize, Function testDone) { | 8 void testWithChunkSize(var data, int chunkSize, Function testDone) { |
| 7 InputStream s = new ListInputStream(data); | 9 InputStream s = new ListInputStream(data); |
| 8 ChunkedInputStream stream = new ChunkedInputStream(s); | 10 ChunkedInputStream stream = new ChunkedInputStream(s); |
| 9 int chunkCount = 0; | 11 int chunkCount = 0; |
| 10 int byteCount = 0; | 12 int byteCount = 0; |
| 11 void chunkData() { | 13 void chunkData() { |
| 12 List<int> chunk = stream.read(); | 14 List<int> chunk = stream.read(); |
| 13 if (byteCount + chunkSize < data.length) { | 15 if (byteCount + chunkSize < data.length) { |
| 14 Expect.equals(chunkSize, chunk.length); | 16 Expect.equals(chunkSize, chunk.length); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 s.write([4, 5, 6]); // 7 bytes written to stream. | 128 s.write([4, 5, 6]); // 7 bytes written to stream. |
| 127 | 129 |
| 128 donePort.receive((x,y) => donePort.close()); | 130 donePort.receive((x,y) => donePort.close()); |
| 129 } | 131 } |
| 130 | 132 |
| 131 | 133 |
| 132 main() { | 134 main() { |
| 133 test1(); | 135 test1(); |
| 134 test2(); | 136 test2(); |
| 135 } | 137 } |
| OLD | NEW |