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

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

Issue 23469003: Add an AssetStream class to Barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
(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 library barback.test.stream_replayer_test;
6
7 import 'dart:async';
8
9 import 'package:barback/src/stream_replayer.dart';
10 import 'package:unittest/unittest.dart';
11
12 import 'utils.dart';
13
14 main() {
15 initConfig();
16
17 test("a replay that's retrieved before the stream is finished replays the "
18 "stream", () {
19 var controller = new StreamController<int>();
20 var replay = new StreamReplayer<int>(controller.stream).getReplay();
21
22 controller.add(1);
23 controller.add(2);
24 controller.add(3);
25 controller.close();
26
27 expect(replay.toList(), completion(equals([1, 2, 3])));
28 });
29
30 test("a replay that's retrieved after the stream is finished replays the "
31 "stream", () {
32 var controller = new StreamController<int>();
33 var replayer = new StreamReplayer<int>(controller.stream);
34
35 controller.add(1);
36 controller.add(2);
37 controller.add(3);
38 controller.close();
39
40 expect(replayer.getReplay().toList(), completion(equals([1, 2, 3])));
41 });
42
43 test("multiple replays each replay the stream", () {
44 var controller = new StreamController<int>();
45 var replayer = new StreamReplayer<int>(controller.stream);
46
47 var replay1 = replayer.getReplay();
48 controller.add(1);
49 controller.add(2);
50 controller.add(3);
51 controller.close();
52 var replay2 = replayer.getReplay();
53
54 expect(replay1.toList(), completion(equals([1, 2, 3])));
55 expect(replay2.toList(), completion(equals([1, 2, 3])));
56 });
57 }
OLDNEW
« pkg/barback/lib/src/stream_replayer.dart ('K') | « pkg/barback/lib/src/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698