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

Unified Diff: tests/standalone/io/http_headers_test.dart

Issue 10855197: Fix HttpHeaders.date and add HttpHeaders.ifModifiedSince. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also parse other date values to a Http date format. Created 8 years, 4 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
« no previous file with comments | « 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/io/http_headers_test.dart
diff --git a/tests/standalone/io/http_headers_test.dart b/tests/standalone/io/http_headers_test.dart
index 112bac2b994fa6f236107dd7c0438229d8753977..b812ec319b8031f923855bf8f7f4a1c3fae821a6 100644
--- a/tests/standalone/io/http_headers_test.dart
+++ b/tests/standalone/io/http_headers_test.dart
@@ -101,6 +101,32 @@ void testExpires() {
Expect.equals(null, headers.expires);
}
+void testIfModifiedSince() {
+ Date date1 = new Date(1999, Date.JUN, 11, 18, 46, 53, 0, isUtc: true);
+ String httpDate1 = "Fri, 11 Jun 1999 18:46:53 GMT";
+ Date date2 = new Date(2000, Date.AUG, 16, 12, 34, 56, 0, isUtc: true);
+ String httpDate2 = "Wed, 16 Aug 2000 12:34:56 GMT";
+
+ _HttpHeaders headers = new _HttpHeaders();
+ Expect.isNull(headers.ifModifiedSince);
+ headers.ifModifiedSince = date1;
+ Expect.equals(date1, headers.ifModifiedSince);
+ Expect.equals(httpDate1, headers.value(HttpHeaders.IF_MODIFIED_SINCE));
+ Expect.equals(1, headers[HttpHeaders.IF_MODIFIED_SINCE].length);
+ headers.add(HttpHeaders.IF_MODIFIED_SINCE, httpDate2);
+ Expect.equals(1, headers[HttpHeaders.IF_MODIFIED_SINCE].length);
+ Expect.equals(date2, headers.ifModifiedSince);
+ Expect.equals(httpDate2, headers.value(HttpHeaders.IF_MODIFIED_SINCE));
+ headers.set(HttpHeaders.IF_MODIFIED_SINCE, httpDate1);
+ Expect.equals(1, headers[HttpHeaders.IF_MODIFIED_SINCE].length);
+ Expect.equals(date1, headers.ifModifiedSince);
+ Expect.equals(httpDate1, headers.value(HttpHeaders.IF_MODIFIED_SINCE));
+
+ headers.set(HttpHeaders.IF_MODIFIED_SINCE, "xxx");
+ Expect.equals("xxx", headers.value(HttpHeaders.IF_MODIFIED_SINCE));
+ Expect.equals(null, headers.ifModifiedSince);
+}
+
void testHost() {
String host = "www.google.com";
_HttpHeaders headers = new _HttpHeaders();
@@ -362,7 +388,9 @@ void testInvalidCookie() {
main() {
testMultiValue();
+ testDate();
testExpires();
+ testIfModifiedSince();
testHost();
testEnumeration();
testHeaderValue();
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698