summaryrefslogtreecommitdiffstats
path: root/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-06-10 14:29:47 -0700
committerRoshan Pius <rpius@google.com>2016-06-10 16:06:41 -0700
commit5d3609b1931180c37d7292619146ad7d33df9a21 (patch)
tree9be7aa075fa52fedab81cabc4930bfa49d9bb311 /tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
parent030c5debfefddf0512cd53fec48b269c08d9972e (diff)
downloadandroid_frameworks_opt_net_wifi-5d3609b1931180c37d7292619146ad7d33df9a21.tar.gz
android_frameworks_opt_net_wifi-5d3609b1931180c37d7292619146ad7d33df9a21.tar.bz2
android_frameworks_opt_net_wifi-5d3609b1931180c37d7292619146ad7d33df9a21.zip
NetworkSelectionStatusXmlUtil: Add utility
Add a utility for |NetworkSelectionStatus| class serialization/ deserialization. While there, Fix the doc strings in the existing utils to add links to the original object they're trying to serialize deserialize. PS: Will add a follow up CL to shorten the method names of all these utils: NetworkSelectionStatusXmlUtil.parseFromXml/writeToXml. The current names are unnecessarily long. BUG: 29273147 Change-Id: I59f056a2b99e8583930b716707284d4ccf14392a TEST: Added Unit tests
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
index 874a52c40..2980d3fc2 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java
@@ -17,6 +17,7 @@
package com.android.server.wifi;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiConfiguration.NetworkSelectionStatus;
import android.net.wifi.WifiEnterpriseConfig;
import static org.junit.Assert.*;
@@ -146,5 +147,29 @@ public class WifiConfigurationTestUtil {
assertEquals(expected.lastUpdateUid, actual.lastUpdateUid);
assertEquals(expected.lastUpdateName, actual.lastUpdateName);
assertEquals(expected.lastConnectUid, actual.lastConnectUid);
+ assertNetworkSelectionStatusEqualForConfigStore(
+ expected.getNetworkSelectionStatus(), actual.getNetworkSelectionStatus());
+ }
+
+ /**
+ * Assert that the 2 NetworkSelectionStatus's are equal. This compares all the elements saved
+ * for config store.
+ */
+ public static void assertNetworkSelectionStatusEqualForConfigStore(
+ NetworkSelectionStatus expected, NetworkSelectionStatus actual) {
+ if (expected.isNetworkTemporaryDisabled()) {
+ // Temporarily disabled networks are enabled when persisted.
+ assertEquals(
+ NetworkSelectionStatus.NETWORK_SELECTION_ENABLED,
+ actual.getNetworkSelectionStatus());
+ } else {
+ assertEquals(expected.getNetworkSelectionStatus(), actual.getNetworkSelectionStatus());
+ }
+ assertEquals(
+ expected.getNetworkSelectionDisableReason(),
+ actual.getNetworkSelectionDisableReason());
+ assertEquals(expected.getConnectChoice(), actual.getConnectChoice());
+ assertEquals(expected.getConnectChoiceTimestamp(), actual.getConnectChoiceTimestamp());
+ assertEquals(expected.getHasEverConnected(), actual.getHasEverConnected());
}
}