summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2017-05-02 11:29:24 -0700
committerNingyuan Wang <nywang@google.com>2017-05-04 13:29:09 -0700
commita1da73ea4926ce8a5689594ff3685b0fe033d99f (patch)
treedc471a194d542c0b909ce9c0f15e53a4e383212b /tests
parentbd6f2f3e73224237808660fc89c6251797412caf (diff)
Update anonymous identity upon EAP network connection
This allows wifi framework to update anonymous identity provided by authenticator to network configuration. With this, supplicant can use pseudonym instead of permanent identity for EAP-SIM/AKA/AKA' networks. Bug: 37530183 Test: compile, unit tests, manual test Change-Id: Iaf9d709cbcaabb5b183ee14a23982bd99188b91e
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java17
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java12
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
index 74bdfa1c2..b0b31dfca 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
@@ -664,6 +664,23 @@ public class SupplicantStaIfaceHalTest {
}
/**
+ * Tests the getting of anonymous identity for the current network.
+ */
+ @Test
+ public void testGetCurrentNetworkEapAnonymousIdentity() throws Exception {
+ String anonymousIdentity = "aaa@bbb.ccc";
+ when(mSupplicantStaNetworkMock.fetchEapAnonymousIdentity())
+ .thenReturn(anonymousIdentity);
+ executeAndValidateInitializationSequence();
+
+ // Return null when not connected to the network.
+ assertEquals(null, mDut.getCurrentNetworkEapAnonymousIdentity());
+ executeAndValidateConnectSequence(4, false);
+ // Return anonymous identity for the current network.
+ assertEquals(anonymousIdentity, mDut.getCurrentNetworkEapAnonymousIdentity());
+ }
+
+ /**
* Tests the sending gsm auth response for the current network.
*/
@Test
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
index 302104854..6ea5c55ca 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
@@ -65,6 +65,7 @@ public class SupplicantStaNetworkHalTest {
}
private static final String NETWORK_EXTRAS_SERIALIZED =
"%7B%22key1%22%3A%22value1%22%2C%22key2%22%3A%22value2%22%7D";
+ private static final String ANONYMOUS_IDENTITY = "aaa@bbb.cc.ddd";
private SupplicantStaNetworkHal mSupplicantNetwork;
private SupplicantStatus mStatusSuccess;
@@ -798,6 +799,17 @@ public class SupplicantStaNetworkHalTest {
}
/**
+ * Verifies that fetachEapAnonymousIdentity() can get the anonymous identity from supplicant.
+ */
+ @Test
+ public void testFetchEapAnonymousIdentity() {
+ WifiConfiguration config = WifiConfigurationTestUtil.createEapNetwork();
+ config.enterpriseConfig.setAnonymousIdentity(ANONYMOUS_IDENTITY);
+ assertTrue(mSupplicantNetwork.saveWifiConfiguration(config));
+ assertEquals(ANONYMOUS_IDENTITY, mSupplicantNetwork.fetchEapAnonymousIdentity());
+ }
+
+ /**
* Sets up the HIDL interface mock with all the setters/getter values.
* Note: This only sets up the mock to return success on all methods.
*/