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 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
9 | 9 |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 25 matching lines...) Expand all Loading... |
36 client.close(); | 36 client.close(); |
37 } else { | 37 } else { |
38 received += data.length; | 38 received += data.length; |
39 } | 39 } |
40 }, | 40 }, |
41 onDone: () { | 41 onDone: () { |
42 if (bytes != null) Expect.equals(received, bytes); | 42 if (bytes != null) Expect.equals(received, bytes); |
43 client.close(); | 43 client.close(); |
44 }, | 44 }, |
45 onError: (error) { | 45 onError: (error) { |
46 Expect.isTrue(error is HttpParserException); | 46 Expect.isTrue(error is HttpException); |
47 }); | 47 }); |
48 }) | 48 }) |
49 .catchError((error) { | 49 .catchError((error) { |
50 client.close(); | 50 client.close(); |
51 }, test: (e) => e is HttpParserException); | 51 }, test: (e) => e is HttpException); |
52 }); | 52 }); |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 void testResponseDone() { | 56 void testResponseDone() { |
57 testServerRequest((server, request) { | 57 testServerRequest((server, request) { |
58 request.response.close(); | 58 request.response.close(); |
59 request.response.done.then((response) { | 59 request.response.done.then((response) { |
60 Expect.equals(request.response, response); | 60 Expect.equals(request.response, response); |
61 server.close(); | 61 server.close(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 void main() { | 274 void main() { |
275 testResponseDone(); | 275 testResponseDone(); |
276 testResponseAddStream(); | 276 testResponseAddStream(); |
277 testResponseAddStreamClosed(); | 277 testResponseAddStreamClosed(); |
278 testResponseAddClosed(); | 278 testResponseAddClosed(); |
279 testBadResponseAdd(); | 279 testBadResponseAdd(); |
280 testBadResponseClose(); | 280 testBadResponseClose(); |
281 testIgnoreRequestData(); | 281 testIgnoreRequestData(); |
282 } | 282 } |
OLD | NEW |