diff options
author | Aaron Whyte <awhyte@google.com> | 2015-09-01 09:14:33 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-01 09:14:33 +0000 |
commit | 06450162361746f05111513bc0c075fbecb4631b (patch) | |
tree | d96bb936ddd822881c158a52d09fc1ec76cc4b66 | |
parent | a944ebd45224439731be35c6a16af526570ed78a (diff) | |
parent | 939e6a1aceff448445928ad5d815479e84e84383 (diff) | |
download | libcore-06450162361746f05111513bc0c075fbecb4631b.zip libcore-06450162361746f05111513bc0c075fbecb4631b.tar.gz libcore-06450162361746f05111513bc0c075fbecb4631b.tar.bz2 |
am 939e6a1a: Fix URLConnectionTest for devices without full internet access.
* commit '939e6a1aceff448445928ad5d815479e84e84383':
Fix URLConnectionTest for devices without full internet access.
3 files changed, 1 insertions, 63 deletions
diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java index 40c9f5e..f438d1b 100644 --- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java +++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java @@ -965,6 +965,7 @@ public final class URLConnectionTest extends AbstractResourceLeakageDetectorTest RecordedRequest request = server.takeRequest(); assertContains(request.getHeaders(), "Accept-Encoding: gzip"); + assertEquals("gzip", connection.getContentEncoding()); } public void testGzipAndConnectionReuseWithFixedLength() throws Exception { diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java index d52b033..5307cf4 100644 --- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java +++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java @@ -438,39 +438,6 @@ public class URLConnectionTest extends TestCase { } /** - * @throws IOException - * {@link java.net.URLConnection#getContentEncoding()} - */ - // broken test - Fails in CTS, passes in CoreTestRunner - public void test_getContentEncoding() throws IOException { - // faulty setup - try { - - fileURLCon.getContentEncoding(); - fail("Exception expected"); - } catch (Throwable e) { - //ok - } - - // positive case - - URL url = new URL("http://www.amazon.com/"); - - URLConnection con = url.openConnection(); - con.setRequestProperty("Accept-Encoding", "gzip"); - con.connect(); - - assertEquals(con.getContentEncoding(), "gzip"); - - - uc2.setRequestProperty("Accept-Encoding", "bla"); - uc2.connect(); - - assertNull(uc2.getContentEncoding()); - - } - - /** * {@link java.net.URLConnection#getContentLength()} */ public void test_getContentLength() throws Exception { @@ -833,34 +800,6 @@ public class URLConnectionTest extends TestCase { } } - /** - * @throws IOException - * {@link java.net.URLConnection#getLastModified()} - */ - public void test_getLastModified() throws IOException { - - URL url4 = new URL(Support_Configuration.hTTPURLwLastModified); - URLConnection uc4 = url4.openConnection(); - - uc4.connect(); - - if (uc4.getLastModified() == 0) { - System.out - .println("WARNING: Server does not support 'Last-Modified', test_getLastModified() not run"); - return; - } - - long millis = uc4.getHeaderFieldDate("Last-Modified", 0); - - assertEquals( - "Returned wrong getLastModified value. Wanted: " - + " got: " + uc4.getLastModified(), - millis, uc4.getLastModified()); - - - ((HttpURLConnection) uc).disconnect(); - } - public void test_getOutputStream_failAfterDisconnect() throws IOException { ((HttpURLConnection) uc2).disconnect(); diff --git a/support/src/test/java/tests/support/Support_Configuration.java b/support/src/test/java/tests/support/Support_Configuration.java index 9cb617d..313a448 100644 --- a/support/src/test/java/tests/support/Support_Configuration.java +++ b/support/src/test/java/tests/support/Support_Configuration.java @@ -91,8 +91,6 @@ public class Support_Configuration { // than one addresses returned for this host name as needed by a test // END android-changed - public static String hTTPURLwLastModified = "http://www.php.net/manual/en/function.explode.php"; - public static int SpecialInetTestAddressNumber = 4; /** |