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

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

Issue 10386024: Add redirect support to the HTTP client (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 7 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 | « tests/standalone/io/http_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 5
6 #import("dart:io"); 6 #import("dart:io");
7 7
8 void testRequestResponseClientCloses( 8 void testRequestResponseClientCloses(
9 int totalConnections, int closeStatus, String closeReason) { 9 int totalConnections, int closeStatus, String closeReason) {
10 HttpServer server = new HttpServer(); 10 HttpServer server = new HttpServer();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 server.listen("127.0.0.1", 0, 5); 108 server.listen("127.0.0.1", 0, 5);
109 109
110 // Create a server which always responds with a redirect. 110 // Create a server which always responds with a redirect.
111 server.defaultRequestHandler = (request, response) { 111 server.defaultRequestHandler = (request, response) {
112 response.statusCode = HttpStatus.MOVED_PERMANENTLY; 112 response.statusCode = HttpStatus.MOVED_PERMANENTLY;
113 response.outputStream.close(); 113 response.outputStream.close();
114 }; 114 };
115 115
116 HttpClientConnection conn = client.get("127.0.0.1", server.port, "/"); 116 HttpClientConnection conn = client.get("127.0.0.1", server.port, "/");
117 conn.followRedirects = false;
117 WebSocketClientConnection wsconn = new WebSocketClientConnection(conn); 118 WebSocketClientConnection wsconn = new WebSocketClientConnection(conn);
118 wsconn.onNoUpgrade = (response) { 119 wsconn.onNoUpgrade = (response) {
119 Expect.equals(HttpStatus.MOVED_PERMANENTLY, response.statusCode); 120 Expect.equals(HttpStatus.MOVED_PERMANENTLY, response.statusCode);
120 client.shutdown(); 121 client.shutdown();
121 server.close(); 122 server.close();
122 }; 123 };
123 } 124 }
124 125
125 void testUsePOST() { 126 void testUsePOST() {
126 HttpServer server = new HttpServer(); 127 HttpServer server = new HttpServer();
(...skipping 22 matching lines...) Expand all
149 main() { 150 main() {
150 testRequestResponseClientCloses(2, null, null); 151 testRequestResponseClientCloses(2, null, null);
151 testRequestResponseClientCloses(2, 3001, null); 152 testRequestResponseClientCloses(2, 3001, null);
152 testRequestResponseClientCloses(2, 3002, "Got tired"); 153 testRequestResponseClientCloses(2, 3002, "Got tired");
153 testRequestResponseServerCloses(2, null, null); 154 testRequestResponseServerCloses(2, null, null);
154 testRequestResponseServerCloses(2, 3001, null); 155 testRequestResponseServerCloses(2, 3001, null);
155 testRequestResponseServerCloses(2, 3002, "Got tired"); 156 testRequestResponseServerCloses(2, 3002, "Got tired");
156 testNoUpgrade(); 157 testNoUpgrade();
157 testUsePOST(); 158 testUsePOST();
158 } 159 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698