diff options
author | Ecco Park <eccopark@google.com> | 2019-03-25 15:11:39 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-03-25 15:11:39 +0000 |
commit | f3db383c9ca2ee5105cffe47509d316e4119316f (patch) | |
tree | 83b5cd0e040c333d43f03ec5a0c1946fda7ef532 /tests | |
parent | 38d9f0d26b21c4b95c5cc8b3ae9af3ab82f7f95e (diff) | |
parent | 1d1ef9c66e3873ec5c5a0e59cad1333797079936 (diff) |
Merge "Passpoint: auto connection is only allowed for MNO carrier"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java index 76a2e653e..065e19fb8 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java @@ -412,6 +412,31 @@ public class PasspointNetworkEvaluatorTest { } /** + * Verify that it never creates an ephemeral Passpoint Configuration when the carrier is not + * MNO. + */ + @Test + public void skipCreateEphemeralPasspointConfigurationForNonMNO() { + // Setup ScanDetail and match providers. + List<ScanDetail> scanDetails = Arrays.asList(new ScanDetail[]{ + generateScanDetail(TEST_SSID1, TEST_BSSID1)}); + when(mTelephonyManager.getSimState()).thenReturn(TelephonyManager.SIM_STATE_READY); + + // MVNO carrier is enabled. + when(mTelephonyManager.getCarrierIdFromSimMccMnc()).thenReturn(1); + when(mTelephonyManager.getSimCarrierId()).thenReturn(20); + when(mCarrierNetworkConfig.isCarrierEncryptionInfoAvailable()).thenReturn(true); + when(mPasspointManager.hasCarrierProvider(anyString())).thenReturn(false); + when(mPasspointManager.findEapMethodFromNAIRealmMatchedWithCarrier( + any(List.class))).thenReturn( + EAPConstants.EAP_AKA); + + assertEquals(null, mEvaluator.evaluateNetworks( + scanDetails, null, null, false, false, mOnConnectableListener)); + verify(mPasspointManager, never()).createEphemeralPasspointConfigForCarrier(anyInt()); + } + + /** * Verify that it never creates an ephemeral Passpoint Configuration when the profile for the * carrier already exists. */ @@ -437,6 +462,11 @@ public class PasspointNetworkEvaluatorTest { // Setup ScanDetail List<ScanDetail> scanDetails = Arrays.asList(new ScanDetail[]{ generateScanDetail(TEST_SSID1, TEST_BSSID1)}); + when(mTelephonyManager.getSimState()).thenReturn(TelephonyManager.SIM_STATE_READY); + + // MNO carrier is enabled. + when(mTelephonyManager.getCarrierIdFromSimMccMnc()).thenReturn(1); + when(mTelephonyManager.getSimCarrierId()).thenReturn(1); when(mCarrierNetworkConfig.isCarrierEncryptionInfoAvailable()).thenReturn(true); when(mPasspointManager.hasCarrierProvider(anyString())).thenReturn(false); when(mPasspointManager.findEapMethodFromNAIRealmMatchedWithCarrier( @@ -459,6 +489,11 @@ public class PasspointNetworkEvaluatorTest { // Setup ScanDetail List<ScanDetail> scanDetails = Arrays.asList(new ScanDetail[]{ generateScanDetail(TEST_SSID1, TEST_BSSID1)}); + when(mTelephonyManager.getSimState()).thenReturn(TelephonyManager.SIM_STATE_READY); + + // MNO carrier is enabled. + when(mTelephonyManager.getCarrierIdFromSimMccMnc()).thenReturn(1); + when(mTelephonyManager.getSimCarrierId()).thenReturn(1); when(mCarrierNetworkConfig.isCarrierEncryptionInfoAvailable()).thenReturn(true); when(mPasspointManager.hasCarrierProvider(anyString())).thenReturn(false); when(mPasspointManager.findEapMethodFromNAIRealmMatchedWithCarrier( |