diff options
author | Neil Fuller <nfuller@google.com> | 2014-04-04 19:39:34 +0100 |
---|---|---|
committer | Neil Fuller <nfuller@google.com> | 2014-04-07 09:54:49 +0100 |
commit | 154d3fb470158aa01cae000781d0d65cf4c186dd (patch) | |
tree | 87f44449194379804b0d03a84f1d145b3e51b455 /harmony-tests | |
parent | df945d726e02034dafdcf7469f71865b86dc3e9d (diff) | |
download | libcore-154d3fb470158aa01cae000781d0d65cf4c186dd.zip libcore-154d3fb470158aa01cae000781d0d65cf4c186dd.tar.gz libcore-154d3fb470158aa01cae000781d0d65cf4c186dd.tar.bz2 |
Fix broken CTS HttpCookie test
Added some test cases and corrected the test to conform
to the RI behavior.
Change-Id: Ib32baf2e923c50fca1a5a4cb7cbd7f55ed70e760
Bug: 13748507
Diffstat (limited to 'harmony-tests')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/java/net/HttpCookieTest.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/HttpCookieTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/HttpCookieTest.java index faf0f2a..306e697 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/HttpCookieTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/HttpCookieTest.java @@ -590,8 +590,7 @@ public class HttpCookieTest extends TestCase { list = HttpCookie .parse("Set-Cookie:name=test;max-age=-12345;"); cookie = list.get(0); - // This currently fails, we accept a negative max-age. - assertEquals(0, cookie.getMaxAge()); + assertEquals(-12345, cookie.getMaxAge()); assertTrue(cookie.hasExpired()); // Locale does not affect version 1 cookie. @@ -695,6 +694,15 @@ public class HttpCookieTest extends TestCase { cookie = list.get(0); assertEquals(-1000, cookie.getMaxAge()); + // TODO: Uncomment when Long.parseLong() accepts numbers with a leading + + // list = HttpCookie.parse("Set-Cookie:name=test;max-age=+12345;"); + // cookie = list.get(0); + // assertEquals(12345, cookie.getMaxAge()); + + list = HttpCookie.parse("Set-Cookie:name=test;max-age=0;"); + cookie = list.get(0); + assertEquals(0, cookie.getMaxAge()); + // Check portlist list = HttpCookie.parse("Set-Cookie:name=tes,t;port"); cookie = list.get(0); |