Exit test if device does not support IPsec tunnel

Bug: 155926216
Test: CtsIkeTestCases
Change-Id: I4e426b8f3509e56e7e2e7532e216533ad8bfbc2f
Merged-In: I4e426b8f3509e56e7e2e7532e216533ad8bfbc2f
(cherry picked from commit eb70555351725a608afac0fb9f94a327e9236729)
This commit is contained in:
Automerger Merge Worker
2020-05-22 00:27:02 +00:00
committed by Yan Yan
parent b407f77bd0
commit 9604af3544
2 changed files with 15 additions and 3 deletions

View File

@@ -122,7 +122,9 @@ public class IkeSessionPskTest extends IkeSessionTestBase {
}
@Test
public void testIkeSessionSetupAndManageChildSas() throws Exception {
public void testIkeSessionSetupAndChildSessionSetupWithTunnelMode() throws Exception {
if (!hasTunnelsFeature()) return;
// Open IKE Session
IkeSession ikeSession = openIkeSession(createIkeSessionParams(mRemoteAddress));
int expectedMsgId = 0;
@@ -210,7 +212,9 @@ public class IkeSessionPskTest extends IkeSessionTestBase {
}
@Test
public void testIkeSessionKill() throws Exception {
public void testIkeSessionKillWithTunnelMode() throws Exception {
if (!hasTunnelsFeature()) return;
// Open IKE Session
IkeSession ikeSession = openIkeSession(createIkeSessionParams(mRemoteAddress));
int expectedMsgId = 0;
@@ -254,5 +258,7 @@ public class IkeSessionPskTest extends IkeSessionTestBase {
assertArrayEquals(EXPECTED_PROTOCOL_ERROR_DATA_NONE, protocolException.getErrorData());
}
// TODO(b/148689509): Verify rekey process and handling IKE_AUTH failure
// TODO(b/155821007): Verify rekey process and handling IKE_AUTH failure
// TODO(b/155821007): Test creating transport mode Child SA
}

View File

@@ -20,6 +20,7 @@ import static android.app.AppOpsManager.OP_MANAGE_IPSEC_TUNNELS;
import android.annotation.NonNull;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.InetAddresses;
import android.net.IpSecTransform;
@@ -368,6 +369,11 @@ abstract class IkeSessionTestBase extends IkeTestBase {
}
}
/** Package private method to check if device has IPsec tunnels feature */
static boolean hasTunnelsFeature() {
return sContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_IPSEC_TUNNELS);
}
// TODO(b/148689509): Verify IKE Session setup using EAP and digital-signature-based auth
// TODO(b/148689509): Verify hostname based creation