summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2018-03-19 22:56:12 -0700
committerRebecca Silberstein <silberst@google.com>2018-03-19 22:56:12 -0700
commitf2cde6f8bebc9ad0244733d384b3994f70082524 (patch)
tree8299674a033a72e2386dd93b0b97db59da7e1a09 /tests
parent563e1b048d0edd4a1ea95c555951f31b16b77f50 (diff)
WifiStateMachine: move WifiStateTracker call for disconnect
Update WifiStateTracker on leaving L2Connected state instead of entering Disconnected to also update upon mode switches. Added unit test covering a mode switch and a check for updates on connect. Bug: 74461854 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I357ac91818ad33a5c5ea093896f8141b950fbdd2
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index bc0958785..bec13cab2 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -1043,10 +1043,23 @@ public class WifiStateMachineTest {
assertEquals(sFreq, wifiInfo.getFrequency());
assertTrue(sWifiSsid.equals(wifiInfo.getWifiSsid()));
+ verify(mWifiStateTracker).updateState(eq(WifiStateTracker.CONNECTED));
assertEquals("ConnectedState", getCurrentState().getName());
}
/**
+ * Verify that WifiStateTracker is called if wifi is disabled while connected.
+ */
+ @Test
+ public void verifyWifiStateTrackerUpdatedWhenDisabled() throws Exception {
+ connect();
+
+ mWsm.setOperationalMode(WifiStateMachine.DISABLED_MODE);
+ mLooper.dispatchAll();
+ verify(mWifiStateTracker).updateState(eq(WifiStateTracker.DISCONNECTED));
+ }
+
+ /**
* Tests the network connection initiation sequence with no network request pending from
* from WifiNetworkFactory when we're already connected to a different network.
* This simulates the connect sequence using the public
@@ -1200,6 +1213,7 @@ public class WifiStateMachineTest {
eq(WifiConfiguration.NetworkSelectionStatus.DISABLED_AUTHENTICATION_FAILURE));
assertEquals("DisconnectedState", getCurrentState().getName());
+
}
/**
@@ -1300,6 +1314,7 @@ public class WifiStateMachineTest {
new StateChangeResult(0, sWifiSsid, sBSSID, SupplicantState.DISCONNECTED));
mLooper.dispatchAll();
+ verify(mWifiStateTracker).updateState(eq(WifiStateTracker.DISCONNECTED));
assertEquals("DisconnectedState", getCurrentState().getName());
}
@@ -1883,6 +1898,7 @@ public class WifiStateMachineTest {
// WifiInfo is reset() and state set to DISCONNECTED
mWsm.setOperationalMode(WifiStateMachine.SCAN_ONLY_MODE);
mLooper.dispatchAll();
+
assertEquals(WifiStateMachine.SCAN_ONLY_MODE, mWsm.getOperationalModeForTest());
assertEquals("ScanModeState", getCurrentState().getName());
assertEquals(WifiManager.WIFI_STATE_DISABLED, mWsm.syncGetWifiState());