| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ..expectSubscription(false, false); | 51 ..expectSubscription(false, false); |
| 52 t..subscribe()..add(42); | 52 t..subscribe()..add(42); |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 test("$p-sub-data-unsubonerror", () { | 55 test("$p-sub-data-unsubonerror", () { |
| 56 var t = new StreamProtocolTest(broadcast); | 56 var t = new StreamProtocolTest(broadcast); |
| 57 t..expectSubscription(true, false) | 57 t..expectSubscription(true, false) |
| 58 ..expectData(42) | 58 ..expectData(42) |
| 59 ..expectError("bad") | 59 ..expectError("bad") |
| 60 ..expectSubscription(false, !broadcast); | 60 ..expectSubscription(false, !broadcast); |
| 61 t..subscribe(unsubscribeOnError: true) | 61 t..subscribe(cancelOnError: true) |
| 62 ..add(42) | 62 ..add(42) |
| 63 ..error("bad") | 63 ..error("bad") |
| 64 ..add(43) | 64 ..add(43) |
| 65 ..close(); | 65 ..close(); |
| 66 }); | 66 }); |
| 67 | 67 |
| 68 test("$p-sub-data-no-unsubonerror", () { | 68 test("$p-sub-data-no-unsubonerror", () { |
| 69 var t = new StreamProtocolTest(broadcast); | 69 var t = new StreamProtocolTest(broadcast); |
| 70 t..expectSubscription(true, false) | 70 t..expectSubscription(true, false) |
| 71 ..expectData(42) | 71 ..expectData(42) |
| 72 ..expectError("bad") | 72 ..expectError("bad") |
| 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(cancelOnError: 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-resume-during-event", () { | 83 test("$p-pause-resume-during-event", () { |
| 84 var t = new StreamProtocolTest(broadcast); | 84 var t = new StreamProtocolTest(broadcast); |
| 85 t..expectSubscription(true, false) | 85 t..expectSubscription(true, false) |
| 86 ..expectData(42, () { | 86 ..expectData(42, () { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 var t = new StreamProtocolTest(broadcast); | 134 var t = new StreamProtocolTest(broadcast); |
| 135 t..expectSubscription(true, false) | 135 t..expectSubscription(true, false) |
| 136 ..expectDone() | 136 ..expectDone() |
| 137 ..expectSubscription(false, false) | 137 ..expectSubscription(false, false) |
| 138 ..expectDone(); | 138 ..expectDone(); |
| 139 t..subscribe() | 139 t..subscribe() |
| 140 ..close() | 140 ..close() |
| 141 ..subscribe(); // Subscribe after done does not cause callbacks at all. | 141 ..subscribe(); // Subscribe after done does not cause callbacks at all. |
| 142 }); | 142 }); |
| 143 } | 143 } |
| OLD | NEW |