summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-08-26 17:26:48 -0700
committerRoshan Pius <rpius@google.com>2016-09-01 15:02:27 -0700
commitb44c61bbdad7d973af94566172c99eb4ec502783 (patch)
treef29b651770e1355deaf9a4fd4881933ae11d8325 /tests
parent65245230dda9f9892af4d9b6afe82ae2e46aeb96 (diff)
WifiConfigManagerNew: Integrate to WSM (Part 3)
Changes in the CL: 1. Update the external status of the network as CURRENT after connection to it. 2. Reset the external status of the network as ENABLED after disconnection from it. 3. Remove connect choices from all networks when the network is removed. BUG: 31009287 Change-Id: I4fbaf0326302f4d2a1b60fd0f5bc1de26bfbf6a6 TEST: Unit tests TEST: Integrated with WSM and verified wifi connectivity.
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerNewTest.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerNewTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerNewTest.java
index 119f6c744..ced062061 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerNewTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerNewTest.java
@@ -1927,6 +1927,45 @@ public class WifiConfigManagerNewTest {
assertTrue(mWifiConfigManager.getConfiguredNetworks().isEmpty());
}
+ /**
+ * Verifies that the connect choice is removed from all networks when
+ * {@link WifiConfigManagerNew#removeNetwork(int, int)} is invoked.
+ */
+ @Test
+ public void testRemoveNetworkRemovesConnectChoice() throws Exception {
+ WifiConfiguration network1 = WifiConfigurationTestUtil.createOpenNetwork();
+ WifiConfiguration network2 = WifiConfigurationTestUtil.createPskNetwork();
+ WifiConfiguration network3 = WifiConfigurationTestUtil.createPskNetwork();
+ verifyAddNetworkToWifiConfigManager(network1);
+ verifyAddNetworkToWifiConfigManager(network2);
+ verifyAddNetworkToWifiConfigManager(network3);
+
+ // Set connect choice of network 2 over network 1.
+ assertTrue(
+ mWifiConfigManager.setNetworkConnectChoice(
+ network1.networkId, network2.configKey(), 78L));
+
+ WifiConfiguration retrievedNetwork =
+ mWifiConfigManager.getConfiguredNetwork(network1.networkId);
+ assertEquals(
+ network2.configKey(),
+ retrievedNetwork.getNetworkSelectionStatus().getConnectChoice());
+
+ // Remove network 3 and ensure that the connect choice on network 1 is not removed.
+ assertTrue(mWifiConfigManager.removeNetwork(network3.networkId, TEST_CREATOR_UID));
+ retrievedNetwork = mWifiConfigManager.getConfiguredNetwork(network1.networkId);
+ assertEquals(
+ network2.configKey(),
+ retrievedNetwork.getNetworkSelectionStatus().getConnectChoice());
+
+ // Now remove network 2 and ensure that the connect choice on network 1 is removed..
+ assertTrue(mWifiConfigManager.removeNetwork(network2.networkId, TEST_CREATOR_UID));
+ retrievedNetwork = mWifiConfigManager.getConfiguredNetwork(network1.networkId);
+ assertNotEquals(
+ network2.configKey(),
+ retrievedNetwork.getNetworkSelectionStatus().getConnectChoice());
+ }
+
private void createWifiConfigManager() {
mWifiConfigManager =
new WifiConfigManagerNew(