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

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

Issue 169383003: Make event-handlers edge-triggered and move socket-state to Dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/websocket_impl.dart ('k') | tests/standalone/io/http_response_deadline_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // (c) 2014, 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";
11 import "dart:async"; 11 import "dart:async";
12 import "dart:isolate"; 12 import "dart:isolate";
13 import "dart:io"; 13 import "dart:io";
14 14
15 // Test that a response line without any reason phrase is handled. 15 // Test that a response line without any reason phrase is handled.
16 void missingReasonPhrase(int statusCode, bool includeSpace) { 16 void missingReasonPhrase(int statusCode, bool includeSpace) {
17 var client = new HttpClient(); 17 var client = new HttpClient();
18 ServerSocket.bind("127.0.0.1", 0).then((server) { 18 ServerSocket.bind("127.0.0.1", 0).then((server) {
19 server.listen((client) { 19 server.listen((client) {
20 client.listen(null);
20 if (includeSpace) { 21 if (includeSpace) {
21 client.write("HTTP/1.1 $statusCode \r\n\r\n"); 22 client.write("HTTP/1.1 $statusCode \r\n\r\n");
22 } else { 23 } else {
23 client.write("HTTP/1.1 $statusCode\r\n\r\n"); 24 client.write("HTTP/1.1 $statusCode\r\n\r\n");
24 } 25 }
25 client.close(); 26 client.close();
26 }); 27 });
27 client.getUrl(Uri.parse("http://127.0.0.1:${server.port}/")) 28 client.getUrl(Uri.parse("http://127.0.0.1:${server.port}/"))
28 .then((request) => request.close()) 29 .then((request) => request.close())
29 .then((response) { 30 .then((response) {
30 Expect.equals(statusCode, response.statusCode); 31 Expect.equals(statusCode, response.statusCode);
31 Expect.equals("", response.reasonPhrase); 32 Expect.equals("", response.reasonPhrase);
33 return response.drain();
32 }) 34 })
33 .whenComplete(() => server.close()); 35 .whenComplete(() => server.close());
34 }); 36 });
35 } 37 }
36 38
37 void main() { 39 void main() {
38 missingReasonPhrase(HttpStatus.OK, true); 40 missingReasonPhrase(HttpStatus.OK, true);
39 missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, true); 41 missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, true);
40 missingReasonPhrase(HttpStatus.OK, false); 42 missingReasonPhrase(HttpStatus.OK, false);
41 missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, false); 43 missingReasonPhrase(HttpStatus.INTERNAL_SERVER_ERROR, false);
42 } 44 }
OLDNEW
« no previous file with comments | « sdk/lib/io/websocket_impl.dart ('k') | tests/standalone/io/http_response_deadline_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698