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

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

Issue 10449020: Support using the HEAD request in the HTTP library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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_head_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 #source("../../../runtime/bin/http_parser.dart"); 5 #source("../../../runtime/bin/http_parser.dart");
6 6
7 class HttpParserTest { 7 class HttpParserTest {
8 static void runAllTests() { 8 static void runAllTests() {
9 testParseRequest(); 9 testParseRequest();
10 testParseResponse(); 10 testParseResponse();
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // different chunks. 290 // different chunks.
291 List<int> responseData = response.charCodes(); 291 List<int> responseData = response.charCodes();
292 testWrite(responseData); 292 testWrite(responseData);
293 testWrite(responseData, 10); 293 testWrite(responseData, 10);
294 testWrite(responseData, 1); 294 testWrite(responseData, 1);
295 } 295 }
296 296
297 static void testParseRequest() { 297 static void testParseRequest() {
298 String request; 298 String request;
299 Map headers; 299 Map headers;
300 request = "GET / HTTP/1.1\r\n\r\n"; 300 var methods = [
301 _testParseRequest(request, "GET", "/"); 301 // RFC 2616 methods.
302 302 "OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT",
303 request = "POST / HTTP/1.1\r\n\r\n"; 303 // WebDAV methods from RFC 4918.
304 _testParseRequest(request, "POST", "/"); 304 "PROPFIND", "PROPPATCH", "MKCOL", "COPY", "MOVE", "LOCK", "UNLOCK",
305 305 // WebDAV methods from RFC 5323.
306 request = "GET /index.html HTTP/1.1\r\n\r\n"; 306 "SEARCH",
307 _testParseRequest(request, "GET", "/index.html"); 307 // Methods with HTTP prefix.
308 308 "H", "HT", "HTT", "HTTP", "HX", "HTX", "HTTX", "HTTPX"];
309 request = "POST /index.html HTTP/1.1\r\n\r\n"; 309 methods.forEach((method) {
310 _testParseRequest(request, "POST", "/index.html"); 310 request = "$method / HTTP/1.1\r\n\r\n";
311 311 _testParseRequest(request, method, "/");
312 request = "H /index.html HTTP/1.1\r\n\r\n"; 312 request = "$method /index.html HTTP/1.1\r\n\r\n";
313 _testParseRequest(request, "H", "/index.html"); 313 _testParseRequest(request, method, "/index.html");
314 314 });
315 request = "HT /index.html HTTP/1.1\r\n\r\n";
316 _testParseRequest(request, "HT", "/index.html");
317
318 request = "HTT /index.html HTTP/1.1\r\n\r\n";
319 _testParseRequest(request, "HTT", "/index.html");
320
321 request = "HTTP /index.html HTTP/1.1\r\n\r\n";
322 _testParseRequest(request, "HTTP", "/index.html");
323 315
324 request = "GET / HTTP/1.0\r\n\r\n"; 316 request = "GET / HTTP/1.0\r\n\r\n";
325 _testParseRequest(request, "GET", "/", expectedVersion: "1.0", connectionClo se: true); 317 _testParseRequest(request, "GET", "/", expectedVersion: "1.0", connectionClo se: true);
326 318
327 request = "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n"; 319 request = "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
328 _testParseRequest(request, "GET", "/", expectedVersion: "1.0"); 320 _testParseRequest(request, "GET", "/", expectedVersion: "1.0");
329 321
330 request = """ 322 request = """
331 POST /test HTTP/1.1\r 323 POST /test HTTP/1.1\r
332 AAA: AAA\r 324 AAA: AAA\r
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 0123456789012345678901234567890\r 834 0123456789012345678901234567890\r
843 0\r\n\r\n"""; 835 0\r\n\r\n""";
844 _testParseInvalidResponse(response); 836 _testParseInvalidResponse(response);
845 } 837 }
846 } 838 }
847 839
848 840
849 void main() { 841 void main() {
850 HttpParserTest.runAllTests(); 842 HttpParserTest.runAllTests();
851 } 843 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_head_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698