| 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 137abe5c9d8cc63e8461ebb2ac44f58185c5b324..67d2c59a8f1e155f3914ceaf7bbb77fa1a647d0b 100644
|
| --- a/tests/standalone/io/http_headers_test.dart
|
| +++ b/tests/standalone/io/http_headers_test.dart
|
| @@ -276,6 +276,87 @@ void testContentTypeCache() {
|
| Expect.equals("/", headers.contentType.value);
|
| }
|
|
|
| +void testCookie() {
|
| + void checkCookiesEquals(a, b) {
|
| + Expect.equals(a.name, b.name);
|
| + Expect.equals(a.value, b.value);
|
| + Expect.equals(a.expires, b.expires);
|
| + Expect.equals(a.toString(), b.toString());
|
| + }
|
| +
|
| + void checkCookie(cookie, s) {
|
| + Expect.equals(s, cookie.toString());
|
| + var c = new _Cookie.fromSetCookieValue(s);
|
| + checkCookiesEquals(cookie, c);
|
| + }
|
| +
|
| + Cookie cookie;
|
| + cookie = new Cookie("name", "value");
|
| + Expect.equals("name=value", cookie.toString());
|
| + TimeZone utc = new TimeZone.utc();
|
| + Date date = new Date.withTimeZone(2014, Date.JAN, 5, 23, 59, 59, 0, utc);
|
| + cookie.expires = date;
|
| + checkCookie(cookie, "name=value"
|
| + "; Expires=Sun, 5 Jan 2014 23:59:59 GMT");
|
| + cookie.maxAge = 567;
|
| + checkCookie(cookie, "name=value"
|
| + "; Expires=Sun, 5 Jan 2014 23:59:59 GMT"
|
| + "; Max-Age=567");
|
| + cookie.domain = "example.com";
|
| + checkCookie(cookie, "name=value"
|
| + "; Expires=Sun, 5 Jan 2014 23:59:59 GMT"
|
| + "; Max-Age=567"
|
| + "; Domain=example.com");
|
| + cookie.path = "/xxx";
|
| + checkCookie(cookie, "name=value"
|
| + "; Expires=Sun, 5 Jan 2014 23:59:59 GMT"
|
| + "; Max-Age=567"
|
| + "; Domain=example.com"
|
| + "; Path=/xxx");
|
| + cookie.secure = true;
|
| + checkCookie(cookie, "name=value"
|
| + "; Expires=Sun, 5 Jan 2014 23:59:59 GMT"
|
| + "; Max-Age=567"
|
| + "; Domain=example.com"
|
| + "; Path=/xxx"
|
| + "; Secure");
|
| + cookie.httpOnly = true;
|
| + checkCookie(cookie, "name=value"
|
| + "; Expires=Sun, 5 Jan 2014 23:59:59 GMT"
|
| + "; Max-Age=567"
|
| + "; Domain=example.com"
|
| + "; Path=/xxx"
|
| + "; Secure"
|
| + "; HttpOnly");
|
| + cookie.expires = null;
|
| + checkCookie(cookie, "name=value"
|
| + "; Max-Age=567"
|
| + "; Domain=example.com"
|
| + "; Path=/xxx"
|
| + "; Secure"
|
| + "; HttpOnly");
|
| + cookie.maxAge = null;
|
| + checkCookie(cookie, "name=value"
|
| + "; Domain=example.com"
|
| + "; Path=/xxx"
|
| + "; Secure"
|
| + "; HttpOnly");
|
| + cookie.domain = null;
|
| + checkCookie(cookie, "name=value"
|
| + "; Path=/xxx"
|
| + "; Secure"
|
| + "; HttpOnly");
|
| + cookie.path = null;
|
| + checkCookie(cookie, "name=value"
|
| + "; Secure"
|
| + "; HttpOnly");
|
| + cookie.secure = false;
|
| + checkCookie(cookie, "name=value"
|
| + "; HttpOnly");
|
| + cookie.httpOnly = false;
|
| + checkCookie(cookie, "name=value");
|
| +}
|
| +
|
| main() {
|
| testMultiValue();
|
| testExpires();
|
| @@ -284,4 +365,5 @@ main() {
|
| testHeaderValue();
|
| testContentType();
|
| testContentTypeCache();
|
| + testCookie();
|
| }
|
|
|