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

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

Issue 357283003: Fix listeners being added to subscription after onListen was called. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
« no previous file with comments | « sdk/lib/async/stream_transformers.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Test the basic StreamController and StreamController.singleSubscription. 5 // Test the basic StreamController and StreamController.singleSubscription.
6 library stream_controller_test; 6 library stream_controller_test;
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 sub.asFuture().whenComplete(() { Expect.fail("Bad complete"); }); 650 sub.asFuture().whenComplete(() { Expect.fail("Bad complete"); });
651 sub.resume(); 651 sub.resume();
652 new Timer(MS * 100, () { 652 new Timer(MS * 100, () {
653 sub.onDone(asyncEnd); 653 sub.onDone(asyncEnd);
654 sub.resume(); 654 sub.resume();
655 }); 655 });
656 }); 656 });
657 }); 657 });
658 } 658 }
659 659
660 void testEventInListen() {
661 asyncStart();
662 // Regression test for http://dartbug.com/19722
663 var c;
664 void send() {
665 c.add(1);
666 }
667 int i = 1;
668 c = new StreamController.broadcast(onListen: send, sync: true);
669 c.stream.listen((v) {
670 Expect.equals(i++, v);
671 }, onDone: asyncEnd);
672 c.add(2);
673 c.close();
674 }
675
660 main() { 676 main() {
661 asyncStart(); 677 asyncStart();
662 testMultiController(); 678 testMultiController();
663 testSingleController(); 679 testSingleController();
664 testExtraMethods(); 680 testExtraMethods();
665 testClosed(); 681 testClosed();
666 testCloseFuture(); 682 testCloseFuture();
667 testCloseFuture2(); 683 testCloseFuture2();
668 testCloseFuture3(); 684 testCloseFuture3();
669 testStreamEquals(); 685 testStreamEquals();
670 testCancelThrow(); 686 testCancelThrow();
671 testCancelThrow2(); 687 testCancelThrow2();
672 testCancelThrow3(); 688 testCancelThrow3();
673 testBroadcastListenAfterClose(); 689 testBroadcastListenAfterClose();
674 testBroadcastListenAfterClosePaused(); 690 testBroadcastListenAfterClosePaused();
675 testAsBroadcastListenAfterClose(); 691 testAsBroadcastListenAfterClose();
676 testAsBroadcastListenAfterClosePaused(); 692 testAsBroadcastListenAfterClosePaused();
693 testEventInListen();
677 asyncEnd(); 694 asyncEnd();
678 } 695 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream_transformers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698