diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-05-26 22:20:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-05-26 22:20:10 +0000 |
commit | 5ce18b038080b06e5ae5b13d3b3aa88f52c8fe72 (patch) | |
tree | 43654ec931dbb2dd16b484f5609e3a4fb659edbf /tests | |
parent | 96a9dbeb3a622e44c13ff7be8decf36d06ff7dbb (diff) | |
parent | 1545f9403866abab36163eea9df7d18d3a388e98 (diff) |
Merge "Add support for installing Passpoint profile via overloaded API"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index 0c608d9ea..01f243db7 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -56,12 +56,15 @@ import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.content.res.Resources; import android.net.IpConfiguration; import android.net.wifi.ScanSettings; import android.net.wifi.WifiConfiguration; +import android.net.wifi.WifiEnterpriseConfig; import android.net.wifi.WifiManager; import android.net.wifi.WifiManager.LocalOnlyHotspotCallback; +import android.net.wifi.hotspot2.PasspointConfiguration; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; @@ -1450,4 +1453,31 @@ public class WifiServiceImplTest { public void testStopWatchLocalOnlyHotspotNotSupported() { mWifiServiceImpl.stopWatchLocalOnlyHotspot(); } + + /** + * Verify that the call to addOrUpdateNetwork for installing Passpoint profile is redirected + * to the Passpoint specific API addOrUpdatePasspointConfiguration. + */ + @Test + public void testAddPasspointProfileViaAddNetwork() throws Exception { + WifiConfiguration config = WifiConfigurationTestUtil.createPasspointNetwork(); + config.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.TLS); + + PackageManager pm = mock(PackageManager.class); + when(pm.hasSystemFeature(PackageManager.FEATURE_WIFI_PASSPOINT)).thenReturn(true); + when(mContext.getPackageManager()).thenReturn(pm); + + when(mWifiStateMachine.syncAddOrUpdatePasspointConfig(any(), + any(PasspointConfiguration.class), anyInt())).thenReturn(true); + assertEquals(0, mWifiServiceImpl.addOrUpdateNetwork(config)); + verify(mWifiStateMachine).syncAddOrUpdatePasspointConfig(any(), + any(PasspointConfiguration.class), anyInt()); + reset(mWifiStateMachine); + + when(mWifiStateMachine.syncAddOrUpdatePasspointConfig(any(), + any(PasspointConfiguration.class), anyInt())).thenReturn(false); + assertEquals(-1, mWifiServiceImpl.addOrUpdateNetwork(config)); + verify(mWifiStateMachine).syncAddOrUpdatePasspointConfig(any(), + any(PasspointConfiguration.class), anyInt()); + } } |