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

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

Issue 11727008: Fix badly written test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « 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 76bd0d9bc6b30a586effad5ae7db2dd1b619dbc2..8cfe93441a4b1cd7d1a727c89dcebf4786d08557 100644
--- a/tests/standalone/io/http_content_length_test.dart
+++ b/tests/standalone/io/http_content_length_test.dart
@@ -59,13 +59,16 @@ void testBody(int totalConnections, bool useHeader) {
} else {
response.headers.set("content-length", 2);
}
- OutputStream stream = response.outputStream;
- stream.writeString("x");
- Expect.throws(() => response.contentLength = 3, (e) => e is HttpException);
- stream.writeString("x");
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- stream.close();
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
+ request.inputStream.onData = request.inputStream.read;
+ request.inputStream.onClosed = () {
+ OutputStream stream = response.outputStream;
+ stream.writeString("x");
+ Expect.throws(() => response.contentLength = 3, (e) => e is HttpException);
Mads Ager (google) 2013/01/02 13:26:43 Long line.
+ stream.writeString("x");
+ Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
+ stream.close();
+ Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
+ };
};
int count = 0;
@@ -116,14 +119,17 @@ void testBodyChunked(int totalConnections, bool useHeader) {
response.headers.set("content-length", 2);
response.headers.set("transfer-encoding", "chunked");
}
- OutputStream stream = response.outputStream;
- stream.writeString("x");
- Expect.throws(() => response.headers.chunkedTransferEncoding = false,
- (e) => e is HttpException);
- stream.writeString("x");
- stream.writeString("x");
- stream.close();
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
+ request.inputStream.onData = request.inputStream.read;
+ request.inputStream.onClosed = () {
+ OutputStream stream = response.outputStream;
+ stream.writeString("x");
+ Expect.throws(() => response.headers.chunkedTransferEncoding = false,
+ (e) => e is HttpException);
+ stream.writeString("x");
+ stream.writeString("x");
+ stream.close();
+ Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
+ };
};
int count = 0;
@@ -193,10 +199,7 @@ void main() {
testNoBody(5, true);
testBody(5, false);
testBody(5, true);
- // These tests can fail or timeout on Windows, issue 7562.
- if (Platform.operatingSystem != 'windows') {
- testBodyChunked(5, false);
- testBodyChunked(5, true);
- }
+ testBodyChunked(5, false);
+ testBodyChunked(5, true);
testHttp10();
}
« 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