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

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

Issue 11301034: Add flush to HTTP output streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | « runtime/bin/http_impl.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_advanced_test.dart
diff --git a/tests/standalone/io/http_advanced_test.dart b/tests/standalone/io/http_advanced_test.dart
index 77e36fa916283f9c8403df12e82cd0654c346821..a37d025c57fd426d05154fd2ef08319074d09d5c 100644
--- a/tests/standalone/io/http_advanced_test.dart
+++ b/tests/standalone/io/http_advanced_test.dart
@@ -178,6 +178,11 @@ class TestServer {
response.outputStream.close();
}
+ void _flushHandler(HttpRequest request, HttpResponse response) {
+ response.outputStream.flush();
+ response.outputStream.close();
+ }
+
void init() {
// Setup request handlers.
_requestHandlers = new Map();
@@ -209,6 +214,10 @@ class TestServer {
(HttpRequest request, HttpResponse response) {
_cookie2Handler(request, response);
};
+ _requestHandlers["/flush"] =
+ (HttpRequest request, HttpResponse response) {
+ _flushHandler(request, response);
+ };
}
void dispatch(message, replyTo) {
@@ -405,9 +414,29 @@ void testCookies() {
testServerMain.start();
}
+void testFlush() {
+ TestServerMain testServerMain = new TestServerMain();
+ testServerMain.setServerStartedHandler((int port) {
+ HttpClient httpClient = new HttpClient();
+
+ HttpClientConnection conn = httpClient.get("127.0.0.1", port, "/flush");
+ conn.onRequest = (HttpClientRequest request) {
+ request.outputStream.flush();
+ request.outputStream.close();
+ };
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.equals(HttpStatus.OK, response.statusCode);
+ httpClient.shutdown();
+ testServerMain.shutdown();
+ };
+ });
+ testServerMain.start();
+}
+
void main() {
testHost();
testExpires();
testContentType();
testCookies();
+ testFlush();
}
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698