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:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 | 8 |
9 void testEmptyListOutputStream1() { | 9 void testEmptyListOutputStream1() { |
10 ListOutputStream stream = new ListOutputStream(); | 10 ListOutputStream stream = new ListOutputStream(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 void onClosed() { | 120 void onClosed() { |
121 Expect.equals(4, result.length); | 121 Expect.equals(4, result.length); |
122 for (var i = 0; i < result.length; i++) Expect.equals(i + 1, result[i]); | 122 for (var i = 0; i < result.length; i++) Expect.equals(i + 1, result[i]); |
123 donePort.toSendPort().send(null); | 123 donePort.toSendPort().send(null); |
124 } | 124 } |
125 | 125 |
126 stream.onData = onData; | 126 stream.onData = onData; |
127 stream.onClosed = onClosed; | 127 stream.onClosed = onClosed; |
128 | 128 |
129 new Timer(0, (_) { | 129 Timer.run(() { |
130 result.add(1); | 130 result.add(1); |
131 stream.write([2]); | 131 stream.write([2]); |
132 | 132 |
133 new Timer(0, (_) { | 133 Timer.run(() { |
134 result.add(3); | 134 result.add(3); |
135 stream.write([4]); | 135 stream.write([4]); |
136 stream.close(); | 136 stream.close(); |
137 }); | 137 }); |
138 }); | 138 }); |
139 | 139 |
140 donePort.receive((x,y) => donePort.close()); | 140 donePort.receive((x,y) => donePort.close()); |
141 } | 141 } |
142 | 142 |
143 void testListOutputStream5() { | 143 void testListOutputStream5() { |
(...skipping 20 matching lines...) Expand all Loading... |
164 | 164 |
165 main() { | 165 main() { |
166 testEmptyListOutputStream1(); | 166 testEmptyListOutputStream1(); |
167 testEmptyListOutputStream2(); | 167 testEmptyListOutputStream2(); |
168 testListOutputStream1(); | 168 testListOutputStream1(); |
169 testListOutputStream2(); | 169 testListOutputStream2(); |
170 testListOutputStream3(); | 170 testListOutputStream3(); |
171 testListOutputStream4(); | 171 testListOutputStream4(); |
172 testListOutputStream5(); | 172 testListOutputStream5(); |
173 } | 173 } |
OLD | NEW |