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

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

Issue 882713009: Make synchronous broadcast StreamController throw if adding event while adding event. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update version number. Created 5 years, 10 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
« no previous file with comments | « sdk/lib/async/stream_controller.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 685222d43b743e6343dd8798033bdbaf9efaf8d0..e4ddecf1a3400c0c13250744af14db178305dc51 100644
--- a/tests/lib/async/stream_controller_test.dart
+++ b/tests/lib/async/stream_controller_test.dart
@@ -673,6 +673,52 @@ void testEventInListen() {
c.close();
}
+void testSyncControllerNotReentrant() {
+ Stream emptyStream = (new StreamController.broadcast()..close()).stream;
+ asyncStart();
+ for (int listenerCount = 1; listenerCount <= 2; listenerCount++) {
+ StreamController c = new StreamController.broadcast(sync: true);
+ for (int i = 0; i < listenerCount; i++) {
+ asyncStart();
+ asyncStart();
+ c.stream.listen((v) {
+ Expect.equals(42, v);
+ Expect.throws(() {
+ c.add(37);
+ });
+ Expect.throws(() {
+ c.addError(37);
+ });
+ Expect.throws(() {
+ c.addStream(emptyStream);
+ });
+ Expect.throws(() {
+ c.close();
+ });
+ asyncEnd();
+ }, onError: (e, s) {
+ Expect.equals(87, e);
+ Expect.throws(() {
+ c.add(37);
+ });
+ Expect.throws(() {
+ c.addError(37);
+ });
+ Expect.throws(() {
+ c.addStream(emptyStream);
+ });
+ Expect.throws(() {
+ c.close();
+ });
+ asyncEnd();
+ });
+ }
+ c.add(42);
+ c.addError(87);
+ }
+ asyncEnd();
+}
+
main() {
asyncStart();
testMultiController();
@@ -691,5 +737,6 @@ main() {
testAsBroadcastListenAfterClose();
testAsBroadcastListenAfterClosePaused();
testEventInListen();
+ testSyncControllerNotReentrant();
asyncEnd();
}
« no previous file with comments | « sdk/lib/async/stream_controller.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698