| 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 "dart:isolate"; | 5 import "dart:isolate"; | 
| 6 import "dart:io"; | 6 import "dart:io"; | 
| 7 | 7 | 
| 8 void testNoBody(int totalConnections, bool explicitContentLength) { | 8 void testNoBody(int totalConnections, bool explicitContentLength) { | 
| 9   var errors = 0; | 9   var errors = 0; | 
| 10   HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) { | 10   HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) { | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 123           }) | 123           }) | 
| 124           .then((response) { | 124           .then((response) { | 
| 125             Expect.equals("2", response.headers.value('content-length')); | 125             Expect.equals("2", response.headers.value('content-length')); | 
| 126             Expect.equals(2, response.contentLength); | 126             Expect.equals(2, response.contentLength); | 
| 127             response.listen( | 127             response.listen( | 
| 128                 (d) {}, | 128                 (d) {}, | 
| 129                 onDone: () { | 129                 onDone: () { | 
| 130                   if (++clientCount == totalConnections) { | 130                   if (++clientCount == totalConnections) { | 
| 131                     client.close(); | 131                     client.close(); | 
| 132                   } | 132                   } | 
|  | 133                 }, | 
|  | 134                 onError: (error) { | 
|  | 135                   // Undefined what server response sends. | 
| 133                 }); | 136                 }); | 
| 134           }); | 137           }); | 
| 135     } | 138     } | 
| 136   }); | 139   }); | 
| 137 } | 140 } | 
| 138 | 141 | 
| 139 void testBodyChunked(int totalConnections, bool useHeader) { | 142 void testBodyChunked(int totalConnections, bool useHeader) { | 
| 140   HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) { | 143   HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) { | 
| 141     server.listen( | 144     server.listen( | 
| 142         (HttpRequest request) { | 145         (HttpRequest request) { | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 232 | 235 | 
| 233 void main() { | 236 void main() { | 
| 234   testNoBody(5, false); | 237   testNoBody(5, false); | 
| 235   testNoBody(5, true); | 238   testNoBody(5, true); | 
| 236   testBody(5, false); | 239   testBody(5, false); | 
| 237   testBody(5, true); | 240   testBody(5, true); | 
| 238   testBodyChunked(5, false); | 241   testBodyChunked(5, false); | 
| 239   testBodyChunked(5, true); | 242   testBodyChunked(5, true); | 
| 240   testSetContentLength(); | 243   testSetContentLength(); | 
| 241 } | 244 } | 
| OLD | NEW | 
|---|