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 // OtherResources=http_server_response_test.dart | 9 // OtherResources=http_server_response_test.dart |
10 | 10 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 .fold(0, (s, b) => s + b.length) | 274 .fold(0, (s, b) => s + b.length) |
275 .then((bytes) { | 275 .then((bytes) { |
276 Expect.equals(8, bytes); | 276 Expect.equals(8, bytes); |
277 server.close(); | 277 server.close(); |
278 }); | 278 }); |
279 }); | 279 }); |
280 }); | 280 }); |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 void testBadHeaders() { | |
285 testServerRequest((server, request) { | |
286 var value = "a"; | |
287 for (int i = 0; i < 8 * 1024; i++) { | |
288 value += 'a'; | |
289 } | |
290 request.response.headers.set('name', value); | |
291 request.response.close().catchError((error) { | |
292 server.close(); | |
293 }, test: (e) => e is HttpException); | |
294 }); | |
295 } | |
296 | |
297 | |
298 void testWriteCharCode() { | 284 void testWriteCharCode() { |
299 testServerRequest((server, request) { | 285 testServerRequest((server, request) { |
300 // Test that default is latin-1 (only 2 bytes). | 286 // Test that default is latin-1 (only 2 bytes). |
301 request.response.writeCharCode(0xFF); | 287 request.response.writeCharCode(0xFF); |
302 request.response.writeCharCode(0xFF); | 288 request.response.writeCharCode(0xFF); |
303 request.response.close().then((_) { | 289 request.response.close().then((_) { |
304 server.close(); | 290 server.close(); |
305 }); | 291 }); |
306 }, bytes: 2); | 292 }, bytes: 2); |
307 } | 293 } |
308 | 294 |
309 | 295 |
310 void main() { | 296 void main() { |
311 testResponseDone(); | 297 testResponseDone(); |
312 testResponseAddStream(); | 298 testResponseAddStream(); |
313 testResponseAddStreamClosed(); | 299 testResponseAddStreamClosed(); |
314 testResponseAddClosed(); | 300 testResponseAddClosed(); |
315 testBadResponseAdd(); | 301 testBadResponseAdd(); |
316 testBadResponseClose(); | 302 testBadResponseClose(); |
317 testIgnoreRequestData(); | 303 testIgnoreRequestData(); |
318 testBadHeaders(); | |
319 testWriteCharCode(); | 304 testWriteCharCode(); |
320 } | 305 } |
OLD | NEW |