| OLD | NEW |
| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:async"; | 6 import "dart:async"; |
| 7 import "dart:math"; | 7 import "dart:math"; |
| 8 import "dart:collection"; | 8 import "dart:collection"; |
| 9 | 9 |
| 10 part "../../../sdk/lib/io/common.dart"; | 10 part "../../../sdk/lib/io/common.dart"; |
| 11 part "../../../sdk/lib/io/io_sink.dart"; | 11 part "../../../sdk/lib/io/io_sink.dart"; |
| 12 part "../../../sdk/lib/io/http.dart"; | 12 part "../../../sdk/lib/io/http.dart"; |
| 13 part "../../../sdk/lib/io/http_impl.dart"; | 13 part "../../../sdk/lib/io/http_impl.dart"; |
| 14 part "../../../sdk/lib/io/http_parser.dart"; | 14 part "../../../sdk/lib/io/http_parser.dart"; |
| 15 part "../../../sdk/lib/io/http_utils.dart"; | 15 part "../../../sdk/lib/io/http_date.dart"; |
| 16 part "../../../sdk/lib/io/socket.dart"; | 16 part "../../../sdk/lib/io/socket.dart"; |
| 17 | 17 |
| 18 void testParseHttpCookieDate() { | 18 void testParseHttpCookieDate() { |
| 19 Expect.throws(() => _HttpUtils.parseCookieDate("")); | 19 Expect.throws(() => HttpDate._parseCookieDate("")); |
| 20 | 20 |
| 21 test(int year, | 21 test(int year, |
| 22 int month, | 22 int month, |
| 23 int day, | 23 int day, |
| 24 int hours, | 24 int hours, |
| 25 int minutes, | 25 int minutes, |
| 26 int seconds, | 26 int seconds, |
| 27 String formatted) { | 27 String formatted) { |
| 28 DateTime date = new DateTime.utc(year, month, day, hours, minutes, seconds,
0); | 28 DateTime date = new DateTime.utc(year, month, day, hours, minutes, seconds,
0); |
| 29 Expect.equals(date, _HttpUtils.parseCookieDate(formatted)); | 29 Expect.equals(date, HttpDate._parseCookieDate(formatted)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt"); | 32 test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt"); |
| 33 test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT"); | 33 test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT"); |
| 34 test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT"); | 34 test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT"); |
| 35 test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT"); | 35 test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT"); |
| 36 test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT"); | 36 test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT"); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void main() { | 39 void main() { |
| 40 testParseHttpCookieDate(); | 40 testParseHttpCookieDate(); |
| 41 } | 41 } |
| OLD | NEW |