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

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

Issue 246923003: Add HttpClient:put/delete/head/patch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« sdk/lib/io/http_impl.dart ('K') | « sdk/lib/io/http_impl.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) 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 'dart:async'; 10 import 'dart:async';
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 Expect.equals(1, errors); 144 Expect.equals(1, errors);
145 asyncEnd(); 145 asyncEnd();
146 }); 146 });
147 }); 147 });
148 }); 148 });
149 } 149 }
150 150
151 void testPostEmptyRequest() { 151 void testPostEmptyRequest() {
152 HttpServer.bind("127.0.0.1", 0).then((server) { 152 HttpServer.bind("127.0.0.1", 0).then((server) {
153 server.listen((request) { 153 server.listen((request) {
154 Expect.equals('POST', request.method);
154 request.pipe(request.response); 155 request.pipe(request.response);
155 }); 156 });
156 157
157 var client = new HttpClient(); 158 var client = new HttpClient();
158 client.post("127.0.0.1", server.port, "/") 159 client.post("127.0.0.1", server.port, "/")
159 .then((request) => request.close()) 160 .then((request) => request.close())
160 .then((response) { 161 .then((response) {
161 response.listen((data) {}, onDone: server.close); 162 response.listen((data) {}, onDone: server.close);
162 }); 163 });
163 }); 164 });
164 } 165 }
165 166
166 167
168 void testPutEmptyRequest() {
169 HttpServer.bind("127.0.0.1", 0).then((server) {
170 server.listen((request) {
171 Expect.equals('PUT', request.method);
172 request.pipe(request.response);
173 });
174
175 var client = new HttpClient();
176 client.put("127.0.0.1", server.port, "/")
177 .then((request) => request.close())
178 .then((response) {
179 response.listen((data) {}, onDone: server.close);
180 });
181 });
182 }
183
184
185 void testDeleteEmptyRequest() {
186 HttpServer.bind("127.0.0.1", 0).then((server) {
187 server.listen((request) {
188 Expect.equals('DELETE', request.method);
189 request.pipe(request.response);
190 });
191
192 var client = new HttpClient();
193 client.delete("127.0.0.1", server.port, "/")
194 .then((request) => request.close())
195 .then((response) {
196 response.listen((data) {}, onDone: server.close);
197 });
198 });
199 }
Lasse Reichstein Nielsen 2014/04/22 08:49:47 Test putUrl and deleteUrl?
Anders Johnsen 2014/04/22 10:58:36 Done.
200
201
167 void testNoBuffer() { 202 void testNoBuffer() {
168 asyncStart(); 203 asyncStart();
169 HttpServer.bind("127.0.0.1", 0).then((server) { 204 HttpServer.bind("127.0.0.1", 0).then((server) {
170 var response; 205 var response;
171 server.listen((request) { 206 server.listen((request) {
172 response = request.response; 207 response = request.response;
173 response.bufferOutput = false; 208 response.bufferOutput = false;
174 response.writeln('init'); 209 response.writeln('init');
175 }); 210 });
176 211
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 247
213 void main() { 248 void main() {
214 testGetEmptyRequest(); 249 testGetEmptyRequest();
215 testGetDataRequest(); 250 testGetDataRequest();
216 testGetInvalidHost(); 251 testGetInvalidHost();
217 testGetServerClose(); 252 testGetServerClose();
218 testGetServerCloseNoKeepAlive(); 253 testGetServerCloseNoKeepAlive();
219 testGetServerForceClose(); 254 testGetServerForceClose();
220 testGetDataServerForceClose(); 255 testGetDataServerForceClose();
221 testPostEmptyRequest(); 256 testPostEmptyRequest();
257 testPutEmptyRequest();
258 testDeleteEmptyRequest();
222 testNoBuffer(); 259 testNoBuffer();
223 } 260 }
OLDNEW
« sdk/lib/io/http_impl.dart ('K') | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698