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

Unified Diff: tests/lib/async/stream_controller_async_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_async_test.dart
diff --git a/tests/lib/async/stream_controller_async_test.dart b/tests/lib/async/stream_controller_async_test.dart
index 6efa9b69a9bfe6a94740aa54ee4520161a4d767e..3c65a7e87f981d2b2d7718586d34a46535622828 100644
--- a/tests/lib/async/stream_controller_async_test.dart
+++ b/tests/lib/async/stream_controller_async_test.dart
@@ -80,11 +80,11 @@ testSingleController() {
Stream stream = c.stream;
int counter = 0;
var subscription;
- subscription = stream.subscribe(onData: (data) {
+ subscription = stream.listen((data) {
counter += data;
- Expect.throws(() => stream.subscribe(), (e) => e is StateError);
- subscription.unsubscribe();
- stream.subscribe(onData: (data) {
+ Expect.throws(() => stream.listen(null), (e) => e is StateError);
+ subscription.cancel();
+ stream.listen((data) {
counter += data * 10;
},
onDone: expectAsync0(() {
@@ -106,8 +106,8 @@ testSingleController() {
sink.add(1);
sink.add(2);
sink.close();
- stream.subscribe(
- onData: (data) {
+ stream.listen(
+ (data) {
counter += data;
},
onDone: expectAsync0(() {
@@ -122,17 +122,17 @@ testSingleController() {
StreamSink sink = c.sink;
Stream stream = c.stream;
int counter = 0;
- var subscription = stream.subscribe();
+ var subscription = stream.listen(null);
subscription.onData(expectAsync1((data) {
counter += data;
- subscription.unsubscribe();
- stream.subscribe(onData: (data) {
+ subscription.cancel();
+ stream.listen((data) {
counter += 10 * data;
},
onDone: expectAsync0(() {
Expect.equals(1 + 20 + 30 + 40 + 50, counter);
}));
- Expect.throws(() => stream.subscribe(), (e) => e is StateError);
+ Expect.throws(() => stream.listen(null), (e) => e is StateError);
}));
sink.add(1); // seen by stream 1
sink.add(2); // seen by stream 10 and 100

Powered by Google App Engine
This is Rietveld 408576698