| 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 // Test the event/callback protocol of the stream implementations. | 5 // Test the event/callback protocol of the stream implementations. |
| 6 library stream_state_test; | 6 library stream_state_test; |
| 7 | 7 |
| 8 import "../../../pkg/unittest/lib/unittest.dart"; | 8 import "../../../pkg/unittest/lib/unittest.dart"; |
| 9 import "stream_state_helper.dart"; | 9 import "stream_state_helper.dart"; |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ..expectData(43) | 73 ..expectData(43) |
| 74 ..expectDone() | 74 ..expectDone() |
| 75 ..expectSubscription(false, false); | 75 ..expectSubscription(false, false); |
| 76 t..subscribe(unsubscribeOnError: false) | 76 t..subscribe(unsubscribeOnError: false) |
| 77 ..add(42) | 77 ..add(42) |
| 78 ..error("bad") | 78 ..error("bad") |
| 79 ..add(43) | 79 ..add(43) |
| 80 ..close(); | 80 ..close(); |
| 81 }); | 81 }); |
| 82 | 82 |
| 83 test("$p-pause-during-callback", () { | |
| 84 var t = new StreamProtocolTest(broadcast); | |
| 85 t..expectSubscription(true, false) | |
| 86 ..expectData(42, () { | |
| 87 t.pause(); | |
| 88 }) | |
| 89 ..expectPause(true, () { | |
| 90 t.resume(); | |
| 91 }) | |
| 92 ..expectPause(false, () { | |
| 93 t.pause(); | |
| 94 t.resume(); | |
| 95 t.close(); | |
| 96 }) | |
| 97 ..expectDone() | |
| 98 ..expectSubscription(false, false); | |
| 99 t..subscribe() | |
| 100 ..add(42); | |
| 101 }); | |
| 102 | |
| 103 test("$p-pause-resume-during-event", () { | 83 test("$p-pause-resume-during-event", () { |
| 104 var t = new StreamProtocolTest(broadcast); | 84 var t = new StreamProtocolTest(broadcast); |
| 105 t..expectSubscription(true, false) | 85 t..expectSubscription(true, false) |
| 106 ..expectData(42, () { | 86 ..expectData(42, () { |
| 107 t.pause(); | 87 t.pause(); |
| 108 t.resume(); | 88 t.resume(); |
| 109 }) | 89 }) |
| 110 ..expectDone() | 90 ..expectDone() |
| 111 ..expectSubscription(false, false); | 91 ..expectSubscription(false, false); |
| 112 t..subscribe() | 92 t..subscribe() |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 var t = new StreamProtocolTest(broadcast); | 134 var t = new StreamProtocolTest(broadcast); |
| 155 t..expectSubscription(true, false) | 135 t..expectSubscription(true, false) |
| 156 ..expectDone() | 136 ..expectDone() |
| 157 ..expectSubscription(false, false) | 137 ..expectSubscription(false, false) |
| 158 ..expectDone(); | 138 ..expectDone(); |
| 159 t..subscribe() | 139 t..subscribe() |
| 160 ..close() | 140 ..close() |
| 161 ..subscribe(); // Subscribe after done does not cause callbacks at all. | 141 ..subscribe(); // Subscribe after done does not cause callbacks at all. |
| 162 }); | 142 }); |
| 163 } | 143 } |
| OLD | NEW |