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

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

Issue 228453002: Add bufferOutput to HttpServer, HttpResponse and HttpClientRequest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review fixes. Created 6 years, 8 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 | « sdk/lib/io/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_client_connect_test.dart
diff --git a/tests/standalone/io/http_client_connect_test.dart b/tests/standalone/io/http_client_connect_test.dart
index 58835f49abe2efe18bb2b22890b69828747c7816..b6b8e37c4c38b7b56c3344582e90a2dd930d7750 100644
--- a/tests/standalone/io/http_client_connect_test.dart
+++ b/tests/standalone/io/http_client_connect_test.dart
@@ -8,6 +8,7 @@
// VMOptions=--short_socket_read --short_socket_write
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
import "package:async_helper/async_helper.dart";
@@ -121,6 +122,7 @@ void testGetDataServerForceClose() {
var completer = new Completer();
HttpServer.bind("127.0.0.1", 0).then((server) {
server.listen((request) {
+ request.response.bufferOutput = false;
request.response.contentLength = 100;
request.response.write("data");
request.response.write("more data");
@@ -162,6 +164,52 @@ void testPostEmptyRequest() {
}
+void testNoBuffer() {
+ asyncStart();
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ var response;
+ server.listen((request) {
+ response = request.response;
+ response.bufferOutput = false;
+ response.writeln('init');
+ });
+
+ var client = new HttpClient();
+ client.get("127.0.0.1", server.port, "/")
+ .then((request) => request.close())
+ .then((clientResponse) {
+ var iterator = new StreamIterator(
+ clientResponse.transform(UTF8.decoder)
+ .transform(new LineSplitter()));
+ iterator.moveNext().then((hasValue) {
+ Expect.isTrue(hasValue);
+ Expect.equals('init', iterator.current);
+ int count = 0;
+ void run() {
+ if (count == 10) {
+ response.close();
+ iterator.moveNext().then((hasValue) {
+ Expect.isFalse(hasValue);
+ server.close();
+ asyncEnd();
+ });
+ } else {
+ response.writeln('output$count');
Søren Gjesse 2014/04/08 13:03:24 He he the client writes to the response.
Anders Johnsen 2014/04/08 13:07:00 The server response, yeah.
+ iterator.moveNext().then((hasValue) {
+ Expect.isTrue(hasValue);
+ Expect.equals('output$count', iterator.current);
+ count++;
+ run();
+ });
+ }
+ }
+ run();
+ });
+ });
+ });
+}
+
+
void main() {
testGetEmptyRequest();
testGetDataRequest();
@@ -169,7 +217,7 @@ void main() {
testGetServerClose();
testGetServerCloseNoKeepAlive();
testGetServerForceClose();
- // TODO(14953): This test can only run, when buffering is disabled.
- // testGetDataServerForceClose();
+ testGetDataServerForceClose();
testPostEmptyRequest();
+ testNoBuffer();
}
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698