summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-08-19 14:08:00 -0700
committerRoshan Pius <rpius@google.com>2016-08-19 14:08:00 -0700
commit274cb7b17018d86ea71e97fdcf7e9a8e12a3ec57 (patch)
treedf84f2d1a7bebb9bdcdba9381415dfcf78f03322 /tests
parentce98615677a3f99d8fec8826ea1e0f1eeedb0692 (diff)
parente78bb65416985cecbcba31b31a5565b54ed0a5c7 (diff)
resolve merge conflicts of e78bb65 to master
Change-Id: Ieab0520573b62ed35480af80620f2e5e3aa8b12c
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
index 35e7ce3d2..f082034fc 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
@@ -215,6 +215,43 @@ public class SupplicantPnoScannerTest {
verifyNoMoreInteractions(pnoEventHandler);
}
+ /**
+ * Verify that the HW PNO scan stop failure still resets the PNO scan state.
+ * 1. Start Hw PNO.
+ * 2. Stop Hw PNO scan which raises a stop command to WifiNative which is failed.
+ * 3. Now restart a new PNO scan to ensure that the failure was cleanly handled.
+ */
+ @Test
+ public void ignoreHwDisconnectedPnoScanStopFailure() {
+ createScannerWithHwPnoScanSupport();
+
+ WifiNative.PnoEventHandler pnoEventHandler = mock(WifiNative.PnoEventHandler.class);
+ WifiNative.PnoSettings pnoSettings = createDummyPnoSettings(false);
+
+ // Start PNO scan
+ startSuccessfulPnoScan(null, pnoSettings, null, pnoEventHandler);
+
+ // Fail the PNO stop.
+ when(mWifiNative.setPnoScan(false)).thenReturn(false);
+ assertTrue(mScanner.resetHwPnoList());
+ assertTrue("dispatch pno monitor alarm",
+ mAlarmManager.dispatch(
+ SupplicantWifiScannerImpl.HwPnoDebouncer.PNO_DEBOUNCER_ALARM_TAG));
+ mLooper.dispatchAll();
+ verify(mWifiNative).setPnoScan(false);
+
+ // Add a new PNO scan request and ensure it runs successfully.
+ startSuccessfulPnoScan(null, pnoSettings, null, pnoEventHandler);
+ assertTrue("dispatch pno monitor alarm",
+ mAlarmManager.dispatch(
+ SupplicantWifiScannerImpl.HwPnoDebouncer.PNO_DEBOUNCER_ALARM_TAG));
+ mLooper.dispatchAll();
+ InOrder order = inOrder(pnoEventHandler, mWifiNative);
+ ScanResults scanResults = createDummyScanResults();
+ expectSuccessfulHwDisconnectedPnoScan(order, pnoSettings, pnoEventHandler, scanResults);
+ verifyNoMoreInteractions(pnoEventHandler);
+ }
+
private void doSuccessfulSwPnoScanTest(boolean isConnectedPno) {
WifiNative.PnoEventHandler pnoEventHandler = mock(WifiNative.PnoEventHandler.class);
WifiNative.PnoSettings pnoSettings = createDummyPnoSettings(isConnectedPno);
@@ -276,6 +313,7 @@ public class SupplicantPnoScannerTest {
private void startSuccessfulPnoScan(WifiNative.ScanSettings scanSettings,
WifiNative.PnoSettings pnoSettings, WifiNative.ScanEventHandler scanEventHandler,
WifiNative.PnoEventHandler pnoEventHandler) {
+ reset(mWifiNative);
when(mWifiNative.setNetworkVariable(anyInt(), anyString(), anyString())).thenReturn(true);
when(mWifiNative.enableNetworkWithoutConnect(anyInt())).thenReturn(true);
// Scans succeed