OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:convert'; | 5 import 'dart:convert'; |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 | 8 |
9 // This test implements a new special interface that can be used to | 9 // This test implements a new special interface that can be used to |
10 // send data more efficiently between two converters. | 10 // send data more efficiently between two converters. |
11 | 11 |
12 abstract class MyChunkedIntSink extends ChunkedConversionSink<int> { | 12 abstract class MyChunkedIntSink extends ChunkedConversionSink<List<int>> { |
13 MyChunkedIntSink(); | 13 MyChunkedIntSink(); |
14 factory MyChunkedIntSink.from(sink) = IntAdapterSink; | 14 factory MyChunkedIntSink.from(sink) = IntAdapterSink; |
15 factory MyChunkedIntSink.withCallback(callback) { | 15 factory MyChunkedIntSink.withCallback(callback) { |
16 var sink = new ChunkedConversionSink.withCallback(callback); | 16 var sink = new ChunkedConversionSink.withCallback(callback); |
17 return new MyChunkedIntSink.from(sink); | 17 return new MyChunkedIntSink.from(sink); |
18 } | 18 } |
19 | 19 |
20 add(int i); | 20 add(int i); |
21 close(); | 21 close(); |
22 | 22 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 intSink.add(-3); | 245 intSink.add(-3); |
246 intSink.add(3); | 246 intSink.add(3); |
247 intSink.close(); | 247 intSink.close(); |
248 Expect.isTrue(hasExecuted); | 248 Expect.isTrue(hasExecuted); |
249 Expect.equals(0, specialBCounter); | 249 Expect.equals(0, specialBCounter); |
250 specialBCounter = 0; | 250 specialBCounter = 0; |
251 Expect.equals(1, specialICounter); | 251 Expect.equals(1, specialICounter); |
252 specialICounter = 0; | 252 specialICounter = 0; |
253 hasExecuted = false; | 253 hasExecuted = false; |
254 } | 254 } |
OLD | NEW |