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 library dart.io; | 5 library dart.io; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "dart:async"; | 8 import "dart:async"; |
9 import "dart:collection"; | 9 import "dart:collection"; |
10 import "dart:convert"; | 10 import "dart:convert"; |
(...skipping 14 matching lines...) Expand all Loading... |
25 part "../../../sdk/lib/io/http.dart"; | 25 part "../../../sdk/lib/io/http.dart"; |
26 part "../../../sdk/lib/io/http_impl.dart"; | 26 part "../../../sdk/lib/io/http_impl.dart"; |
27 part "../../../sdk/lib/io/http_date.dart"; | 27 part "../../../sdk/lib/io/http_date.dart"; |
28 part "../../../sdk/lib/io/http_parser.dart"; | 28 part "../../../sdk/lib/io/http_parser.dart"; |
29 part "../../../sdk/lib/io/http_headers.dart"; | 29 part "../../../sdk/lib/io/http_headers.dart"; |
30 part "../../../sdk/lib/io/http_session.dart"; | 30 part "../../../sdk/lib/io/http_session.dart"; |
31 part "../../../sdk/lib/io/io_service.dart"; | 31 part "../../../sdk/lib/io/io_service.dart"; |
32 part "../../../sdk/lib/io/io_sink.dart"; | 32 part "../../../sdk/lib/io/io_sink.dart"; |
33 part "../../../sdk/lib/io/platform.dart"; | 33 part "../../../sdk/lib/io/platform.dart"; |
34 part "../../../sdk/lib/io/platform_impl.dart"; | 34 part "../../../sdk/lib/io/platform_impl.dart"; |
| 35 part "../../../sdk/lib/io/service_object.dart"; |
35 part "../../../sdk/lib/io/secure_socket.dart"; | 36 part "../../../sdk/lib/io/secure_socket.dart"; |
36 part "../../../sdk/lib/io/secure_server_socket.dart"; | 37 part "../../../sdk/lib/io/secure_server_socket.dart"; |
37 part "../../../sdk/lib/io/socket.dart"; | 38 part "../../../sdk/lib/io/socket.dart"; |
38 | 39 |
39 void testParseHttpCookieDate() { | 40 void testParseHttpCookieDate() { |
40 Expect.throws(() => HttpDate._parseCookieDate("")); | 41 Expect.throws(() => HttpDate._parseCookieDate("")); |
41 | 42 |
42 test(int year, | 43 test(int year, |
43 int month, | 44 int month, |
44 int day, | 45 int day, |
45 int hours, | 46 int hours, |
46 int minutes, | 47 int minutes, |
47 int seconds, | 48 int seconds, |
48 String formatted) { | 49 String formatted) { |
49 DateTime date = | 50 DateTime date = |
50 new DateTime.utc(year, month, day, hours, minutes, seconds, 0); | 51 new DateTime.utc(year, month, day, hours, minutes, seconds, 0); |
51 Expect.equals(date, HttpDate._parseCookieDate(formatted)); | 52 Expect.equals(date, HttpDate._parseCookieDate(formatted)); |
52 } | 53 } |
53 | 54 |
54 test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt"); | 55 test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt"); |
55 test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT"); | 56 test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT"); |
56 test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT"); | 57 test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT"); |
57 test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT"); | 58 test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT"); |
58 test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT"); | 59 test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT"); |
59 } | 60 } |
60 | 61 |
61 void main() { | 62 void main() { |
62 testParseHttpCookieDate(); | 63 testParseHttpCookieDate(); |
63 } | 64 } |
OLD | NEW |