summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-06-28 10:53:09 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-06-28 10:53:09 -0700
commitc7e287e5359429bc42623c67727b51d2b30a0596 (patch)
treeda57e4efd1381e203b03036b0a7363bf3310a496 /tests
parentb73fbc6ca444b1fa09809806a70ed17c675ea9bf (diff)
parent75096a862c74f03f96a22add51b96fd8244dbb60 (diff)
Merge "WifiNetworkSuggestionsManager: Persist enterprise credentials" into qt-dev am: d2aff57d02 am: 1b451a0ba3
am: 75096a862c Change-Id: Id528a460672cccf1b6f0ba652d210b9dca928ad2
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java b/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java
index eeaf5cd00..5c1dcb459 100644
--- a/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java
@@ -19,6 +19,7 @@ package com.android.server.wifi;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
+import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiNetworkSuggestion;
import android.util.Xml;
@@ -150,15 +151,30 @@ public class NetworkSuggestionStoreDataTest {
Map<String, PerAppInfo> networkSuggestionsMap = new HashMap<>();
PerAppInfo appInfo = new PerAppInfo(TEST_PACKAGE_NAME_1);
- WifiNetworkSuggestion networkSuggestion = new WifiNetworkSuggestion(
- WifiConfigurationTestUtil.createOpenNetwork(), false, false, TEST_UID_1,
+
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createEapNetwork();
+ configuration.enterpriseConfig =
+ WifiConfigurationTestUtil.createPEAPWifiEnterpriseConfigWithGTCPhase2();
+ WifiNetworkSuggestion networkSuggestion =
+ new WifiNetworkSuggestion(configuration, false, false, TEST_UID_1,
TEST_PACKAGE_NAME_1);
appInfo.hasUserApproved = false;
appInfo.extNetworkSuggestions.add(
ExtendedWifiNetworkSuggestion.fromWns(networkSuggestion, appInfo));
networkSuggestionsMap.put(TEST_PACKAGE_NAME_1, appInfo);
- assertSerializeDeserialize(networkSuggestionsMap);
+ Map<String, PerAppInfo> deserializedPerAppInfoMap =
+ assertSerializeDeserialize(networkSuggestionsMap);
+ ExtendedWifiNetworkSuggestion deserializedSuggestion =
+ deserializedPerAppInfoMap.get(TEST_PACKAGE_NAME_1).extNetworkSuggestions.stream()
+ .findAny()
+ .orElse(null);
+
+ WifiConfigurationTestUtil.assertConfigurationEqual(
+ configuration, deserializedSuggestion.wns.wifiConfiguration);
+ WifiConfigurationTestUtil.assertWifiEnterpriseConfigEqualForConfigStore(
+ configuration.enterpriseConfig,
+ deserializedSuggestion.wns.wifiConfiguration.enterpriseConfig);
}
/**
@@ -237,7 +253,7 @@ public class NetworkSuggestionStoreDataTest {
deserializeData(TEST_CORRUPT_DATA_INVALID_SSID.getBytes());
}
- private void assertSerializeDeserialize(
+ private Map<String, PerAppInfo> assertSerializeDeserialize(
Map<String, PerAppInfo> networkSuggestionsMap) throws Exception {
// Setup the data to serialize.
when(mDataSource.toSerialize()).thenReturn(networkSuggestionsMap);
@@ -250,5 +266,6 @@ public class NetworkSuggestionStoreDataTest {
ArgumentCaptor.forClass(HashMap.class);
verify(mDataSource).fromDeserialized(deserializedNetworkSuggestionsMap.capture());
assertEquals(networkSuggestionsMap, deserializedNetworkSuggestionsMap.getValue());
+ return deserializedNetworkSuggestionsMap.getValue();
}
}