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

Side by Side Diff: tests/lib/async/stream_state_helper.dart

Issue 14251013: Rename unsubscribeOnError to cancelOnError. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "../../../pkg/unittest/lib/unittest.dart"; 7 import "../../../pkg/unittest/lib/unittest.dart";
8 import "dart:async"; 8 import "dart:async";
9 import "dart:collection"; 9 import "dart:collection";
10 10
(...skipping 18 matching lines...) Expand all
29 _onComplete = expectAsync0((){ 29 _onComplete = expectAsync0((){
30 _onComplete = null; // Being null marks the test to be complete. 30 _onComplete = null; // Being null marks the test to be complete.
31 }); 31 });
32 } 32 }
33 33
34 // Actions on the stream and controller. 34 // Actions on the stream and controller.
35 void add(var data) { _controller.add(data); } 35 void add(var data) { _controller.add(data); }
36 void error(var error) { _controller.addError(error); } 36 void error(var error) { _controller.addError(error); }
37 void close() { _controller.close(); } 37 void close() { _controller.close(); }
38 38
39 void subscribe({bool unsubscribeOnError : false}) { 39 void subscribe({bool cancelOnError : false}) {
40 // TODO(lrn): Handle more subscriptions (e.g., a subscription-id 40 // TODO(lrn): Handle more subscriptions (e.g., a subscription-id
41 // per subscription, and an id on event _expectations). 41 // per subscription, and an id on event _expectations).
42 if (_subscription != null) throw new StateError("Already subscribed"); 42 if (_subscription != null) throw new StateError("Already subscribed");
43 _subscription = _controller.stream.listen(_onData, 43 _subscription = _controller.stream.listen(_onData,
44 onError: _onError, 44 onError: _onError,
45 onDone: _onDone, 45 onDone: _onDone,
46 unsubscribeOnError: 46 cancelOnError:
47 unsubscribeOnError); 47 cancelOnError);
48 } 48 }
49 49
50 void pause([Future resumeSignal]) { 50 void pause([Future resumeSignal]) {
51 if (_subscription == null) throw new StateError("Not subscribed"); 51 if (_subscription == null) throw new StateError("Not subscribed");
52 _subscription.pause(resumeSignal); 52 _subscription.pause(resumeSignal);
53 } 53 }
54 54
55 void resume([Future resumeSignal]) { 55 void resume([Future resumeSignal]) {
56 if (_subscription == null) throw new StateError("Not subscribed"); 56 if (_subscription == null) throw new StateError("Not subscribed");
57 _subscription.resume(); 57 _subscription.resume();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 _actual = "*[Paused:${c.isPaused}]"; 282 _actual = "*[Paused:${c.isPaused}]";
283 return true; 283 return true;
284 } 284 }
285 bool _testSubcribe(StreamController c) { 285 bool _testSubcribe(StreamController c) {
286 _actual = "*[Has listener:${c.hasListener}, Paused:${c.isPaused}]"; 286 _actual = "*[Has listener:${c.hasListener}, Paused:${c.isPaused}]";
287 return true; 287 return true;
288 } 288 }
289 289
290 String toString() => _actual; 290 String toString() => _actual;
291 } 291 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698