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

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

Issue 262433003: Add writeHeaders argument to HttpResponse::detachSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix comment. 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_detach_socket_test.dart
diff --git a/tests/standalone/io/http_detach_socket_test.dart b/tests/standalone/io/http_detach_socket_test.dart
index 3946017c40f0299cf7c1e5c538935128ae300050..e5669d659b0bafb0b1e4956d517a81a2764c2eed 100644
--- a/tests/standalone/io/http_detach_socket_test.dart
+++ b/tests/standalone/io/http_detach_socket_test.dart
@@ -48,6 +48,38 @@ void testServerDetachSocket() {
});
}
+void testServerDetachSocketNoWriteHeaders() {
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ server.listen((request) {
+ var response = request.response;
+ response.contentLength = 0;
+ response.detachSocket(writeHeaders: false).then((socket) {
+ Expect.isNotNull(socket);
+ var body = new StringBuffer();
+ socket.listen(
+ (data) => body.write(new String.fromCharCodes(data)),
+ onDone: () => Expect.equals("Some data", body.toString()));
+ socket.write("Test!");
+ socket.close();
+ });
+ server.close();
+ });
+
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ socket.write("GET / HTTP/1.1\r\n"
+ "content-length: 0\r\n\r\n"
+ "Some data");
+ var body = new StringBuffer();
+ socket.listen(
+ (data) => body.write(new String.fromCharCodes(data)),
+ onDone: () {
+ Expect.equals("Test!",body.toString());
+ socket.close();
+ });
+ });
+ });
+}
+
void testBadServerDetachSocket() {
HttpServer.bind("127.0.0.1", 0).then((server) {
server.listen((request) {
@@ -115,6 +147,7 @@ void testClientDetachSocket() {
void main() {
testServerDetachSocket();
+ testServerDetachSocketNoWriteHeaders();
testBadServerDetachSocket();
testClientDetachSocket();
}
« 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