summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Qiu <zqiu@google.com>2017-03-10 13:59:46 -0800
committerPeter Qiu <zqiu@google.com>2017-03-16 11:10:31 -0700
commit9ef555a48ac600c8766f703fa60db15b69e20301 (patch)
tree62a845c8a57e3237fcc4e700f4ae209aa9091298 /tests
parent018e39e2f6201519373e7f4dbb1427f0e5274898 (diff)
WifiConfigurationXmlUtil: persist additional fields for legacy Passpoint configuration
When migrating legacy Passpoint configurations, the configuration will only get migrated when its owner logs in. In the meantime, we will need persist all the required data in the share store temporarily. So persist the additional required fields for Passpoint to the storage to avoid any data loss in the case when migration took multiple boots to complete. Bug: 36099588 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: manual test updating a device from N to O, verify all configs are migrated. Change-Id: I040dfd9f207ed1a9b2e3ccd50eca50560d6e1444
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java1
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java16
4 files changed, 25 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java b/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java
index 7532b7d31..01257c16e 100644
--- a/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java
@@ -83,6 +83,8 @@ public class NetworkListStoreDataTest {
+ "<int name=\"LastUpdateUid\" value=\"-1\" />\n"
+ "<null name=\"LastUpdateName\" />\n"
+ "<int name=\"LastConnectUid\" value=\"0\" />\n"
+ + "<boolean name=\"IsLegacyPasspointConfig\" value=\"false\" />\n"
+ + "<long-array name=\"RoamingConsortiumOIs\" num=\"0\" />\n"
+ "</WifiConfiguration>\n"
+ "<NetworkStatus>\n"
+ "<string name=\"SelectionStatus\">NETWORK_SELECTION_ENABLED</string>\n"
@@ -131,6 +133,8 @@ public class NetworkListStoreDataTest {
+ "<int name=\"LastUpdateUid\" value=\"-1\" />\n"
+ "<null name=\"LastUpdateName\" />\n"
+ "<int name=\"LastConnectUid\" value=\"0\" />\n"
+ + "<boolean name=\"IsLegacyPasspointConfig\" value=\"false\" />\n"
+ + "<long-array name=\"RoamingConsortiumOIs\" num=\"0\" />\n"
+ "</WifiConfiguration>\n"
+ "<NetworkStatus>\n"
+ "<string name=\"SelectionStatus\">NETWORK_SELECTION_ENABLED</string>\n"
@@ -158,6 +162,8 @@ public class NetworkListStoreDataTest {
+ "<string name=\"CaPath\"></string>\n"
+ "<int name=\"EapMethod\" value=\"2\" />\n"
+ "<int name=\"Phase2Method\" value=\"0\" />\n"
+ + "<string name=\"PLMN\"></string>\n"
+ + "<string name=\"Realm\"></string>\n"
+ "</WifiEnterpriseConfiguration>\n"
+ "</Network>\n";
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java
index 9b5af549f..47efed3c4 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java
@@ -99,6 +99,8 @@ public class WifiConfigStoreTest {
+ "<int name=\"LastUpdateUid\" value=\"-1\" />\n"
+ "<null name=\"LastUpdateName\" />\n"
+ "<int name=\"LastConnectUid\" value=\"0\" />\n"
+ + "<boolean name=\"IsLegacyPasspointConfig\" value=\"false\" />\n"
+ + "<long-array name=\"RoamingConsortiumOIs\" num=\"0\" />\n"
+ "</WifiConfiguration>\n"
+ "<NetworkStatus>\n"
+ "<string name=\"SelectionStatus\">NETWORK_SELECTION_ENABLED</string>\n"
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
index 6b411dad5..917a64cc9 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
@@ -455,6 +455,7 @@ public class WifiConfigurationTestUtil {
assertEquals(expected.lastUpdateName, actual.lastUpdateName);
assertEquals(expected.lastConnectUid, actual.lastConnectUid);
assertEquals(expected.updateTime, actual.updateTime);
+ assertEquals(expected.isLegacyPasspointConfig, actual.isLegacyPasspointConfig);
assertNetworkSelectionStatusEqualForConfigStore(
expected.getNetworkSelectionStatus(), actual.getNetworkSelectionStatus());
assertWifiEnterpriseConfigEqualForConfigStore(
diff --git a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java
index fdb26e489..d61809882 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java
@@ -396,6 +396,22 @@ public class XmlUtilTest {
deserializeWifiEnterpriseConfig(xmlString.getBytes(StandardCharsets.UTF_8));
}
+ /**
+ * Verify that WifiConfiguration representation of a legacy Passpoint configuration is
+ * serialized & deserialized correctly.
+ *
+ *@throws Exception
+ */
+ @Test
+ public void testLegacyPasspointConfigSerializeDeserialize() throws Exception {
+ WifiConfiguration config = WifiConfigurationTestUtil.createPasspointNetwork();
+ config.isLegacyPasspointConfig = true;
+ config.roamingConsortiumIds = new long[] {0x12345678};
+ config.enterpriseConfig.setPlmn("1234");
+ config.enterpriseConfig.setRealm("test.com");
+ serializeDeserializeWifiConfigurationForConfigStore(config);
+ }
+
private byte[] serializeWifiConfigurationForBackup(WifiConfiguration configuration)
throws IOException, XmlPullParserException {
final XmlSerializer out = new FastXmlSerializer();