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

Side by Side Diff: pkg/async/test/stream_zip_zone_test.dart

Issue 118783004: Add missing files from previous commit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « pkg/async/test/stream_zip_test.dart ('k') | pkg/collection/lib/iterable_zip.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 import "dart:async";
6 import "package:async/stream_zip.dart";
7 import "package:unittest/unittest.dart";
8
9 // Test that stream listener callbacks all happen in the zone where the
10 // listen occurred.
11
12 main() {
13 StreamController controller;
14 controller = new StreamController();
15 testStream("singlesub-async", controller, controller.stream);
16 controller = new StreamController.broadcast();
17 testStream("broadcast-async", controller, controller.stream);
18 controller = new StreamController();
19 testStream("asbroadcast-async", controller,
20 controller.stream.asBroadcastStream());
21
22 controller = new StreamController(sync: true);
23 testStream("singlesub-sync", controller, controller.stream);
24 controller = new StreamController.broadcast(sync: true);
25 testStream("broadcast-sync", controller, controller.stream);
26 controller = new StreamController(sync: true);
27 testStream("asbroadcast-sync", controller,
28 controller.stream.asBroadcastStream());
29 }
30
31 void testStream(String name, StreamController controller, Stream stream) {
32 test(name, () {
33 Zone outer = Zone.current;
34 runZoned(() {
35 Zone newZone1 = Zone.current;
36 StreamSubscription sub;
37 sub = stream.listen(expectAsync1((v) {
38 expect(v, 42);
39 expect(Zone.current, newZone1);
40 outer.run(() {
41 sub.onData(expectAsync1((v) {
42 expect(v, 37);
43 expect(Zone.current, newZone1);
44 runZoned(() {
45 Zone newZone2 = Zone.current;
46 sub.onData(expectAsync1((v) {
47 expect(v, 87);
48 expect(Zone.current, newZone1);
49 }));
50 });
51 controller.add(87);
52 }));
53 });
54 controller.add(37);
55 }));
56 });
57 controller.add(42);
58 });
59 }
OLDNEW
« no previous file with comments | « pkg/async/test/stream_zip_test.dart ('k') | pkg/collection/lib/iterable_zip.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698