Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: tests/lib/async/stream_state_helper.dart

Issue 14136004: Remove StreamController.broadcast. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/lib/async/stream_state_helper.dart
diff --git a/tests/lib/async/stream_state_helper.dart b/tests/lib/async/stream_state_helper.dart
index b982d9d23be4e82fd13fec277e913907f31fbeac..a2881fe9b3aa0adacd7ed6f4683bd544bc184a70 100644
--- a/tests/lib/async/stream_state_helper.dart
+++ b/tests/lib/async/stream_state_helper.dart
@@ -10,21 +10,21 @@ import "dart:collection";
class StreamProtocolTest {
StreamController _controller;
+ Stream _controllerStream;
StreamSubscription _subscription;
List<Event> _expectations = new List<Event>();
int _nextExpectationIndex = 0;
Function _onComplete;
StreamProtocolTest([bool broadcast = false]) {
+ _controller = new StreamController(
+ onPauseStateChange: _onPause,
+ onSubscriptionStateChange: _onSubcription);
+ // TODO(lrn): Make it work with multiple subscribers too.
if (broadcast) {
- _controller = new StreamController.broadcast(
- onPauseStateChange: _onPause,
- onSubscriptionStateChange: _onSubcription);
- // TODO(lrn): Make it work with multiple subscribers too.
+ _controllerStream = _controller.stream.asBroadcastStream();
} else {
- _controller = new StreamController(
- onPauseStateChange: _onPause,
- onSubscriptionStateChange: _onSubcription);
+ _controllerStream = _controller.stream;
}
_onComplete = expectAsync0((){
_onComplete = null; // Being null marks the test to be complete.
@@ -40,11 +40,11 @@ class StreamProtocolTest {
// TODO(lrn): Handle more subscriptions (e.g., a subscription-id
// per subscription, and an id on event _expectations).
if (_subscription != null) throw new StateError("Already subscribed");
- _subscription = _controller.stream.listen(_onData,
- onError: _onError,
- onDone: _onDone,
- unsubscribeOnError:
- unsubscribeOnError);
+ _subscription = _controllerStream.listen(_onData,
+ onError: _onError,
+ onDone: _onDone,
+ unsubscribeOnError:
+ unsubscribeOnError);
}
void pause([Future resumeSignal]) {

Powered by Google App Engine
This is Rietveld 408576698