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

Side by Side Diff: tests/standalone/io/io_sink_test.dart

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 6 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "dart:async"; 6 import "dart:async";
7 import "dart:io"; 7 import "dart:io";
8 import "dart:isolate"; 8 import "dart:isolate";
9 9
10 class TestConsumer implements StreamConsumer { 10 class TestConsumer implements StreamConsumer {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 sink = new IOSink(new TestConsumer([0, 1, 2])); 58 sink = new IOSink(new TestConsumer([0, 1, 2]));
59 sink.add([0]); 59 sink.add([0]);
60 sink.add([1]); 60 sink.add([1]);
61 sink.add([2]); 61 sink.add([2]);
62 sink.close(); 62 sink.close();
63 } 63 }
64 64
65 void testAddStreamClose() { 65 void testAddStreamClose() {
66 { 66 {
67 var sink = new IOSink(new TestConsumer([0])); 67 var sink = new IOSink(new TestConsumer([0]));
68 var controller = new StreamController(); 68 var controller = new StreamController(sync: true);
69 sink.addStream(controller.stream) 69 sink.addStream(controller.stream)
70 .then((_) { 70 .then((_) {
71 sink.close(); 71 sink.close();
72 }); 72 });
73 controller.add([0]); 73 controller.add([0]);
74 controller.close(); 74 controller.close();
75 } 75 }
76 { 76 {
77 var sink = new IOSink(new TestConsumer([0, 1, 2])); 77 var sink = new IOSink(new TestConsumer([0, 1, 2]));
78 var controller = new StreamController(); 78 var controller = new StreamController(sync: true);
79 sink.addStream(controller.stream) 79 sink.addStream(controller.stream)
80 .then((_) { 80 .then((_) {
81 sink.close(); 81 sink.close();
82 }); 82 });
83 controller.add([0]); 83 controller.add([0]);
84 controller.add([1]); 84 controller.add([1]);
85 controller.add([2]); 85 controller.add([2]);
86 controller.close(); 86 controller.close();
87 } 87 }
88 } 88 }
89 89
90 void testAddStreamAddClose() { 90 void testAddStreamAddClose() {
91 { 91 {
92 var sink = new IOSink(new TestConsumer([0, 1])); 92 var sink = new IOSink(new TestConsumer([0, 1]));
93 var controller = new StreamController(); 93 var controller = new StreamController(sync: true);
94 sink.addStream(controller.stream) 94 sink.addStream(controller.stream)
95 .then((_) { 95 .then((_) {
96 sink.add([1]); 96 sink.add([1]);
97 sink.close(); 97 sink.close();
98 }); 98 });
99 controller.add([0]); 99 controller.add([0]);
100 controller.close(); 100 controller.close();
101 } 101 }
102 } 102 }
103 103
104 void main() { 104 void main() {
105 testClose(); 105 testClose();
106 testAddClose(); 106 testAddClose();
107 testAddStreamClose(); 107 testAddStreamClose();
108 testAddStreamAddClose(); 108 testAddStreamAddClose();
109 } 109 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_server_response_test.dart ('k') | tests/standalone/io/mime_multipart_parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698