summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSohani Rao <sohanirao@google.com>2017-07-09 15:23:01 -0700
committerSohani Rao <sohanirao@google.com>2017-08-16 15:27:08 -0700
commit71c4c2a898a827a867564159ce78e41aedd2295b (patch)
tree538c5f66e18922e52cbe190b1a048badaed4ea18 /tests
parent85c806c0d32bb30f421ebc372a59b2f3ea2dce41 (diff)
Introduce new API for retrieving PNO scan results
Create a seperation of code paths for retrieving scan results from single scan vs those from a PNO scan. This enables the underlying implementation to return PNO scan results from the interface that most recently completed the scans while ensuring no changes to the way single scan results are returned to the framework. Bug: 63148974 Test: Unit tests, on-device test for connecting to a network found by Offload HAL during Pno scans Change-Id: I6002f6df05e40fe24ff12f4a49599343578873f4
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WificondControlTest.java12
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java3
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
index 4dfa4cd75..164f75999 100644
--- a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
@@ -460,7 +460,8 @@ public class WificondControlTest {
assertTrue(mWificondControl.tearDownInterfaces());
// getScanResults should fail.
- assertEquals(0, mWificondControl.getScanResults().size());
+ assertEquals(0,
+ mWificondControl.getScanResults(WificondControl.SCAN_TYPE_SINGLE_SCAN).size());
}
/**
@@ -475,7 +476,8 @@ public class WificondControlTest {
NativeScanResult[] mockScanResults = {MOCK_NATIVE_SCAN_RESULT};
when(scanner.getScanResults()).thenReturn(mockScanResults);
- ArrayList<ScanDetail> returnedScanResults = mWificondControl.getScanResults();
+ ArrayList<ScanDetail> returnedScanResults = mWificondControl.getScanResults(
+ WificondControl.SCAN_TYPE_SINGLE_SCAN);
// The test IEs {@link #TEST_INFO_ELEMENT} doesn't contained RSN IE, which means non-EAP
// AP. So verify carrier network is not checked, since EAP is currently required for a
// carrier network.
@@ -522,7 +524,8 @@ public class WificondControlTest {
.thenReturn(eapType);
when(mCarrierNetworkConfig.getCarrierName(new String(nativeScanResult.ssid)))
.thenReturn(carrierName);
- ArrayList<ScanDetail> returnedScanResults = mWificondControl.getScanResults();
+ ArrayList<ScanDetail> returnedScanResults = mWificondControl.getScanResults(
+ WificondControl.SCAN_TYPE_SINGLE_SCAN);
assertEquals(1, returnedScanResults.size());
// Verify returned scan result.
ScanResult scanResult = returnedScanResults.get(0).getScanResult();
@@ -535,7 +538,8 @@ public class WificondControlTest {
// AP not associated with a carrier network.
when(mCarrierNetworkConfig.isCarrierNetwork(new String(nativeScanResult.ssid)))
.thenReturn(false);
- returnedScanResults = mWificondControl.getScanResults();
+ returnedScanResults = mWificondControl.getScanResults(
+ WificondControl.SCAN_TYPE_SINGLE_SCAN);
assertEquals(1, returnedScanResults.size());
// Verify returned scan result.
scanResult = returnedScanResults.get(0).getScanResult();
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java
index c63a9a042..974cf6635 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/WificondPnoScannerTest.java
@@ -429,6 +429,7 @@ public class WificondPnoScannerTest {
expectHwDisconnectedPnoScanStart(order, pnoSettings);
// Setup scan results
+ when(mWifiNative.getPnoScanResults()).thenReturn(scanResults.getScanDetailArrayList());
when(mWifiNative.getScanResults()).thenReturn(scanResults.getScanDetailArrayList());
// Notify scan has finished
@@ -451,6 +452,7 @@ public class WificondPnoScannerTest {
order.verify(mWifiNative).scan(eq(expectedScanFreqs), any(Set.class));
+ when(mWifiNative.getPnoScanResults()).thenReturn(scanResults.getScanDetailArrayList());
when(mWifiNative.getScanResults()).thenReturn(scanResults.getScanDetailArrayList());
// Notify scan has finished
@@ -478,6 +480,7 @@ public class WificondPnoScannerTest {
// Setup scan results
when(mWifiNative.getScanResults()).thenReturn(scanResults.getScanDetailArrayList());
+ when(mWifiNative.getPnoScanResults()).thenReturn(scanResults.getScanDetailArrayList());
// Notify scan has finished
mWifiMonitor.sendMessage(mWifiNative.getInterfaceName(), WifiMonitor.SCAN_RESULTS_EVENT);