summaryrefslogtreecommitdiffstats
path: root/luni/src
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-11-27 11:40:30 +0000
committerNarayan Kamath <narayan@google.com>2014-11-27 11:40:30 +0000
commit4284daf6172310292947bd62540e3007164fdde9 (patch)
treef55257dd6ae8fdcd0f5b583f26cfc2d7dfa094e5 /luni/src
parentd8ce757d85ba665fa61d35e25e03c4de16c0f4c6 (diff)
downloadlibcore-4284daf6172310292947bd62540e3007164fdde9.zip
libcore-4284daf6172310292947bd62540e3007164fdde9.tar.gz
libcore-4284daf6172310292947bd62540e3007164fdde9.tar.bz2
Add a simple test for "last-modified" headers.
Tests that getLastModified() == getHeaderFieldDate("Last-Modified"). This was lost in commit d8ce757d85ba665fa61d35e25e03c4de16c0f4c6. Change-Id: I0dd1e7091b690d70161f33b8dfe3d0cee7ee4c9b
Diffstat (limited to 'luni/src')
-rw-r--r--luni/src/test/java/libcore/java/net/URLConnectionTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
index 9e94c2e..8991b1a 100644
--- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
@@ -2078,6 +2078,19 @@ public final class URLConnectionTest extends AbstractResourceLeakageDetectorTest
connection.disconnect();
}
+ public void testLastModified() throws Exception {
+ server.enqueue(new MockResponse()
+ .addHeader("Last-Modified", "Wed, 27 Nov 2013 11:26:00 GMT")
+ .setBody("Hello"));
+ server.play();
+
+ HttpURLConnection connection = (HttpURLConnection) server.getUrl("/").openConnection();
+ connection.connect();
+
+ assertEquals(1385551560000L, connection.getLastModified());
+ assertEquals(1385551560000L, connection.getHeaderFieldDate("Last-Modified", -1));
+ }
+
public void testClientSendsContentLength() throws Exception {
server.enqueue(new MockResponse().setBody("A"));
server.play();