Fix URLTest#testAtSignInUserInfo failure am: 7e6977749c am: 47ee0f9e11 am: d24900bf47
am: aba0708c7d
Change-Id: Ibd29c496b3b1faadf53ad8349f59b22b08c105c6
diff --git a/luni/src/test/java/libcore/java/net/URLTest.java b/luni/src/test/java/libcore/java/net/URLTest.java
index 7a323af..0eee1f8 100644
--- a/luni/src/test/java/libcore/java/net/URLTest.java
+++ b/luni/src/test/java/libcore/java/net/URLTest.java
@@ -194,12 +194,12 @@
assertEquals(null, url.getRef());
}
+ // This behavior of URLs with invalid user info changed due to bug http://b/33351987 after
+ // Android security level 1 April 2017.
public void testAtSignInUserInfo() throws Exception {
- try {
- new URL("http://user@userhost.com:password@host");
- fail();
- } catch (MalformedURLException expected) {
- }
+ URL url = new URL("http://user@userhost.com:password@host");
+ assertNull(url.getUserInfo());
+ assertTrue(url.getHost().isEmpty());
}
public void testUserNoPassword() throws Exception {
@@ -785,5 +785,6 @@
final String host = "http://multiple@users@url.com";
URL url = new URL(host);
assertNull(url.getUserInfo());
+ assertTrue(url.getHost().isEmpty());
}
}