| 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 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 request.response.contentLength = 100; | 89 request.response.contentLength = 100; |
| 90 request.response.write("data"); | 90 request.response.write("data"); |
| 91 request.response.write("more data"); | 91 request.response.write("more data"); |
| 92 completer.future.then((_) => server.close()); | 92 completer.future.then((_) => server.close()); |
| 93 }); | 93 }); |
| 94 | 94 |
| 95 var client = new HttpClient(); | 95 var client = new HttpClient(); |
| 96 client.get("127.0.0.1", server.port, "/") | 96 client.get("127.0.0.1", server.port, "/") |
| 97 .then((request) => request.close()) | 97 .then((request) => request.close()) |
| 98 .then((response) { | 98 .then((response) { |
| 99 // Close the (incomplete) response, now we have seen the response object
. | 99 // Close the (incomplete) response, now that we have seen |
| 100 // the response object. |
| 100 completer.complete(null); | 101 completer.complete(null); |
| 101 int errors = 0; | 102 int errors = 0; |
| 102 response.listen( | 103 response.listen( |
| 103 (data) {}, | 104 (data) {}, |
| 104 onError: (error) => errors++, | 105 onError: (error) => errors++, |
| 105 onDone: () { | 106 onDone: () { |
| 106 Expect.equals(1, errors); | 107 Expect.equals(1, errors); |
| 107 asyncEnd(); | 108 asyncEnd(); |
| 108 }); | 109 }); |
| 109 }); | 110 }); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 127 | 128 |
| 128 | 129 |
| 129 void main() { | 130 void main() { |
| 130 testGetEmptyRequest(); | 131 testGetEmptyRequest(); |
| 131 testGetDataRequest(); | 132 testGetDataRequest(); |
| 132 testGetInvalidHost(); | 133 testGetInvalidHost(); |
| 133 testGetServerClose(); | 134 testGetServerClose(); |
| 134 testGetDataServerClose(); | 135 testGetDataServerClose(); |
| 135 testPostEmptyRequest(); | 136 testPostEmptyRequest(); |
| 136 } | 137 } |
| OLD | NEW |