| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |