diff options
author | Cody Kesting <ckesting@google.com> | 2019-08-14 20:12:08 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-08-14 20:12:08 +0000 |
commit | 245b55ed3a41b1428ff8ef1f25530037086ae8f4 (patch) | |
tree | 94096b46ca8a56c755ffc960a7ef0736ce9d4c9f /tests | |
parent | f32cda311c18bf7727d54fd275f81009f7b54d78 (diff) | |
parent | d58e65d2198c91469bed5f3f865c21ce69d150fe (diff) | |
download | ike-245b55ed3a41b1428ff8ef1f25530037086ae8f4.tar.gz |
Merge "Require UICC Apptype for authentication in EAP."
Diffstat (limited to 'tests')
6 files changed, 23 insertions, 8 deletions
diff --git a/tests/iketests/src/java/com/android/ike/eap/EapSessionConfigTest.java b/tests/iketests/src/java/com/android/ike/eap/EapSessionConfigTest.java index fea098c6..aa7d8443 100644 --- a/tests/iketests/src/java/com/android/ike/eap/EapSessionConfigTest.java +++ b/tests/iketests/src/java/com/android/ike/eap/EapSessionConfigTest.java @@ -16,11 +16,12 @@ package com.android.ike.eap; +import static android.telephony.TelephonyManager.APPTYPE_USIM; + import static com.android.ike.eap.message.EapData.EAP_TYPE_SIM; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import com.android.ike.eap.EapSessionConfig.EapMethodConfig; @@ -36,14 +37,15 @@ public class EapSessionConfigTest { public void testBuild() { EapSessionConfig result = new EapSessionConfig.Builder() .setEapIdentity(EAP_IDENTITY) - .setEapSimConfig(SUB_ID) + .setEapSimConfig(SUB_ID, APPTYPE_USIM) .build(); assertArrayEquals(EAP_IDENTITY, result.eapIdentity); EapMethodConfig eapMethodConfig = result.eapConfigs.get(EAP_TYPE_SIM); assertEquals(EAP_TYPE_SIM, eapMethodConfig.methodType); - assertTrue(eapMethodConfig instanceof EapSimConfig); + EapSimConfig eapSimConfig = (EapSimConfig) eapMethodConfig; + assertEquals(APPTYPE_USIM, eapSimConfig.apptype); } @Test diff --git a/tests/iketests/src/java/com/android/ike/eap/EapSimTest.java b/tests/iketests/src/java/com/android/ike/eap/EapSimTest.java index 25e9139b..9051d1d5 100644 --- a/tests/iketests/src/java/com/android/ike/eap/EapSimTest.java +++ b/tests/iketests/src/java/com/android/ike/eap/EapSimTest.java @@ -16,6 +16,8 @@ package com.android.ike.eap; +import static android.telephony.TelephonyManager.APPTYPE_USIM; + import static com.android.ike.TestUtils.hexStringToByteArray; import static com.android.ike.eap.message.EapTestMessageDefinitions.EAP_REQUEST_AKA_IDENTITY_PACKET; import static com.android.ike.eap.message.EapTestMessageDefinitions.EAP_REQUEST_NOTIFICATION_PACKET; @@ -112,7 +114,9 @@ public class EapSimTest { mMockCallback = mock(IEapCallback.class); mTestLooper = new TestLooper(); - mEapSessionConfig = new EapSessionConfig.Builder().setEapSimConfig(SUB_ID).build(); + mEapSessionConfig = new EapSessionConfig.Builder() + .setEapSimConfig(SUB_ID, APPTYPE_USIM) + .build(); mEapAuthenticator = new EapAuthenticator( mTestLooper.getLooper(), diff --git a/tests/iketests/src/java/com/android/ike/eap/EapTestUtils.java b/tests/iketests/src/java/com/android/ike/eap/EapTestUtils.java index b7a3ff33..aa374552 100644 --- a/tests/iketests/src/java/com/android/ike/eap/EapTestUtils.java +++ b/tests/iketests/src/java/com/android/ike/eap/EapTestUtils.java @@ -16,6 +16,8 @@ package com.android.ike.eap; +import static android.telephony.TelephonyManager.APPTYPE_USIM; + import java.util.HashMap; /** @@ -47,6 +49,6 @@ public class EapTestUtils { * @return a new EapSessionConfig with EAP-SIM configs set */ public static EapSessionConfig getDummyEapSimSessionConfig() { - return new EapSessionConfig.Builder().setEapSimConfig(0).build(); + return new EapSessionConfig.Builder().setEapSimConfig(0, APPTYPE_USIM).build(); } } diff --git a/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimMethodStateMachineTest.java b/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimMethodStateMachineTest.java index 5847619a..711a6a32 100644 --- a/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimMethodStateMachineTest.java +++ b/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimMethodStateMachineTest.java @@ -16,6 +16,8 @@ package com.android.ike.eap.statemachine; +import static android.telephony.TelephonyManager.APPTYPE_USIM; + import static androidx.test.InstrumentationRegistry.getInstrumentation; import static com.android.ike.TestUtils.hexStringToByteArray; @@ -101,7 +103,7 @@ public class EapSimMethodStateMachineTest { @Before public void setUp() { mContext = getInstrumentation().getContext(); - mEapSimConfig = new EapSimConfig(SUB_ID); + mEapSimConfig = new EapSimConfig(SUB_ID, APPTYPE_USIM); mEapSimMethodStateMachine = spy(new EapSimMethodStateMachine(mContext, mEapSimConfig, new SecureRandom())); } diff --git a/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimStateTest.java b/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimStateTest.java index 507ca1e2..ad9ddc75 100644 --- a/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimStateTest.java +++ b/tests/iketests/src/java/com/android/ike/eap/statemachine/EapSimStateTest.java @@ -16,6 +16,8 @@ package com.android.ike.eap.statemachine; +import static android.telephony.TelephonyManager.APPTYPE_USIM; + import static com.android.ike.TestUtils.hexStringToByteArray; import static com.android.ike.eap.message.EapTestMessageDefinitions.EAP_RESPONSE_NOTIFICATION_PACKET; import static com.android.ike.eap.message.EapTestMessageDefinitions.EAP_SIM_CLIENT_ERROR_INSUFFICIENT_CHALLENGES; @@ -58,7 +60,7 @@ public class EapSimStateTest { protected TelephonyManager mMockTelephonyManager; protected EapSimTypeDataDecoder mMockEapSimTypeDataDecoder; - protected EapSimConfig mEapSimConfig = new EapSimConfig(SUB_ID); + protected EapSimConfig mEapSimConfig = new EapSimConfig(SUB_ID, APPTYPE_USIM); protected EapSimMethodStateMachine mEapSimMethodStateMachine; @Before diff --git a/tests/iketests/src/java/com/android/ike/ikev2/IkeSessionStateMachineTest.java b/tests/iketests/src/java/com/android/ike/ikev2/IkeSessionStateMachineTest.java index 3fbc7ad9..3a0eb6d1 100644 --- a/tests/iketests/src/java/com/android/ike/ikev2/IkeSessionStateMachineTest.java +++ b/tests/iketests/src/java/com/android/ike/ikev2/IkeSessionStateMachineTest.java @@ -60,6 +60,7 @@ import android.net.IpSecManager; import android.net.IpSecManager.UdpEncapsulationSocket; import android.os.Looper; import android.os.test.TestLooper; +import android.telephony.TelephonyManager; import com.android.ike.TestUtils; import com.android.ike.eap.EapAuthenticator; @@ -437,7 +438,9 @@ public final class IkeSessionStateMachineTest { mIpSecManager = mMockIpSecTestUtils.getIpSecManager(); mContext = mMockIpSecTestUtils.getContext(); mUdpEncapSocket = mIpSecManager.openUdpEncapsulationSocket(); - mEapSessionConfig = new EapSessionConfig.Builder().setEapSimConfig(EAP_SIM_SUB_ID).build(); + mEapSessionConfig = new EapSessionConfig.Builder() + .setEapSimConfig(EAP_SIM_SUB_ID, TelephonyManager.APPTYPE_USIM) + .build(); mMockEapAuthenticatorFactory = mock(IkeEapAuthenticatorFactory.class); mMockEapAuthenticator = mock(EapAuthenticator.class); |