summaryrefslogtreecommitdiffstats
path: root/luni/src/test
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-11-27 14:38:20 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-11-27 14:38:21 +0000
commit6b00fa98129943f74e3209a46fde18d36bd7cf56 (patch)
treef55257dd6ae8fdcd0f5b583f26cfc2d7dfa094e5 /luni/src/test
parent659e01c3687b73a284612e500a3434d4b387c520 (diff)
parent4284daf6172310292947bd62540e3007164fdde9 (diff)
downloadlibcore-6b00fa98129943f74e3209a46fde18d36bd7cf56.zip
libcore-6b00fa98129943f74e3209a46fde18d36bd7cf56.tar.gz
libcore-6b00fa98129943f74e3209a46fde18d36bd7cf56.tar.bz2
Merge "Add a simple test for "last-modified" headers."
Diffstat (limited to 'luni/src/test')
-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();