Chromium Code Reviews| 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 testEmptyListOutputStream1() { | 8 void testEmptyListOutputStream1() { |
| 9 ListOutputStream stream = new ListOutputStream(); | 9 ListOutputStream stream = new ListOutputStream(); |
| 10 Expect.equals(null, stream.read()); | 10 Expect.equals(null, stream.read()); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 new Timer(0, (_) { | 132 new Timer(0, (_) { |
| 133 result.add(3); | 133 result.add(3); |
| 134 stream.write([4]); | 134 stream.write([4]); |
| 135 stream.close(); | 135 stream.close(); |
| 136 }); | 136 }); |
| 137 }); | 137 }); |
| 138 | 138 |
| 139 donePort.receive((x,y) => donePort.close()); | 139 donePort.receive((x,y) => donePort.close()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void testListOutputStream5() { | |
| 143 ListOutputStream stream = new ListOutputStream(); | |
| 144 ReceivePort donePort = new ReceivePort(); | |
| 145 List result = <int>[]; | |
| 146 | |
| 147 stream.onClosed = () { | |
| 148 Expect.isTrue(stream.closed); | |
|
Bill Hesse
2012/08/08 14:21:11
Why not check the contents here?
nweiz
2012/08/09 19:39:52
Done.
| |
| 149 donePort.toSendPort().send(null); | |
| 150 }; | |
| 151 | |
| 152 Expect.isFalse(stream.closed); | |
| 153 stream.write([1, 2, 3]); | |
| 154 Expect.isFalse(stream.closed); | |
| 155 stream.close(); | |
| 156 Expect.isTrue(stream.closed); | |
| 157 | |
|
Bill Hesse
2012/08/08 14:21:11
Add a test that .write throws an exception here?
nweiz
2012/08/09 19:39:52
Done.
| |
| 158 donePort.receive((x,y) => donePort.close()); | |
| 159 } | |
| 160 | |
| 142 main() { | 161 main() { |
| 143 testEmptyListOutputStream1(); | 162 testEmptyListOutputStream1(); |
| 144 testEmptyListOutputStream2(); | 163 testEmptyListOutputStream2(); |
| 145 testListOutputStream1(); | 164 testListOutputStream1(); |
| 146 testListOutputStream2(); | 165 testListOutputStream2(); |
| 147 testListOutputStream3(); | 166 testListOutputStream3(); |
| 148 testListOutputStream4(); | 167 testListOutputStream4(); |
| 168 testListOutputStream5(); | |
| 149 } | 169 } |
| OLD | NEW |