| 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 library stream_state_helper; | 5 library stream_state_helper; |
| 6 | 6 |
| 7 import "package:unittest/unittest.dart"; | 7 import "package:unittest/unittest.dart"; |
| 8 import "dart:async"; | 8 import "dart:async"; |
| 9 import "dart:collection"; | 9 import "dart:collection"; |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 void resume() { | 138 void resume() { |
| 139 _latestSubscription.resume(); | 139 _latestSubscription.resume(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void cancel() { | 142 void cancel() { |
| 143 _latestSubscription.cancel(); | 143 _latestSubscription.cancel(); |
| 144 _latestSubscription = null; | 144 _latestSubscription = null; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // End the test now. There must be no open expectations, and no furter | 147 // End the test now. There must be no open expectations, and no further |
| 148 // expectations will be allowed. | 148 // expectations will be allowed. |
| 149 // Called automatically by an onCancel event on a non-broadcast stream. | 149 // Called automatically by an onCancel event on a non-broadcast stream. |
| 150 void terminate() { | 150 void terminate() { |
| 151 if (_nextExpectationIndex != _expectations.length) { | 151 if (_nextExpectationIndex != _expectations.length) { |
| 152 _withNextExpectation((Event expect) { | 152 _withNextExpectation((Event expect) { |
| 153 _fail("Expected: $expect\n" | 153 _fail("Expected: $expect\n" |
| 154 "Found : Early termination.\n${expect._stackTrace}"); | 154 "Found : Early termination.\n${expect._stackTrace}"); |
| 155 }); | 155 }); |
| 156 } | 156 } |
| 157 _onComplete(); | 157 _onComplete(); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 596 } |
| 597 | 597 |
| 598 bool _testBroadcastCancel() { | 598 bool _testBroadcastCancel() { |
| 599 _actual = "*[BroadcastCancel]"; | 599 _actual = "*[BroadcastCancel]"; |
| 600 return true; | 600 return true; |
| 601 } | 601 } |
| 602 | 602 |
| 603 /** Returns a representation of the event it was tested against. */ | 603 /** Returns a representation of the event it was tested against. */ |
| 604 String toString() => _actual; | 604 String toString() => _actual; |
| 605 } | 605 } |
| OLD | NEW |