Merge "Add API for CaptivePortalData" am: 1c42b174ed am: 12ad1433c1 am: f807f17797
Change-Id: I951f2eb2a0e2550f65ac87a84b76ea68c2449423
This commit is contained in:
@@ -75,6 +75,9 @@ public class LinkPropertiesTest {
|
||||
private static final LinkAddress LINKADDRV4 = new LinkAddress(ADDRV4, 32);
|
||||
private static final LinkAddress LINKADDRV6 = new LinkAddress(ADDRV6, 128);
|
||||
private static final LinkAddress LINKADDRV6LINKLOCAL = new LinkAddress("fe80::1/64");
|
||||
private static final Uri CAPPORT_API_URL = Uri.parse("https://test.example.com/capportapi");
|
||||
private static final CaptivePortalData CAPPORT_DATA = new CaptivePortalData.Builder()
|
||||
.setVenueInfoUrl(Uri.parse("https://test.example.com/venue")).build();
|
||||
|
||||
private static InetAddress address(String addrString) {
|
||||
return InetAddresses.parseNumericAddress(addrString);
|
||||
@@ -101,6 +104,8 @@ public class LinkPropertiesTest {
|
||||
assertFalse(lp.isIpv6Provisioned());
|
||||
assertFalse(lp.isPrivateDnsActive());
|
||||
assertFalse(lp.isWakeOnLanSupported());
|
||||
assertNull(lp.getCaptivePortalApiUrl());
|
||||
assertNull(lp.getCaptivePortalData());
|
||||
}
|
||||
|
||||
private LinkProperties makeTestObject() {
|
||||
@@ -124,6 +129,8 @@ public class LinkPropertiesTest {
|
||||
lp.setNat64Prefix(new IpPrefix("2001:db8:0:64::/96"));
|
||||
lp.setDhcpServerAddress(DHCPSERVER);
|
||||
lp.setWakeOnLanSupported(true);
|
||||
lp.setCaptivePortalApiUrl(CAPPORT_API_URL);
|
||||
lp.setCaptivePortalData(CAPPORT_DATA);
|
||||
return lp;
|
||||
}
|
||||
|
||||
@@ -165,6 +172,12 @@ public class LinkPropertiesTest {
|
||||
assertTrue(source.isIdenticalWakeOnLan(target));
|
||||
assertTrue(target.isIdenticalWakeOnLan(source));
|
||||
|
||||
assertTrue(source.isIdenticalCaptivePortalApiUrl(target));
|
||||
assertTrue(target.isIdenticalCaptivePortalApiUrl(source));
|
||||
|
||||
assertTrue(source.isIdenticalCaptivePortalData(target));
|
||||
assertTrue(target.isIdenticalCaptivePortalData(source));
|
||||
|
||||
// Check result of equals().
|
||||
assertTrue(source.equals(target));
|
||||
assertTrue(target.equals(source));
|
||||
@@ -963,6 +976,8 @@ public class LinkPropertiesTest {
|
||||
source.setNat64Prefix(new IpPrefix("2001:db8:1:2:64:64::/96"));
|
||||
|
||||
source.setWakeOnLanSupported(true);
|
||||
source.setCaptivePortalApiUrl(CAPPORT_API_URL);
|
||||
source.setCaptivePortalData(CAPPORT_DATA);
|
||||
|
||||
source.setDhcpServerAddress((Inet4Address) GATEWAY1);
|
||||
|
||||
@@ -970,7 +985,13 @@ public class LinkPropertiesTest {
|
||||
stacked.setInterfaceName("test-stacked");
|
||||
source.addStackedLink(stacked);
|
||||
|
||||
assertParcelSane(source, 16 /* fieldCount */);
|
||||
assertParcelSane(source.makeSensitiveFieldsParcelingCopy(), 18 /* fieldCount */);
|
||||
|
||||
// Verify that without using a sensitiveFieldsParcelingCopy, sensitive fields are cleared.
|
||||
final LinkProperties sanitized = new LinkProperties(source);
|
||||
sanitized.setCaptivePortalApiUrl(null);
|
||||
sanitized.setCaptivePortalData(null);
|
||||
assertEquals(sanitized, parcelingRoundTrip(source));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1113,4 +1134,22 @@ public class LinkPropertiesTest {
|
||||
lp.clear();
|
||||
assertFalse(lp.isWakeOnLanSupported());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCaptivePortalApiUrl() {
|
||||
final LinkProperties lp = makeTestObject();
|
||||
assertEquals(CAPPORT_API_URL, lp.getCaptivePortalApiUrl());
|
||||
|
||||
lp.clear();
|
||||
assertNull(lp.getCaptivePortalApiUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCaptivePortalData() {
|
||||
final LinkProperties lp = makeTestObject();
|
||||
assertEquals(CAPPORT_DATA, lp.getCaptivePortalData());
|
||||
|
||||
lp.clear();
|
||||
assertNull(lp.getCaptivePortalData());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user