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

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

Issue 10382148: Revert "Fix URL decoding in 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
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/input_stream.dart");
6 #source("../../../runtime/bin/output_stream.dart");
7 #source("../../../runtime/bin/chunked_stream.dart");
8 #source("../../../runtime/bin/string_stream.dart");
9 #source("../../../runtime/bin/stream_util.dart");
10 #source("../../../runtime/bin/http.dart");
11 #source("../../../runtime/bin/http_impl.dart");
12 #source("../../../runtime/bin/http_parser.dart");
13 #source("../../../runtime/bin/http_utils.dart"); 5 #source("../../../runtime/bin/http_utils.dart");
14 6
7 class HttpException implements Exception {
8 const HttpException([String this.message = ""]);
9 String toString() => "HttpException: $message";
10 final String message;
11 }
12
15 void testParseHttpDate() { 13 void testParseHttpDate() {
16 TimeZone utc = new TimeZone.utc(); 14 TimeZone utc = new TimeZone.utc();
17 Date date; 15 Date date;
18 date = new Date.withTimeZone(1999, Date.JUN, 11, 18, 46, 53, 0, utc); 16 date = new Date.withTimeZone(1999, Date.JUN, 11, 18, 46, 53, 0, utc);
19 Expect.equals(date, _HttpUtils.parseDate("Fri, 11 Jun 1999 18:46:53 GMT")); 17 Expect.equals(date, _HttpUtils.parseDate("Fri, 11 Jun 1999 18:46:53 GMT"));
20 Expect.equals(date, _HttpUtils.parseDate("Friday, 11-Jun-1999 18:46:53 GMT")); 18 Expect.equals(date, _HttpUtils.parseDate("Friday, 11-Jun-1999 18:46:53 GMT"));
21 Expect.equals(date, _HttpUtils.parseDate("Fri Jun 11 18:46:53 1999")); 19 Expect.equals(date, _HttpUtils.parseDate("Fri Jun 11 18:46:53 1999"));
22 20
23 date = new Date.withTimeZone(1970, Date.JAN, 1, 0, 0, 0, 0, utc); 21 date = new Date.withTimeZone(1970, Date.JAN, 1, 0, 0, 0, 0, utc);
24 Expect.equals(date, _HttpUtils.parseDate("Thu, 1 Jan 1970 00:00:00 GMT")); 22 Expect.equals(date, _HttpUtils.parseDate("Thu, 1 Jan 1970 00:00:00 GMT"));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 Expect.throws(() { 82 Expect.throws(() {
85 _HttpUtils.parseDate("$valid "); 83 _HttpUtils.parseDate("$valid ");
86 }); 84 });
87 } 85 }
88 86
89 void main() { 87 void main() {
90 testParseHttpDate(); 88 testParseHttpDate();
91 testFormatParseHttpDate(); 89 testFormatParseHttpDate();
92 testParseHttpDateFailures(); 90 testParseHttpDateFailures();
93 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698