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

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

Issue 10909057: Use correct cookie date parsing for cookie 'expires' field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« runtime/bin/http_utils.dart ('K') | « runtime/bin/http_utils.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 #import("dart:math"); 5 #import("dart:math");
6 6
7 #source("../../../runtime/bin/input_stream.dart"); 7 #source("../../../runtime/bin/input_stream.dart");
8 #source("../../../runtime/bin/output_stream.dart"); 8 #source("../../../runtime/bin/output_stream.dart");
9 #source("../../../runtime/bin/chunked_stream.dart"); 9 #source("../../../runtime/bin/chunked_stream.dart");
10 #source("../../../runtime/bin/string_stream.dart"); 10 #source("../../../runtime/bin/string_stream.dart");
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 _HttpUtils.parseDate(" $valid"); 78 _HttpUtils.parseDate(" $valid");
79 }); 79 });
80 Expect.throws(() { 80 Expect.throws(() {
81 _HttpUtils.parseDate(" $valid "); 81 _HttpUtils.parseDate(" $valid ");
82 }); 82 });
83 Expect.throws(() { 83 Expect.throws(() {
84 _HttpUtils.parseDate("$valid "); 84 _HttpUtils.parseDate("$valid ");
85 }); 85 });
86 } 86 }
87 87
88 void testParseHttpCookieDate() {
89 Expect.throws(() => _HttpUtils.parseCookieDate(""));
90
91 test(int year,
92 int month,
93 int day,
94 int hours,
95 int minutes,
96 int seconds,
97 String formatted) {
98 Date date = new Date(year, month, day, hours, minutes, seconds, 0, isUtc: tr ue);
Søren Gjesse 2012/09/04 06:51:57 Long line.
Anders Johnsen 2012/09/04 07:03:13 Done.
99 Expect.equals(date, _HttpUtils.parseCookieDate(formatted));
100 }
101
102 test(2012, Date.JUN, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt");
103 test(2021, Date.JUN, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT");
104 test(2021, Date.JAN, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT");
105 test(2013, Date.JAN, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT");
106 test(1970, Date.JAN, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT");
107 }
108
88 void main() { 109 void main() {
89 testParseHttpDate(); 110 testParseHttpDate();
90 testFormatParseHttpDate(); 111 testFormatParseHttpDate();
91 testParseHttpDateFailures(); 112 testParseHttpDateFailures();
113 testParseHttpCookieDate();
92 } 114 }
OLDNEW
« runtime/bin/http_utils.dart ('K') | « runtime/bin/http_utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698