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

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

Issue 11740027: Rename unsubscribe to cancel. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Fix error message. Created 7 years, 12 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_controller_test.dart
diff --git a/tests/lib/async/stream_controller_test.dart b/tests/lib/async/stream_controller_test.dart
index a20c701cf73745fb1f648d7ff6969d3fc19a2284..e06ec4ad512c92d2775001bac7ae6624c92d5c14 100644
--- a/tests/lib/async/stream_controller_test.dart
+++ b/tests/lib/async/stream_controller_test.dart
@@ -33,7 +33,7 @@ testController() {
expectedEvents = new Events()..add(42)..error("error")..add(37);
actualEvents = new Events.capture(c, unsubscribeOnError: false);
expectedEvents.replay(c);
- actualEvents.subscription.unsubscribe();
+ actualEvents.subscription.cancel();
c.add("Are you there"); // Not sent to actualEvents.
Expect.listEquals(expectedEvents.events, actualEvents.events);
@@ -125,17 +125,17 @@ testController() {
var sink = c.sink;
var stream = c.stream;
var counter = 0;
- var subscription = stream.subscribe();
+ var subscription = stream.listen(null);
subscription.onData((data) {
counter += data;
- subscription.unsubscribe();
- stream.subscribe(onData: (data) {
+ subscription.cancel();
+ stream.listen((data) {
counter += 10 * data;
});
- var subscription2 = stream.subscribe();
+ var subscription2 = stream.listen(null);
subscription2.onData((data) {
counter += 100 * data;
- if (data == 4) subscription2.unsubscribe();
+ if (data == 4) subscription2.cancel();
});
});
sink.add(1); // seen by stream 1
@@ -173,7 +173,7 @@ testSingleController() {
expectedEvents = new Events()..add(42)..error("error")..add(37);
actualEvents = new Events.capture(c, unsubscribeOnError: false);
expectedEvents.replay(c);
- actualEvents.subscription.unsubscribe();
+ actualEvents.subscription.cancel();
c.add("Are you there"); // Not sent to actualEvents.
Expect.listEquals(expectedEvents.events, actualEvents.events);
@@ -277,8 +277,8 @@ testSingleController() {
var sink = c.sink;
var stream = c.stream;
var counter = 0;
- var subscription = stream.subscribe(onData: (data) { counter += data; });
- Expect.throws(() => stream.subscribe(), (e) => e is StateError);
+ var subscription = stream.listen((data) { counter += data; });
+ Expect.throws(() => stream.listen(null), (e) => e is StateError);
sink.add(1);
Expect.equals(1, counter);
c.close();

Powered by Google App Engine
This is Rietveld 408576698