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

Side by Side Diff: tests/standalone/io/mime_multipart_parser_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
« no previous file with comments | « tests/standalone/io/io_sink_test.dart ('k') | tests/standalone/io/regress_10026_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:math'; 7 import 'dart:math';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 10
11 void testParse(String message, 11 void testParse(String message,
12 String boundary, 12 String boundary,
13 [List<Map> expectedHeaders, 13 [List<Map> expectedHeaders,
14 List expectedParts, 14 List expectedParts,
15 bool expectError = false]) { 15 bool expectError = false]) {
16 void testWrite(List<int> data, [int chunkSize = -1]) { 16 void testWrite(List<int> data, [int chunkSize = -1]) {
17 StreamController controller = new StreamController(); 17 StreamController controller = new StreamController(sync: true);
18 18
19 var stream = controller.stream.transform( 19 var stream = controller.stream.transform(
20 new MimeMultipartTransformer(boundary)); 20 new MimeMultipartTransformer(boundary));
21 int i = 0; 21 int i = 0;
22 var port = new ReceivePort(); 22 var port = new ReceivePort();
23 stream.listen((multipart) { 23 stream.listen((multipart) {
24 int part = i++; 24 int part = i++;
25 if (expectedHeaders != null) { 25 if (expectedHeaders != null) {
26 Expect.mapEquals(expectedHeaders[part], multipart.headers); 26 Expect.mapEquals(expectedHeaders[part], multipart.headers);
27 } 27 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 \r 309 \r
310 Body2\r 310 Body2\r
311 --xxx\r\n"""; 311 --xxx\r\n""";
312 testParse(message, "xxx", null, [null, null], true); 312 testParse(message, "xxx", null, [null, null], true);
313 } 313 }
314 314
315 void main() { 315 void main() {
316 testParseValid(); 316 testParseValid();
317 testParseInvalid(); 317 testParseInvalid();
318 } 318 }
OLDNEW
« no previous file with comments | « tests/standalone/io/io_sink_test.dart ('k') | tests/standalone/io/regress_10026_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698