Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: tests/standalone/io/http_content_length_test.dart

Issue 12385041: Don't close the server until we have received the error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_content_length_test.dart
diff --git a/tests/standalone/io/http_content_length_test.dart b/tests/standalone/io/http_content_length_test.dart
index 61156827e3a4962b6fc1bbda55a31b49248851d2..d79412f5179f11568d18a61051d22c431da03159 100644
--- a/tests/standalone/io/http_content_length_test.dart
+++ b/tests/standalone/io/http_content_length_test.dart
@@ -68,6 +68,7 @@ void testNoBody(int totalConnections, bool explicitContentLength) {
void testBody(int totalConnections, bool useHeader) {
HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) {
+ int serverCount = 0;
server.listen(
(HttpRequest request) {
Expect.equals("2", request.headers.value('content-length'));
@@ -91,7 +92,10 @@ void testBody(int totalConnections, bool useHeader) {
Expect.fail("Unexpected successful response completion");
})
.catchError((e) {
- Expect.isTrue(e.error is HttpException, "[$e] [${e.error}]");
+ Expect.isTrue(e.error is HttpException, "[$e]");
+ if (++serverCount == totalConnections) {
+ server.close();
+ }
});
response.close();
Expect.throws(() => response.addString("x"),
@@ -100,7 +104,7 @@ void testBody(int totalConnections, bool useHeader) {
},
onError: (e) => Expect.fail("Unexpected error $e"));
- int count = 0;
+ int clientCount = 0;
HttpClient client = new HttpClient();
for (int i = 0; i < totalConnections; i++) {
client.get("127.0.0.1", server.port, "/")
@@ -123,9 +127,8 @@ void testBody(int totalConnections, bool useHeader) {
response.listen(
(d) {},
onDone: () {
- if (++count == totalConnections) {
+ if (++clientCount == totalConnections) {
client.close();
- server.close();
}
});
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698