summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-09-18 21:04:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-09-18 21:04:28 +0000
commit4764d08e86004af17e4cfd8e24ad6685b9096c5d (patch)
treee2763314917b4fb30c206002a4a99e9cc302f74a /tests
parent61a8a3a728a8a9653be48df03bbcfe7c801083f0 (diff)
parente0815c973a05dfe7194c551810a6969d3d5560f1 (diff)
Merge "[Passpoint] Add support for OSEN"
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java44
1 files changed, 34 insertions, 10 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java
index d45bbd586..8f3daa243 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java
@@ -39,6 +39,7 @@ import android.net.NetworkRequest;
import android.net.NetworkUtils;
import android.net.RouteInfo;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiEnterpriseConfig;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiSsid;
@@ -170,16 +171,6 @@ public class OsuNetworkConnectionTest extends WifiBaseTest {
}
/**
- * Verifies that connect() API returns false when OSU AP is a part of an OSEN
- */
- @Test
- public void verifyOSENUnsupported() {
- mNetworkConnection.init(mHandler);
- assertEquals(false,
- mNetworkConnection.connect(TEST_SSID, TEST_NAI_OSEN, TEST_PROVIDER_NAME));
- }
-
- /**
* Verifies that connect() API returns false when WifiManager's addNetwork()
* returns an invalid network ID
*/
@@ -328,4 +319,37 @@ public class OsuNetworkConnectionTest extends WifiBaseTest {
assertFalse(networkRequestCaptor.getValue().hasCapability(NET_CAPABILITY_TRUSTED));
}
+
+ /**
+ * Verifies that {@link WifiConfiguration} has been created properly for OSEN OSU network.
+ * It is supposed to create a network as ephemeral network with OSEN protocol and key management
+ * and suppress no internet access notification.
+ */
+ @Test
+ public void verifyWifiConfigurationForOsenOsuNetwork() {
+ mNetworkConnection.init(mHandler);
+
+ assertEquals(true, mNetworkConnection.connect(TEST_SSID, TEST_NAI_OSEN,
+ TEST_PROVIDER_NAME));
+
+ ArgumentCaptor<WifiConfiguration> wifiConfigurationCaptor = ArgumentCaptor.forClass(
+ WifiConfiguration.class);
+ verify(mWifiManager, times(1)).addNetwork(wifiConfigurationCaptor.capture());
+ WifiConfiguration wifiConfiguration = wifiConfigurationCaptor.getValue();
+ assertTrue(wifiConfiguration.isNoInternetAccessExpected());
+ assertTrue(wifiConfiguration.isEphemeral());
+ assertTrue(wifiConfiguration.osu);
+ assertTrue(wifiConfiguration.allowedProtocols.get(WifiConfiguration.Protocol.OSEN));
+ assertTrue(wifiConfiguration.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.OSEN));
+ assertEquals(wifiConfiguration.enterpriseConfig.getEapMethod(),
+ WifiEnterpriseConfig.Eap.UNAUTH_TLS);
+ assertEquals(wifiConfiguration.enterpriseConfig.getCaPath(),
+ WfaKeyStore.DEFAULT_WFA_CERT_DIR);
+ ArgumentCaptor<NetworkRequest> networkRequestCaptor = ArgumentCaptor.forClass(
+ NetworkRequest.class);
+ verify(mConnectivityManager, times(1)).requestNetwork(networkRequestCaptor.capture(),
+ any(ConnectivityManager.NetworkCallback.class), any(Handler.class), anyInt());
+ assertFalse(networkRequestCaptor.getValue().hasCapability(NET_CAPABILITY_TRUSTED));
+
+ }
}