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

Side by Side Diff: pkg/barback/test/stream_replayer_test.dart

Issue 43143002: Avoid sending needless data between isolates in "pub serve" and "pub build" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with bleeding edge Created 7 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 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 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 library barback.test.stream_replayer_test; 5 library barback.test.stream_replayer_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:barback/src/stream_replayer.dart'; 9 import 'package:barback/src/stream_replayer.dart';
10 import 'package:barback/src/utils.dart'; 10 import 'package:barback/src/utils.dart';
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 controller.add(3); 69 controller.add(3);
70 70
71 expect(pumpEventQueue().then((_) { 71 expect(pumpEventQueue().then((_) {
72 expect(isClosed, isFalse); 72 expect(isClosed, isFalse);
73 controller.close(); 73 controller.close();
74 return pumpEventQueue(); 74 return pumpEventQueue();
75 }).then((_) { 75 }).then((_) {
76 expect(isClosed, isTrue); 76 expect(isClosed, isTrue);
77 }), completes); 77 }), completes);
78 }); 78 });
79
80 test("the wrapped stream isn't opened if there are no replays", () {
81 var isOpened = false;
82 var controller = new StreamController<int>(onListen: () {
83 isOpened = true;
84 });
85 var replayer = new StreamReplayer<int>(controller.stream);
86
87 expect(pumpEventQueue().then((_) => isOpened), completion(isFalse));
88 });
89
90 test("the wrapped stream isn't opened if no replays are opened", () {
91 var isOpened = false;
92 var controller = new StreamController<int>(onListen: () {
93 isOpened = true;
94 });
95 var replayer = new StreamReplayer<int>(controller.stream);
96 replayer.getReplay();
97 replayer.getReplay();
98
99 expect(pumpEventQueue().then((_) => isOpened), completion(isFalse));
100 });
79 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698