Merge "Add checks to ensure SPIs are not reused"
am: e9f609ee76
Change-Id: I893925014557e5ae13303debc4ee8f50faf9605d
This commit is contained in:
@@ -268,6 +268,31 @@ public class IpSecServiceParameterizedTest {
|
|||||||
anyInt());
|
anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testCreateTwoTransformsWithSameSpis() throws Exception {
|
||||||
|
IpSecConfig ipSecConfig = new IpSecConfig();
|
||||||
|
addDefaultSpisAndRemoteAddrToIpSecConfig(ipSecConfig);
|
||||||
|
addAuthAndCryptToIpSecConfig(ipSecConfig);
|
||||||
|
|
||||||
|
IpSecTransformResponse createTransformResp =
|
||||||
|
mIpSecService.createTransform(ipSecConfig, new Binder());
|
||||||
|
assertEquals(IpSecManager.Status.OK, createTransformResp.status);
|
||||||
|
|
||||||
|
// Attempting to create transform a second time with the same SPIs should throw an error...
|
||||||
|
try {
|
||||||
|
mIpSecService.createTransform(ipSecConfig, new Binder());
|
||||||
|
fail("IpSecService should have thrown an error for reuse of SPI");
|
||||||
|
} catch (IllegalStateException expected) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... even if the transform is deleted
|
||||||
|
mIpSecService.deleteTransform(createTransformResp.resourceId);
|
||||||
|
try {
|
||||||
|
mIpSecService.createTransform(ipSecConfig, new Binder());
|
||||||
|
fail("IpSecService should have thrown an error for reuse of SPI");
|
||||||
|
} catch (IllegalStateException expected) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteTransform() throws Exception {
|
public void testDeleteTransform() throws Exception {
|
||||||
IpSecConfig ipSecConfig = new IpSecConfig();
|
IpSecConfig ipSecConfig = new IpSecConfig();
|
||||||
|
|||||||
Reference in New Issue
Block a user