summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-05-18 05:09:08 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-18 05:09:08 +0000
commit49c5b299dbeefd39c6a2ed7b65b5f92262e7688b (patch)
treef11c25f71332e9e340c75a3eaa50b0302492a0cc /tests
parentfd9a6d5607bd6c92045f80046ae344a1275a06d7 (diff)
parent648915b024ce8a8aa35431b8d388fb6745407ba3 (diff)
Merge "WifiBackupRestore: Tighten key checks in string parsing" into oc-dev am: 526ca05b3f
am: 648915b024 Change-Id: Icd565145e9d7e7263306b50aa218498cd172939e
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