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 import "package:unittest/unittest.dart"; | 5 import "package:unittest/unittest.dart"; |
6 import "package:mime/mime.dart"; | 6 import "package:mime/mime.dart"; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:math'; | 8 import 'dart:math'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 written += writeLength; | 51 written += writeLength; |
52 } | 52 } |
53 controller.close(); | 53 controller.close(); |
54 | 54 |
55 return completer.future; | 55 return completer.future; |
56 } | 56 } |
57 | 57 |
58 // Test parsing the data three times delivering the data in | 58 // Test parsing the data three times delivering the data in |
59 // different chunks. | 59 // different chunks. |
60 List<int> data = message.codeUnits; | 60 List<int> data = message.codeUnits; |
61 expect(Future.wait([ | 61 test('test', () { |
62 testWrite(data), | 62 expect(Future.wait([ |
63 testWrite(data, 10), | 63 testWrite(data), |
64 testWrite(data, 2), | 64 testWrite(data, 10), |
65 testWrite(data, 1)]), | 65 testWrite(data, 2), |
66 completes); | 66 testWrite(data, 1)]), |
| 67 completes); |
| 68 }); |
67 } | 69 } |
68 | 70 |
69 void testParseValid() { | 71 void testParseValid() { |
70 String message; | 72 String message; |
71 Map headers; | 73 Map headers; |
72 Map headers1; | 74 Map headers1; |
73 Map headers2; | 75 Map headers2; |
74 Map headers3; | 76 Map headers3; |
75 Map headers4; | 77 Map headers4; |
76 String body1; | 78 String body1; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 \r | 314 \r |
313 Body2\r | 315 Body2\r |
314 --xxx\r\n"""; | 316 --xxx\r\n"""; |
315 testParse(message, "xxx", null, [null, null], true); | 317 testParse(message, "xxx", null, [null, null], true); |
316 } | 318 } |
317 | 319 |
318 void main() { | 320 void main() { |
319 testParseValid(); | 321 testParseValid(); |
320 testParseInvalid(); | 322 testParseInvalid(); |
321 } | 323 } |
OLD | NEW |