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

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

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 7 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_test.dart
diff --git a/tests/lib/async/stream_state_test.dart b/tests/lib/async/stream_state_test.dart
index 08cb7a164a460bbac2fb73402538325fb57b232e..bee7f9ba991128f67a211590e07ef3ff47bf8a92 100644
--- a/tests/lib/async/stream_state_test.dart
+++ b/tests/lib/async/stream_state_test.dart
@@ -11,38 +11,44 @@ import "stream_state_helper.dart";
const ms5 = const Duration(milliseconds: 5);
main() {
- mainTest(false);
- // TODO(floitsch): reenable?
- // mainTest(true);
+ mainTest(sync: true, broadcast: false);
+ mainTest(sync: true, broadcast: true);
+ mainTest(sync: false, broadcast: false);
+ mainTest(sync: false, broadcast: true);
}
-mainTest(bool broadcast) {
- var p = broadcast ? "BC" : "SC";
+mainTest({bool sync, bool broadcast}) {
+ var p = (sync ? "S" : "AS") + (broadcast ? "BC" : "SC");
test("$p-sub-data-done", () {
- var t = new StreamProtocolTest(broadcast);
- t..expectSubscription()
+ var t = new StreamProtocolTest(sync: sync, broadcast: broadcast);
+ t..expectListen()
..expectData(42)
..expectDone()
..expectCancel();
- t..subscribe()..add(42)..close();
+ t..listen()..add(42)..close();
});
- test("$p-data-done-sub", () {
- var t = new StreamProtocolTest(broadcast);
- if (broadcast) {
- t..expectDone();
- } else {
- t..expectSubscription()
- ..expectData(42)
- ..expectDone()
- ..expectCancel();
- }
- t..add(42)..close()..subscribe();
+ test("$p-data-done-sub-sync", () {
+ var t = new StreamProtocolTest(sync: sync, broadcast: broadcast);
+ t..expectListen()
+ ..expectData(42)
+ ..expectDone()
+ ..expectCancel();
+ t..add(42)..close()..listen();
+ });
+
+ test("$p-data-done-sub-async", () {
+ var t = new StreamProtocolTest(sync: sync, broadcast: broadcast);
+ t..expectListen()
+ ..expectData(42)
+ ..expectDone()
+ ..expectCancel();
+ t..add(42)..close()..listen();
});
test("$p-sub-data/pause+resume-done", () {
- var t = new StreamProtocolTest(broadcast);
- t..expectSubscription()
+ var t = new StreamProtocolTest(sync: sync, broadcast: broadcast);
+ t..expectListen()
..expectData(42, () {
t.pause();
t.resume();
@@ -50,16 +56,16 @@ mainTest(bool broadcast) {
})
..expectDone()
..expectCancel();
- t..subscribe()..add(42);
+ t..listen()..add(42);
});
test("$p-sub-data-unsubonerror", () {
- var t = new StreamProtocolTest(broadcast);
- t..expectSubscription()
+ var t = new StreamProtocolTest(sync: sync, broadcast: broadcast);
+ t..expectListen()
..expectData(42)
..expectError("bad")
..expectCancel();
- t..subscribe(cancelOnError: true)
+ t..listen(cancelOnError: true)
..add(42)
..error("bad")
..add(43)
@@ -67,14 +73,14 @@ mainTest(bool broadcast) {
});
test("$p-sub-data-no-unsubonerror", () {
- var t = new StreamProtocolTest(broadcast);
- t..expectSubscription()
+ var t = new StreamProtocolTest(sync: sync, broadcast: broadcast);
+ t..expectListen()
..expectData(42)
..expectError("bad")
..expectData(43)
..expectDone()
..expectCancel();
- t..subscribe(cancelOnError: false)
+ t..listen(cancelOnError: false)
..add(42)
..error("bad")
..add(43)
@@ -82,15 +88,18 @@ mainTest(bool broadcast) {
});
test("$p-pause-resume-during-event", () {
- var t = new StreamProtocolTest(broadcast);
- t..expectSubscription()
+ var t = new StreamProtocolTest(sync: sync, broadcast: broadcast);
+ t..expectListen()
..expectData(42, () {
t.pause();
t.resume();
- })
- ..expectDone()
+ });
+ if (!broadcast && !sync) {
+ t..expectPause();
+ }
+ t..expectDone()
..expectCancel();
- t..subscribe()
+ t..listen()
..add(42)
..close();
});
« no previous file with comments | « tests/lib/async/stream_state_nonzero_timer_test.dart ('k') | tests/lib/async/stream_subscription_as_future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698