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

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

Issue 18915008: Let StreamSubscription.cancel return a Future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Mark failing tests. Created 7 years, 2 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) 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 // Test the event/callback protocol of the stream implementations. 5 // Test the event/callback protocol of the stream implementations.
6 // Uses a non-zero timer so it fails on d8. 6 // Uses a non-zero timer so it fails on d8.
7 7
8 library stream_state_nonzero_timer_test; 8 library stream_state_nonzero_timer_test;
9 9
10 import "dart:async"; 10 import "dart:async";
(...skipping 12 matching lines...) Expand all
23 test("$p-sub-data/pause/resume/pause/resume-done", () { 23 test("$p-sub-data/pause/resume/pause/resume-done", () {
24 var t = new StreamProtocolTest(); 24 var t = new StreamProtocolTest();
25 t..expectListen() 25 t..expectListen()
26 ..expectData(42, () { 26 ..expectData(42, () {
27 t.pause(); 27 t.pause();
28 }) 28 })
29 ..expectPause(() { t.resume(); }) 29 ..expectPause(() { t.resume(); })
30 ..expectResume(() { t.pause(); }) 30 ..expectResume(() { t.pause(); })
31 ..expectPause(() { t.resume(); }) 31 ..expectPause(() { t.resume(); })
32 ..expectResume(() { t.close(); }) 32 ..expectResume(() { t.close(); })
33 ..expectDone() 33 ..expectCancel()
34 ..expectCancel(t.terminate); 34 ..expectDone(t.terminate);
35 t..listen()..add(42); 35 t..listen()..add(42);
36 }); 36 });
37 37
38 test("$p-sub-data/pause-done", () { 38 test("$p-sub-data/pause-done", () {
39 var t = new StreamProtocolTest(); 39 var t = new StreamProtocolTest();
40 t..expectListen() 40 t..expectListen()
41 ..expectData(42, () { 41 ..expectData(42, () {
42 t.pause(new Future.delayed(ms5, () => null)); 42 t.pause(new Future.delayed(ms5, () => null));
43 }) 43 })
44 ..expectPause() 44 ..expectPause()
45 ..expectDone() 45 ..expectCancel()
46 ..expectCancel(t.terminate); 46 ..expectDone(t.terminate);
47 // We are calling "close" while the controller is actually paused, 47 // We are calling "close" while the controller is actually paused,
48 // and it will stay paused until the pending events are sent. 48 // and it will stay paused until the pending events are sent.
49 t..listen()..add(42)..close(); 49 t..listen()..add(42)..close();
50 }); 50 });
51 51
52 test("$p-sub-data/pause-resume/done", () { 52 test("$p-sub-data/pause-resume/done", () {
53 var t = new StreamProtocolTest(); 53 var t = new StreamProtocolTest();
54 t..expectListen() 54 t..expectListen()
55 ..expectData(42, () { 55 ..expectData(42, () {
56 t.pause(new Future.delayed(ms5, () => null)); 56 t.pause(new Future.delayed(ms5, () => null));
57 }) 57 })
58 ..expectPause() 58 ..expectPause()
59 ..expectResume(t.close) 59 ..expectResume(t.close)
60 ..expectDone() 60 ..expectCancel()
61 ..expectCancel(t.terminate); 61 ..expectDone(t.terminate);
62 t..listen()..add(42); 62 t..listen()..add(42);
63 }); 63 });
64 64
65 test("$p-sub-data/data+pause-data-resume-done", () { 65 test("$p-sub-data/data+pause-data-resume-done", () {
66 var t = new StreamProtocolTest(); 66 var t = new StreamProtocolTest();
67 t..expectListen() 67 t..expectListen()
68 ..expectData(42, () { 68 ..expectData(42, () {
69 t.add(43); 69 t.add(43);
70 t.pause(new Future.delayed(ms5, () => null)); 70 t.pause(new Future.delayed(ms5, () => null));
71 // Should now be paused until the future finishes. 71 // Should now be paused until the future finishes.
72 // After that, the controller stays paused until the pending queue 72 // After that, the controller stays paused until the pending queue
73 // is empty. 73 // is empty.
74 }) 74 })
75 ..expectPause() 75 ..expectPause()
76 ..expectData(43) 76 ..expectData(43)
77 ..expectResume(t.close) 77 ..expectResume(t.close)
78 ..expectDone() 78 ..expectCancel()
79 ..expectCancel(t.terminate); 79 ..expectDone(t.terminate);
80 t..listen()..add(42); 80 t..listen()..add(42);
81 }); 81 });
82 82
83 test("$p-pause-during-callback", () { 83 test("$p-pause-during-callback", () {
84 var t = new StreamProtocolTest(); 84 var t = new StreamProtocolTest();
85 t..expectListen() 85 t..expectListen()
86 ..expectData(42, () { 86 ..expectData(42, () {
87 t.pause(); 87 t.pause();
88 }) 88 })
89 ..expectPause(() { 89 ..expectPause(() {
90 t.resume(); 90 t.resume();
91 }) 91 })
92 ..expectResume(() { 92 ..expectResume(() {
93 t.pause(); 93 t.pause();
94 t.resume(); 94 t.resume();
95 t.close(); 95 t.close();
96 }) 96 })
97 ..expectDone() 97 ..expectCancel()
98 ..expectCancel(t.terminate); 98 ..expectDone(t.terminate);
99 t..listen() 99 t..listen()
100 ..add(42); 100 ..add(42);
101 }); 101 });
102 } 102 }
OLDNEW
« no previous file with comments | « tests/lib/async/stream_controller_async_test.dart ('k') | tests/lib/async/stream_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698