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

Unified 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: Review update. 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/http_utils.dart ('K') | « runtime/bin/http_utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_date_test.dart
diff --git a/tests/standalone/io/http_date_test.dart b/tests/standalone/io/http_date_test.dart
index 9b8be0a8453c9c9e324ea2ec0c83de659ccb0e1e..a2b23a01e5a9fe22860c1a64056629c2cc022aa3 100644
--- a/tests/standalone/io/http_date_test.dart
+++ b/tests/standalone/io/http_date_test.dart
@@ -85,8 +85,31 @@ void testParseHttpDateFailures() {
});
}
+void testParseHttpCookieDate() {
+ Expect.throws(() => _HttpUtils.parseCookieDate(""));
+
+ test(int year,
+ int month,
+ int day,
+ int hours,
+ int minutes,
+ int seconds,
+ String formatted) {
+ Date date = new Date(
+ year, month, day, hours, minutes, seconds, 0, isUtc: true);
+ Expect.equals(date, _HttpUtils.parseCookieDate(formatted));
+ }
+
+ test(2012, Date.JUN, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt");
+ test(2021, Date.JUN, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT");
+ test(2021, Date.JAN, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT");
+ test(2013, Date.JAN, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT");
+ test(1970, Date.JAN, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT");
+}
+
void main() {
testParseHttpDate();
testFormatParseHttpDate();
testParseHttpDateFailures();
+ testParseHttpCookieDate();
}
« 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