summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-10-22 15:37:41 -0700
committerRoshan Pius <rpius@google.com>2019-11-07 08:35:46 -0800
commitcfd19bcad81694a862df0e54f13c98c2046a9245 (patch)
tree421e1658a7b7d4b759dc94a868bfdf199ddd4f39 /tests
parent35a49d0825a4919677c6be3e6ccb5b64b61ad4a3 (diff)
WifiConfigStore: Encrypt credentials for networks (2/4)
Plumb the EncryptionUtil & version info to the XmlUtil classes that actually handle the serialization/deserialization of data. Also, created a helper class to serialize/deserialize EncryptedData class. Bug: 140485110 Test: atest com.android.server.wifi Change-Id: I92846f1fb63f3b85892750b195a535bcfdc03e2c
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java12
1 files changed, 8 insertions, 4 deletions
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 e2a341187..ab18de87c 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java
@@ -475,7 +475,8 @@ public class XmlUtilTest extends WifiBaseTest {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
out.setOutput(outputStream, StandardCharsets.UTF_8.name());
XmlUtil.writeDocumentStart(out, mXmlDocHeader);
- WifiConfigurationXmlUtil.writeToXmlForConfigStore(out, configuration);
+ WifiConfigurationXmlUtil.writeToXmlForConfigStore(
+ out, configuration, mock(WifiConfigStoreEncryptionUtil.class));
XmlUtil.writeDocumentEnd(out, mXmlDocHeader);
return outputStream.toByteArray();
}
@@ -487,7 +488,8 @@ public class XmlUtilTest extends WifiBaseTest {
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
in.setInput(inputStream, StandardCharsets.UTF_8.name());
XmlUtil.gotoDocumentStart(in, mXmlDocHeader);
- return WifiConfigurationXmlUtil.parseFromXml(in, in.getDepth());
+ return WifiConfigurationXmlUtil.parseFromXml(
+ in, in.getDepth(), false, mock(WifiConfigStoreEncryptionUtil.class));
}
/**
@@ -595,7 +597,8 @@ public class XmlUtilTest extends WifiBaseTest {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
out.setOutput(outputStream, StandardCharsets.UTF_8.name());
XmlUtil.writeDocumentStart(out, mXmlDocHeader);
- WifiEnterpriseConfigXmlUtil.writeToXml(out, config);
+ WifiEnterpriseConfigXmlUtil.writeToXml(
+ out, config, mock(WifiConfigStoreEncryptionUtil.class));
XmlUtil.writeDocumentEnd(out, mXmlDocHeader);
return outputStream.toByteArray();
}
@@ -606,7 +609,8 @@ public class XmlUtilTest extends WifiBaseTest {
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
in.setInput(inputStream, StandardCharsets.UTF_8.name());
XmlUtil.gotoDocumentStart(in, mXmlDocHeader);
- return WifiEnterpriseConfigXmlUtil.parseFromXml(in, in.getDepth());
+ return WifiEnterpriseConfigXmlUtil.parseFromXml(
+ in, in.getDepth(), false, mock(WifiConfigStoreEncryptionUtil.class));
}
private void serializeDeserializeWifiEnterpriseConfig(WifiEnterpriseConfig config)