summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-05-18 05:03:39 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-18 05:03:39 +0000
commit648915b024ce8a8aa35431b8d388fb6745407ba3 (patch)
treebcfc855ffc3896176ccce3abab16959ed64419ac /tests
parent58f2ade07f35ccdbfb2a97367e329447271f6706 (diff)
parent526ca05b3fe1f92a49c55411cd4901ef0f787782 (diff)
Merge "WifiBackupRestore: Tighten key checks in string parsing" into oc-dev
am: 526ca05b3f Change-Id: I2c459a55d06409b83ab23898f668eb89ce6f37bc
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java
index 10b5117ca..362540517 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java
@@ -632,6 +632,37 @@ public class WifiBackupRestoreTest {
}
/**
+ * Verifying that backup data containing some unknown keys is properly restored.
+ * The backup data used here is a PII masked version of a backup data seen in a reported bug.
+ */
+ @Test
+ public void testSingleNetworkSupplicantBackupRestoreWithUnknownEAPKey() {
+ String backupSupplicantConfNetworkBlock = "network={\n"
+ + "ssid=" + WifiConfigurationTestUtil.TEST_SSID + "\n"
+ + "psk=" + WifiConfigurationTestUtil.TEST_PSK + "\n"
+ + "key_mgmt=WPA-PSK WPA-PSK-SHA256\n"
+ + "priority=18\n"
+ + "id_str=\"%7B%22creatorUid%22%3A%221000%22%2C%22configKey"
+ + "%22%3A%22%5C%22BLAH%5C%22WPA_PSK%22%7D\"\n"
+ + "eapRetryCount=6\n";
+ byte[] supplicantData = backupSupplicantConfNetworkBlock.getBytes();
+ List<WifiConfiguration> retrievedConfigurations =
+ mWifiBackupRestore.retrieveConfigurationsFromSupplicantBackupData(
+ supplicantData, null);
+
+ final WifiConfiguration expectedConfiguration = new WifiConfiguration();
+ expectedConfiguration.SSID = WifiConfigurationTestUtil.TEST_SSID;
+ expectedConfiguration.preSharedKey = WifiConfigurationTestUtil.TEST_PSK;
+ expectedConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
+
+ ArrayList<WifiConfiguration> expectedConfigurations = new ArrayList<WifiConfiguration>() {{
+ add(expectedConfiguration);
+ }};
+ WifiConfigurationTestUtil.assertConfigurationsEqualForBackup(
+ expectedConfigurations, retrievedConfigurations);
+ }
+
+ /**
* Verify that any corrupted data provided by Backup/Restore is ignored correctly.
*/
@Test