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

Unified Diff: tests/standalone/src/io/HttpHeadersTest.dart

Issue 10191013: Add handling of the HTTP Date header (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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_impl.dart ('K') | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/HttpHeadersTest.dart
diff --git a/tests/standalone/src/io/HttpHeadersTest.dart b/tests/standalone/src/io/HttpHeadersTest.dart
index e33d6a0eeff5da14236a7959c37654c5987c0352..ef0b09717f39a54b65ed7624fa55645e71e41f15 100644
--- a/tests/standalone/src/io/HttpHeadersTest.dart
+++ b/tests/standalone/src/io/HttpHeadersTest.dart
@@ -49,6 +49,34 @@ void testMultiValue() {
Expect.isNull(headers[HttpHeaders.PRAGMA]);
}
+void testDate() {
+ Date date1 = new Date.withTimeZone(
+ 1999, Date.JUN, 11, 18, 46, 53, 0, new TimeZone.utc());
+ String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT";
+ Date date2 = new Date.withTimeZone(
+ 2000, Date.AUG, 16, 12, 34, 56, 0, new TimeZone.utc());
+ String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT";
+
+ _HttpHeaders headers = new _HttpHeaders();
+ Expect.isNull(headers.date);
+ headers.date = date1;
+ Expect.equals(date1, headers.date);
+ Expect.equals(httpDate1, headers.value(HttpHeaders.DATE));
+ Expect.equals(1, headers[HttpHeaders.DATE].length);
+ headers.add(HttpHeaders.DATE, httpDate2);
+ Expect.equals(1, headers[HttpHeaders.DATE].length);
+ Expect.equals(date2, headers.date);
+ Expect.equals(httpDate2, headers.value(HttpHeaders.DATE));
+ headers.set(HttpHeaders.DATE, httpDate1);
+ Expect.equals(1, headers[HttpHeaders.DATE].length);
+ Expect.equals(date1, headers.date);
+ Expect.equals(httpDate1, headers.value(HttpHeaders.DATE));
+
+ headers.set(HttpHeaders.DATE, "xxx");
+ Expect.equals("xxx", headers.value(HttpHeaders.DATE));
+ Expect.equals(null, headers.date);
+}
+
void testExpires() {
Date date1 = new Date.withTimeZone(
1999, Date.JUN, 11, 18, 46, 53, 0, new TimeZone.utc());
« runtime/bin/http_impl.dart ('K') | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698