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

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

Issue 17490002: Make asBroadcastStream take two callbacks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reintroduce zone. Created 7 years, 6 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
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 'dart:async'; 9 import 'dart:async';
10 import 'event_helper.dart'; 10 import 'event_helper.dart';
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Test transform. 99 // Test transform.
100 c = new StreamController(sync: true); 100 c = new StreamController(sync: true);
101 sentEvents = new Events()..add("a")..error(42)..add("b")..close(); 101 sentEvents = new Events()..add("a")..error(42)..add("b")..close();
102 expectedEvents = 102 expectedEvents =
103 new Events()..error("a")..add(42)..error("b")..add("foo")..close(); 103 new Events()..error("a")..add(42)..error("b")..add("foo")..close();
104 actualEvents = new Events.capture(c.stream.asBroadcastStream().transform( 104 actualEvents = new Events.capture(c.stream.asBroadcastStream().transform(
105 new StreamTransformer( 105 new StreamTransformer(
106 handleData: (v, s) { s.addError(v); }, 106 handleData: (v, s) { s.addError(v); },
107 handleError: (e, s) { s.add(e); }, 107 handleError: (e, s) { s.add(e); },
108 handleDone: (s) { 108 handleDone: (s) {
109
110 s.add("foo"); 109 s.add("foo");
111
112 s.close(); 110 s.close();
113
114 }))); 111 })));
115 sentEvents.replay(c); 112 sentEvents.replay(c);
116 Expect.listEquals(expectedEvents.events, actualEvents.events); 113 Expect.listEquals(expectedEvents.events, actualEvents.events);
117 114
118 // Test multiple filters. 115 // Test multiple filters.
119 c = new StreamController(sync: true); 116 c = new StreamController(sync: true);
120 sentEvents = new Events()..add(42) 117 sentEvents = new Events()..add(42)
121 ..add("snugglefluffy") 118 ..add("snugglefluffy")
122 ..add(7) 119 ..add(7)
123 ..add("42") 120 ..add("42")
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 c.close(); 415 c.close();
419 Expect.isTrue(c.isClosed); 416 Expect.isTrue(c.isClosed);
420 } 417 }
421 418
422 main() { 419 main() {
423 testMultiController(); 420 testMultiController();
424 testSingleController(); 421 testSingleController();
425 testExtraMethods(); 422 testExtraMethods();
426 testClosed(); 423 testClosed();
427 } 424 }
OLDNEW
« no previous file with comments | « tests/lib/async/stream_controller_async_test.dart ('k') | tests/lib/async/stream_state_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698