summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-05-31 17:47:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-05-31 17:47:43 +0000
commit0697df2e29a3255620760667e9192d82102cd85c (patch)
treea544ed30fbd34ca89331fe3bdba708a3dece88da /tests
parentab73d041b30848ba20e69244418fbfa9b4975383 (diff)
parentd35cddaf72ba0d679143fa07e07df330c6893574 (diff)
Merge "Add support for installing Passpoint profile via overloaded API" into oc-dev
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());
+ }
}