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

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

Issue 11744017: Reapply change to enable a couple of tests that were not run because they were named incorrectly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix http_headers_state_test Created 7 years, 12 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 | « tests/standalone/io/http_headers_state.dart ('k') | tests/standalone/io/regress-1925.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_headers_state_test.dart
diff --git a/tests/standalone/io/http_headers_state.dart b/tests/standalone/io/http_headers_state_test.dart
similarity index 71%
rename from tests/standalone/io/http_headers_state.dart
rename to tests/standalone/io/http_headers_state_test.dart
index 7b8c81c1620dcf7e4e0d3df062d82f08bbc7d471..72e1ddd649e9bbdba7a6a29fe79480a1df8e020a 100644
--- a/tests/standalone/io/http_headers_state.dart
+++ b/tests/standalone/io/http_headers_state_test.dart
@@ -15,19 +15,22 @@ void test(int totalConnections, [String body]) {
Expect.throws(() => request.headers.add("X-Request-Header", "value"),
(e) => e is HttpException);
Expect.equals("value", request.headers.value("X-Request-Header"));
- OutputStream stream = response.outputStream;
- // Can still mutate response headers as long as no data has been sent.
- response.headers.add("X-Response-Header", "value");
- if (body != null) {
- stream.writeString(body);
+ request.inputStream.onData = request.inputStream.read;
+ request.inputStream.onClosed = () {
+ OutputStream stream = response.outputStream;
+ // Can still mutate response headers as long as no data has been sent.
+ response.headers.add("X-Response-Header", "value");
+ if (body != null) {
+ stream.writeString(body);
+ // Cannot mutate response headers when data has been sent.
+ Expect.throws(() => request.headers.add("X-Request-Header", "value2"),
+ (e) => e is HttpException);
+ }
+ stream.close();
// Cannot mutate response headers when data has been sent.
- Expect.throws(() => request.headers.add("X-Request-Header", "value2"),
+ Expect.throws(() => request.headers.add("X-Request-Header", "value3"),
(e) => e is HttpException);
- }
- stream.close();
- // Cannot mutate response headers when data has been sent.
- Expect.throws(() => request.headers.add("X-Request-Header", "value3"),
- (e) => e is HttpException);
+ };
};
int count = 0;
@@ -58,11 +61,15 @@ void test(int totalConnections, [String body]) {
Expect.throws(() => response.headers.add("X-Response-Header", "value"),
(e) => e is HttpException);
Expect.equals("value", response.headers.value("X-Response-Header"));
- count++;
- if (count == totalConnections) {
- client.shutdown();
- server.close();
- }
+ response.inputStream.onData = response.inputStream.read;
+ response.inputStream.onClosed = () {
+ // Do not close the connections before we have read the full response
+ // bodies for all connections.
+ if (++count == totalConnections) {
+ client.shutdown();
+ server.close();
+ }
+ };
};
}
}
« no previous file with comments | « tests/standalone/io/http_headers_state.dart ('k') | tests/standalone/io/regress-1925.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698