| 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 #source("../../../runtime/bin/input_stream.dart"); | 5 #source("../../../runtime/bin/input_stream.dart"); |
| 6 #source("../../../runtime/bin/output_stream.dart"); | 6 #source("../../../runtime/bin/output_stream.dart"); |
| 7 #source("../../../runtime/bin/chunked_stream.dart"); | 7 #source("../../../runtime/bin/chunked_stream.dart"); |
| 8 #source("../../../runtime/bin/string_stream.dart"); | 8 #source("../../../runtime/bin/string_stream.dart"); |
| 9 #source("../../../runtime/bin/stream_util.dart"); | 9 #source("../../../runtime/bin/stream_util.dart"); |
| 10 #source("../../../runtime/bin/http.dart"); | 10 #source("../../../runtime/bin/http.dart"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 Expect.equals(1, headers[HttpHeaders.PRAGMA].length); | 43 Expect.equals(1, headers[HttpHeaders.PRAGMA].length); |
| 44 | 44 |
| 45 headers.set(HttpHeaders.PRAGMA, ["pragma6", "pragma7"]); | 45 headers.set(HttpHeaders.PRAGMA, ["pragma6", "pragma7"]); |
| 46 Expect.equals(2, headers[HttpHeaders.PRAGMA].length); | 46 Expect.equals(2, headers[HttpHeaders.PRAGMA].length); |
| 47 | 47 |
| 48 headers.removeAll(HttpHeaders.PRAGMA); | 48 headers.removeAll(HttpHeaders.PRAGMA); |
| 49 Expect.isNull(headers[HttpHeaders.PRAGMA]); | 49 Expect.isNull(headers[HttpHeaders.PRAGMA]); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void testDate() { | 52 void testDate() { |
| 53 Date date1 = new Date.withTimeZone( | 53 Date date1 = new Date(1999, Date.JUN, 11, 18, 46, 53, 0, isUtc: true); |
| 54 1999, Date.JUN, 11, 18, 46, 53, 0, new TimeZone.utc()); | |
| 55 String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT"; | 54 String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT"; |
| 56 Date date2 = new Date.withTimeZone( | 55 Date date2 = new Date(2000, Date.AUG, 16, 12, 34, 56, 0, isUtc: true); |
| 57 2000, Date.AUG, 16, 12, 34, 56, 0, new TimeZone.utc()); | |
| 58 String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT"; | 56 String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT"; |
| 59 | 57 |
| 60 _HttpHeaders headers = new _HttpHeaders(); | 58 _HttpHeaders headers = new _HttpHeaders(); |
| 61 Expect.isNull(headers.date); | 59 Expect.isNull(headers.date); |
| 62 headers.date = date1; | 60 headers.date = date1; |
| 63 Expect.equals(date1, headers.date); | 61 Expect.equals(date1, headers.date); |
| 64 Expect.equals(httpDate1, headers.value(HttpHeaders.DATE)); | 62 Expect.equals(httpDate1, headers.value(HttpHeaders.DATE)); |
| 65 Expect.equals(1, headers[HttpHeaders.DATE].length); | 63 Expect.equals(1, headers[HttpHeaders.DATE].length); |
| 66 headers.add(HttpHeaders.DATE, httpDate2); | 64 headers.add(HttpHeaders.DATE, httpDate2); |
| 67 Expect.equals(1, headers[HttpHeaders.DATE].length); | 65 Expect.equals(1, headers[HttpHeaders.DATE].length); |
| 68 Expect.equals(date2, headers.date); | 66 Expect.equals(date2, headers.date); |
| 69 Expect.equals(httpDate2, headers.value(HttpHeaders.DATE)); | 67 Expect.equals(httpDate2, headers.value(HttpHeaders.DATE)); |
| 70 headers.set(HttpHeaders.DATE, httpDate1); | 68 headers.set(HttpHeaders.DATE, httpDate1); |
| 71 Expect.equals(1, headers[HttpHeaders.DATE].length); | 69 Expect.equals(1, headers[HttpHeaders.DATE].length); |
| 72 Expect.equals(date1, headers.date); | 70 Expect.equals(date1, headers.date); |
| 73 Expect.equals(httpDate1, headers.value(HttpHeaders.DATE)); | 71 Expect.equals(httpDate1, headers.value(HttpHeaders.DATE)); |
| 74 | 72 |
| 75 headers.set(HttpHeaders.DATE, "xxx"); | 73 headers.set(HttpHeaders.DATE, "xxx"); |
| 76 Expect.equals("xxx", headers.value(HttpHeaders.DATE)); | 74 Expect.equals("xxx", headers.value(HttpHeaders.DATE)); |
| 77 Expect.equals(null, headers.date); | 75 Expect.equals(null, headers.date); |
| 78 } | 76 } |
| 79 | 77 |
| 80 void testExpires() { | 78 void testExpires() { |
| 81 Date date1 = new Date.withTimeZone( | 79 Date date1 = new Date(1999, Date.JUN, 11, 18, 46, 53, 0, isUtc: true); |
| 82 1999, Date.JUN, 11, 18, 46, 53, 0, new TimeZone.utc()); | |
| 83 String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT"; | 80 String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT"; |
| 84 Date date2 = new Date.withTimeZone( | 81 Date date2 = new Date(2000, Date.AUG, 16, 12, 34, 56, 0, isUtc: true); |
| 85 2000, Date.AUG, 16, 12, 34, 56, 0, new TimeZone.utc()); | |
| 86 String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT"; | 82 String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT"; |
| 87 | 83 |
| 88 _HttpHeaders headers = new _HttpHeaders(); | 84 _HttpHeaders headers = new _HttpHeaders(); |
| 89 Expect.isNull(headers.expires); | 85 Expect.isNull(headers.expires); |
| 90 headers.expires = date1; | 86 headers.expires = date1; |
| 91 Expect.equals(date1, headers.expires); | 87 Expect.equals(date1, headers.expires); |
| 92 Expect.equals(httpDate1, headers.value(HttpHeaders.EXPIRES)); | 88 Expect.equals(httpDate1, headers.value(HttpHeaders.EXPIRES)); |
| 93 Expect.equals(1, headers[HttpHeaders.EXPIRES].length); | 89 Expect.equals(1, headers[HttpHeaders.EXPIRES].length); |
| 94 headers.add(HttpHeaders.EXPIRES, httpDate2); | 90 headers.add(HttpHeaders.EXPIRES, httpDate2); |
| 95 Expect.equals(1, headers[HttpHeaders.EXPIRES].length); | 91 Expect.equals(1, headers[HttpHeaders.EXPIRES].length); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 274 |
| 279 main() { | 275 main() { |
| 280 testMultiValue(); | 276 testMultiValue(); |
| 281 testExpires(); | 277 testExpires(); |
| 282 testHost(); | 278 testHost(); |
| 283 testEnumeration(); | 279 testEnumeration(); |
| 284 testHeaderValue(); | 280 testHeaderValue(); |
| 285 testContentType(); | 281 testContentType(); |
| 286 testContentTypeCache(); | 282 testContentTypeCache(); |
| 287 } | 283 } |
| OLD | NEW |