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

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

Issue 11316080: Change the HTTP close handling (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
« sdk/lib/io/http_parser.dart ('K') | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_connection_close_test.dart
diff --git a/tests/standalone/io/http_connection_close_test.dart b/tests/standalone/io/http_connection_close_test.dart
index ac6cedd4be516f96bf7d6fb0210f6ebc682694b5..604a9639203da4616d46b985d1884a0c551a989b 100644
--- a/tests/standalone/io/http_connection_close_test.dart
+++ b/tests/standalone/io/http_connection_close_test.dart
@@ -5,6 +5,7 @@
#import("dart:isolate");
#import("dart:io");
+#import("dart:uri");
void testHttp10Close(bool closeRequest) {
HttpServer server = new HttpServer();
@@ -41,9 +42,41 @@ void testHttp11Close(bool closeRequest) {
};
}
+void testStreamResponse() {
+ var server = new HttpServer();
+ server.listen("127.0.0.1", 0, backlog: 5);
+ server.defaultRequestHandler = (var request, var response) {
+ new Timer.repeating(10, (x) {
+ Date now = new Date.now();
+ try {
+ response.outputStream.writeString(
+ 'data:${now.millisecondsSinceEpoch}\n\n');
+ } catch (e) {
+ x.cancel();
+ server.close();
+ }
+ });
+ };
+
+ var client = new HttpClient();
+ var connection =
+ client.getUrl(new Uri.fromString("http://127.0.0.1:${server.port}"));
+ connection.onResponse = (resp) {
+ int bytes = 0;
+ resp.inputStream.onData = () {
+ bytes += resp.inputStream.read().length;
+ //print(bytes);
Mads Ager (google) 2012/11/20 08:04:28 Remove?
Søren Gjesse 2012/11/20 08:15:11 Done.
+ if (bytes > 100) {
+ client.shutdown();
+ }
+ };
+ };
+}
+
main() {
testHttp10Close(false);
testHttp10Close(true);
testHttp11Close(false);
testHttp11Close(true);
+ testStreamResponse();
}
« sdk/lib/io/http_parser.dart ('K') | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698