summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-09-02 21:53:51 -0700
committerRoshan Pius <rpius@google.com>2016-09-02 22:38:19 -0700
commit19445ad39f8eb6229d3a08ec9b713534ed5a759e (patch)
treec3a186bab9ecaf4f6141d758606e126b40e22b5f /tests
parent0f166e9103c4ef46eaa49ad20359ce0db2ef9791 (diff)
WifiConfigStoreData: Check WifiEntepriseConfig validity
Ensure that that the enterprise config data is valid using the eap method. This is initialized to -1 (NONE). Using the the existing |WifiConfiguration.isEnterprise()| leaves us in the mercy of apps providing a valid enterpiseConfig field. BUG: 31275240 TEST: Added Unit test. The test reproduces the exception reported in the bug without the fix. Change-Id: Ie9c5ee17315798b175bac23e03fc600c9e4a1d7b
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigStoreDataTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreDataTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreDataTest.java
index a718c33bb..f16c0748a 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreDataTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreDataTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiEnterpriseConfig;
import android.net.wifi.WifiConfiguration.NetworkSelectionStatus;
import android.test.suitebuilder.annotation.SmallTest;
@@ -29,6 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
@@ -191,6 +193,20 @@ public class WifiConfigStoreDataTest {
}
/**
+ * Verify that a network with invalid entepriseConfig data is serialized/deserialized
+ * correctly.
+ */
+ @Test
+ public void testInvalidEnterpriseConfig()
+ throws XmlPullParserException, IOException {
+ WifiConfiguration eapNetwork = WifiConfigurationTestUtil.createEapNetwork();
+ eapNetwork.enterpriseConfig = new WifiEnterpriseConfig();
+ List<WifiConfiguration> configurations = Arrays.asList(eapNetwork);
+ serializeDeserializeConfigStoreData(
+ new ArrayList<WifiConfiguration>(), configurations, false, false);
+ }
+
+ /**
* Verify that the manually populated xml string for is deserialized/serialized correctly.
* This generates a store data corresponding to the XML string and verifies that the string
* is indeed parsed correctly to the store data.