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

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

Issue 1272593002: Update Changelog. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « sdk/lib/async/stream.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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 asyncEnd(); 474 asyncEnd();
475 }); 475 });
476 } 476 }
477 477
478 void testStreamEquals() { 478 void testStreamEquals() {
479 StreamController c; 479 StreamController c;
480 c = new StreamController(sync: false); 480 c = new StreamController(sync: false);
481 Expect.equals(c.stream, c.stream); 481 Expect.equals(c.stream, c.stream);
482 c = new StreamController(sync: true); 482 c = new StreamController(sync: true);
483 Expect.equals(c.stream, c.stream); 483 Expect.equals(c.stream, c.stream);
484 c = new StreamController(sync: false, onListen:(){}); 484 c = new StreamController(sync: false, onListen: () {});
485 Expect.equals(c.stream, c.stream); 485 Expect.equals(c.stream, c.stream);
486 c = new StreamController(sync: true, onListen:(){}); 486 c = new StreamController(sync: true, onListen: () {});
487 Expect.equals(c.stream, c.stream); 487 Expect.equals(c.stream, c.stream);
488 c = new StreamController.broadcast(sync: false); 488 c = new StreamController.broadcast(sync: false);
489 Expect.equals(c.stream, c.stream); 489 Expect.equals(c.stream, c.stream);
490 c = new StreamController.broadcast(sync: true); 490 c = new StreamController.broadcast(sync: true);
491 Expect.equals(c.stream, c.stream); 491 Expect.equals(c.stream, c.stream);
492 c = new StreamController.broadcast(sync: false, onListen:(){}); 492 c = new StreamController.broadcast(sync: false, onListen: () {});
493 Expect.equals(c.stream, c.stream); 493 Expect.equals(c.stream, c.stream);
494 c = new StreamController.broadcast(sync: true, onListen:(){}); 494 c = new StreamController.broadcast(sync: true, onListen: () {});
495 Expect.equals(c.stream, c.stream); 495 Expect.equals(c.stream, c.stream);
496 } 496 }
497 497
498 void testCancelThrow() { 498 void testCancelThrow() {
499 asyncStart(); 499 asyncStart();
500 asyncStart(); 500 asyncStart();
501 asyncStart(); 501 asyncStart();
502 StreamController c = new StreamController(onCancel: () { 502 StreamController c = new StreamController(onCancel: () {
503 asyncEnd(); 503 asyncEnd();
504 throw "ERROR"; 504 throw "ERROR";
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 804
805 void testBroadcastSettingCallbacks() { 805 void testBroadcastSettingCallbacks() {
806 const int initial = 0; 806 const int initial = 0;
807 const int running = 1; 807 const int running = 1;
808 const int canceled = 2; 808 const int canceled = 2;
809 809
810 var controller = new StreamController.broadcast(); 810 var controller = new StreamController.broadcast();
811 var stream = controller.stream; 811 var stream = controller.stream;
812 var state = initial; 812 var state = initial;
813 813
814 Expect.throws(() { controller.onPause = (){}; }, 814 Expect.throws(() { controller.onPause = () {}; },
815 (e) => e is UnsupportedError); 815 (e) => e is UnsupportedError);
816 Expect.throws(() { controller.onResume = (){}; }, 816 Expect.throws(() { controller.onResume = () {}; },
817 (e) => e is UnsupportedError); 817 (e) => e is UnsupportedError);
818 818
819 controller..onListen = () { state = running; } 819 controller..onListen = () { state = running; }
820 ..onCancel = () { state = canceled; }; 820 ..onCancel = () { state = canceled; };
821 821
822 Expect.equals(initial, state); 822 Expect.equals(initial, state);
823 var sub = stream.listen(null); 823 var sub = stream.listen(null);
824 Expect.equals(running, state); 824 Expect.equals(running, state);
825 sub.cancel(); 825 sub.cancel();
826 Expect.equals(canceled, state); 826 Expect.equals(canceled, state);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 testAsBroadcastListenAfterClose(); 875 testAsBroadcastListenAfterClose();
876 testAsBroadcastListenAfterClosePaused(); 876 testAsBroadcastListenAfterClosePaused();
877 testEventInListen(); 877 testEventInListen();
878 testSyncControllerNotReentrant(); 878 testSyncControllerNotReentrant();
879 testSettingCallbacks(); 879 testSettingCallbacks();
880 testSettingNullCallbacks(); 880 testSettingNullCallbacks();
881 testBroadcastSettingCallbacks(); 881 testBroadcastSettingCallbacks();
882 testBroadcastSettingNullCallbacks(); 882 testBroadcastSettingNullCallbacks();
883 asyncEnd(); 883 asyncEnd();
884 } 884 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698