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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "dart:io"; | 7 import "dart:io"; |
8 import "dart:isolate"; | 8 import "dart:isolate"; |
9 | 9 |
10 class TestConsumer implements StreamConsumer { | 10 class TestConsumer implements StreamConsumer { |
(...skipping 16 matching lines...) Expand all Loading... |
27 return stream.fold( | 27 return stream.fold( |
28 received, | 28 received, |
29 (list, value) { | 29 (list, value) { |
30 list.addAll(value); | 30 list.addAll(value); |
31 return list; | 31 return list; |
32 }) | 32 }) |
33 .then((_) {}); | 33 .then((_) {}); |
34 } | 34 } |
35 | 35 |
36 Future close() { | 36 Future close() { |
37 return new Future.immediate(null) | 37 return new Future.value() |
38 .then((_) { | 38 .then((_) { |
39 if (closePort != null) closePort.close(); | 39 if (closePort != null) closePort.close(); |
40 Expect.listEquals(expected, received); | 40 Expect.listEquals(expected, received); |
41 if (expcetedAddStreamCount >= 0) { | 41 if (expcetedAddStreamCount >= 0) { |
42 Expect.equals(expcetedAddStreamCount, addStreamCount); | 42 Expect.equals(expcetedAddStreamCount, addStreamCount); |
43 } | 43 } |
44 }); | 44 }); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 controller.close(); | 100 controller.close(); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 void main() { | 104 void main() { |
105 testClose(); | 105 testClose(); |
106 testAddClose(); | 106 testAddClose(); |
107 testAddStreamClose(); | 107 testAddStreamClose(); |
108 testAddStreamAddClose(); | 108 testAddStreamAddClose(); |
109 } | 109 } |
OLD | NEW |