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

Side by Side Diff: tests/standalone/io/http_detach_socket_test.dart

Issue 36643002: Don't close existing connection on HttpServer close (and stream cancel). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 server.listen((request) { 53 server.listen((request) {
54 var response = request.response; 54 var response = request.response;
55 response.contentLength = 0; 55 response.contentLength = 0;
56 response.close(); 56 response.close();
57 Expect.throws(response.detachSocket); 57 Expect.throws(response.detachSocket);
58 server.close(); 58 server.close();
59 }); 59 });
60 60
61 Socket.connect("127.0.0.1", server.port).then((socket) { 61 Socket.connect("127.0.0.1", server.port).then((socket) {
62 socket.write("GET / HTTP/1.1\r\n" 62 socket.write("GET / HTTP/1.1\r\n"
63 "Connection: Close\r\n"
63 "content-length: 0\r\n\r\n"); 64 "content-length: 0\r\n\r\n");
64 socket.listen((_) {}, onDone: () { 65 socket.listen((_) {}, onDone: () {
65 socket.close(); 66 socket.close();
66 }); 67 });
67 }); 68 });
68 }); 69 });
69 } 70 }
70 71
71 void testClientDetachSocket() { 72 void testClientDetachSocket() {
72 ServerSocket.bind("127.0.0.1", 0).then((server) { 73 ServerSocket.bind("127.0.0.1", 0).then((server) {
73 server.listen((socket) { 74 server.listen((socket) {
74 socket.write("HTTP/1.1 200 OK\r\n" 75 socket.write("HTTP/1.1 200 OK\r\n"
75 "\r\n" 76 "\r\n"
76 "Test!"); 77 "Test!");
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 }); 112 });
112 }); 113 });
113 }); 114 });
114 } 115 }
115 116
116 void main() { 117 void main() {
117 testServerDetachSocket(); 118 testServerDetachSocket();
118 testBadServerDetachSocket(); 119 testBadServerDetachSocket();
119 testClientDetachSocket(); 120 testClientDetachSocket();
120 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698