summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-04-03 08:16:23 -0700
committerRoshan Pius <rpius@google.com>2017-04-03 22:40:40 +0000
commitf581432bf2e9d11d2c1d959c203f76ba1fb90573 (patch)
tree58f27c767a4f32274011b96ee7f14844d9af5032 /tests
parent31eb1e8997a0ee98df33f6d8b3b907e0fcb070ed (diff)
WifiStateMachineTest: Fix test flake
Bug: 36843246 Bug: 36796809 Test: runtest.sh Change-Id: I6a4f204e3266dd249b85a15e60110d4fef641993
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index 80e29c6b1..e1a88915b 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -1304,18 +1304,16 @@ public class WifiStateMachineTest {
wpsInfo.setup = WpsInfo.PBC;
wpsInfo.BSSID = sBSSID;
- mLooper.startAutoDispatch();
mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo);
- mLooper.stopAutoDispatch();
+ mLooper.dispatchAll();
verify(mWifiNative).startWpsPbc(eq(sBSSID));
assertEquals("WpsRunningState", getCurrentState().getName());
setupMocksForWpsNetworkMigration();
- mLooper.startAutoDispatch();
mWsm.sendMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null);
- mLooper.stopAutoDispatch();
+ mLooper.dispatchAll();
assertEquals("DisconnectedState", getCurrentState().getName());
}
@@ -1334,9 +1332,8 @@ public class WifiStateMachineTest {
wpsInfo.setup = WpsInfo.PBC;
wpsInfo.BSSID = sBSSID;
- mLooper.startAutoDispatch();
mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo);
- mLooper.stopAutoDispatch();
+ mLooper.dispatchAll();
verify(mWifiNative).startWpsPbc(eq(sBSSID));
assertFalse("WpsRunningState".equals(getCurrentState().getName()));
@@ -1356,18 +1353,16 @@ public class WifiStateMachineTest {
wpsInfo.setup = WpsInfo.DISPLAY;
wpsInfo.BSSID = sBSSID;
- mLooper.startAutoDispatch();
mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo);
- mLooper.stopAutoDispatch();
+ mLooper.dispatchAll();
verify(mWifiNative).startWpsPinDisplay(eq(sBSSID));
assertEquals("WpsRunningState", getCurrentState().getName());
setupMocksForWpsNetworkMigration();
- mLooper.startAutoDispatch();
mWsm.sendMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null);
- mLooper.stopAutoDispatch();
+ mLooper.dispatchAll();
assertEquals("DisconnectedState", getCurrentState().getName());
}
@@ -1386,9 +1381,8 @@ public class WifiStateMachineTest {
wpsInfo.setup = WpsInfo.DISPLAY;
wpsInfo.BSSID = sBSSID;
- mLooper.startAutoDispatch();
mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo);
- mLooper.stopAutoDispatch();
+ mLooper.dispatchAll();
verify(mWifiNative).startWpsPinDisplay(eq(sBSSID));
assertFalse("WpsRunningState".equals(getCurrentState().getName()));
@@ -1415,9 +1409,8 @@ public class WifiStateMachineTest {
assertFalse("InitialState".equals(getCurrentState().getName()));
// Now trigger the death notification.
- mLooper.startAutoDispatch();
deathHandler.onDeath();
- mLooper.stopAutoDispatch();
+ mLooper.dispatchAll();
// We should back to initial state after vendor HAL death.
assertTrue("InitialState".equals(getCurrentState().getName()));