Merge "Fix harmony URLConnectionTest hanging for 25sec." into pie-cts-dev
am: 781e06ebf9
Change-Id: Id3d8f8e73c953e8a02258c54557b9a95b529e405
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/URLTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/URLTest.java
index 3502e72..57b439b 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/URLTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/URLTest.java
@@ -966,7 +966,7 @@
/**
* java.net.URL#openConnection()
*/
- public void test_openConnection_FileProtocal() throws Exception {
+ public void test_openConnection_FileProtocol() throws Exception {
// Regression test for Harmony-5779
String basedir = new File("temp.java").getAbsolutePath();
String fileUrlString = "file://localhost/" + basedir;
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 37b561c..95c1f19 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
@@ -469,9 +469,7 @@
URLConnection htmlFileCon = openHTMLFile();
String contentType = htmlFileCon.getContentType();
- if (contentType != null) {
- assertTrue(contentType.equalsIgnoreCase("text/html"));
- }
+ assertEquals("text/html", contentType);
}
/**
@@ -1234,6 +1232,7 @@
URL fUrl1 = new URL("file://" + tmpDir.getPath()
+ "/Harmony.GIF");
URLConnection con1 = fUrl1.openConnection();
+ assertEquals("file", con1.getURL().getProtocol()); // http://b/119607552
return con1;
}
@@ -1252,9 +1251,10 @@
String cts = System.getProperty("java.io.tmpdir");
File tmpDir = new File(cts);
Support_Resources.copyFile(tmpDir, null, "hyts_htmltest.html");
- URL fUrl1 = new URL("file:/" + tmpDir.getPath()
+ URL fUrl1 = new URL("file://" + tmpDir.getPath()
+ "/hyts_htmltest.html");
URLConnection con1 = fUrl1.openConnection();
+ assertEquals("file", con1.getURL().getProtocol()); // http://b/119607552
return con1;
}