summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2016-08-03 15:48:13 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-08-03 15:48:13 +0000
commitc2a5d4f9e80350923ad64cdb0818ec6d77578bfa (patch)
treec043e5090ea70bdec0249790780df1c66e337a6b /tests
parente99577c248bca18c8877b541a13cbe9834aac8b9 (diff)
parent24750cd1f8148d6a935bda96f3b17f22b0c1d8bd (diff)
WifiController: correct active state after ap mode
am: 24750cd1f8 Change-Id: I7500d167c66f4c27f4160d61df5ef2c756d67bf4
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java
index 8f1b23e2a..c187faf27 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiControllerTest.java
@@ -272,6 +272,34 @@ public class WifiControllerTest {
}
/**
+ * When AP mode is enabled and wifi is toggled on, we should transition to
+ * DeviceActiveState after the AP is disabled.
+ * Enter DeviceActiveState, activate AP mode, toggle WiFi.
+ * <p>
+ * Expected: AP should successfully start and exit, then return to DeviceActiveState.
+ */
+ @Test
+ public void testReturnToDeviceActiveStateAfterWifiEnabledShutdown() throws Exception {
+ enableWifi();
+ assertEquals("DeviceActiveState", getCurrentState().getName());
+
+ mWifiController.obtainMessage(CMD_SET_AP, 1, 0).sendToTarget();
+ mLooper.dispatchAll();
+ assertEquals("ApEnabledState", getCurrentState().getName());
+
+ when(mSettingsStore.isWifiToggleEnabled()).thenReturn(true);
+ mWifiController.obtainMessage(CMD_WIFI_TOGGLED).sendToTarget();
+ mWifiController.obtainMessage(CMD_AP_STOPPED).sendToTarget();
+ mLooper.dispatchAll();
+
+ InOrder inOrder = inOrder(mWifiStateMachine);
+ inOrder.verify(mWifiStateMachine).setSupplicantRunning(true);
+ inOrder.verify(mWifiStateMachine).setOperationalMode(WifiStateMachine.CONNECT_MODE);
+ inOrder.verify(mWifiStateMachine).setDriverStart(true);
+ assertEquals("DeviceActiveState", getCurrentState().getName());
+ }
+
+ /**
* When the wifi device is idle, AP mode is enabled and disabled
* we should return to the appropriate Idle state.
* Enter DeviceActiveState, indicate idle device, activate AP mode, disable AP mode.