Merge "Throw IAE when Network's LinkProperties is null" am: 5345fa1144 am: b5a6b0118a

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2101892

Change-Id: I7f2663d1a67141b652204d6fcc97f936c2f68b33
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yan Yan 2022-05-23 17:59:34 +00:00 • committed by Automerger Merge Worker
commit 3ca3e7cf2d

View file

@ -782,6 +782,23 @@ public class IpSecServiceParameterizedTest {
assertEquals(newFakeNetwork, tunnelInterfaceInfo.getUnderlyingNetwork());
}
@Test
public void testSetNetworkForTunnelInterfaceFailsForNullLp() throws Exception {
final IpSecTunnelInterfaceResponse createTunnelResp =
createAndValidateTunnel(mSourceAddr, mDestinationAddr, BLESSED_PACKAGE);
final Network newFakeNetwork = new Network(1000);
final int tunnelIfaceResourceId = createTunnelResp.resourceId;
try {
mIpSecService.setNetworkForTunnelInterface(
tunnelIfaceResourceId, newFakeNetwork, BLESSED_PACKAGE);
fail(
"Expected an IllegalArgumentException for underlying network with null"
+ " LinkProperties");
} catch (IllegalArgumentException expected) {
}
}
@Test
public void testSetNetworkForTunnelInterfaceFailsForInvalidResourceId() throws Exception {
final IpSecTunnelInterfaceResponse createTunnelResp =