summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Qiu <zqiu@google.com>2017-05-31 18:00:16 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-31 18:00:16 +0000
commitb50dbf503aacef67ec5de1e60066893eba6f65db (patch)
treec038f7e70ef54f04f87ff20ae06b552e14690ff7 /tests
parent6f41401a3847a08183e995d9d1a9c70b72e0c4f5 (diff)
parent0697df2e29a3255620760667e9192d82102cd85c (diff)
Merge "Add support for installing Passpoint profile via overloaded API" into oc-dev
am: 0697df2e29 Change-Id: I3e8b72f948a02f8ae2f994f1ab6080ec207ab0c3
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java27
1 files changed, 27 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 64100e217..7342cdb16 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -61,8 +61,10 @@ 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;
@@ -1446,4 +1448,29 @@ 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);
+ when(mResources.getBoolean(com.android.internal.R.bool.config_wifi_hotspot2_enabled))
+ .thenReturn(true);
+
+ 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());
+ }
}