summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2020-01-22 02:00:57 -0800
committerAhmed ElArabawy <arabawy@google.com>2020-01-22 15:27:43 -0800
commit670ff07dc34640e5e455b649b49633f697f85df6 (patch)
treeb72be05356803748c33e017d4759976f9f33be23 /tests
parent3bfce1a05ca0c6b200e5e0dd86674be7a861c83f (diff)
Perform partial initial scan with reduced channels
This commit adds an optional feature to perform a fast initial scanning with a reduced number of channels from the connected channel history. The maximum number of channels in the reduced scan, and the maximum age for the history are configurable. Bug: 141893780 Test: atest com.android.server.wifi Change-Id: I93081524b9fee6db13cfc989533cf38f6d270874
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java86
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index b7d5c3a04..e1c5c1d6f 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -2885,6 +2885,92 @@ public class WifiConfigManagerTest extends WifiBaseTest {
/**
* Verifies the creation of channel list using
+ * {@link WifiConfigManager#fetchChannelSetForPartialScan(long, int)}.
+ */
+ @Test
+ public void testFetchChannelSetForPartialScan() {
+ WifiConfiguration network1 = WifiConfigurationTestUtil.createPskNetwork();
+ NetworkUpdateResult result = verifyAddNetworkToWifiConfigManager(network1);
+
+ // Set it to enabled.
+ verifyUpdateNetworkSelectionStatus(
+ result.getNetworkId(), NetworkSelectionStatus.NETWORK_SELECTION_ENABLE, 0);
+
+ WifiConfiguration network2 = WifiConfigurationTestUtil.createOpenNetwork();
+ result = verifyAddNetworkToWifiConfigManager(network2);
+ // Set it to enabled.
+ verifyUpdateNetworkSelectionStatus(
+ result.getNetworkId(), NetworkSelectionStatus.NETWORK_SELECTION_ENABLE, 0);
+
+ // Create 3 scan results with different bssid's & frequencies to network1
+ String test_bssid_base = "af:89:56:34:56:6";
+ for (int i = 0; i < 3; i++) {
+ ScanDetail networkScanDetail =
+ createScanDetailForNetwork(
+ network1, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
+ assertNotNull(
+ mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
+ networkScanDetail));
+ }
+
+ // Create 2 scan results with different bssid's & frequencies to network2
+ for (int i = 3; i < TEST_FREQ_LIST.length; i++) {
+ ScanDetail networkScanDetail =
+ createScanDetailForNetwork(
+ network2, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
+ assertNotNull(
+ mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
+ networkScanDetail));
+ }
+
+ assertEquals(new HashSet<Integer>(Arrays.asList(TEST_FREQ_LIST)),
+ mWifiConfigManager.fetchChannelSetForPartialScan(100, 5));
+ }
+
+ /**
+ * Verify that the length of frequency set will not exceed the provided max value
+ */
+ @Test
+ public void testFetchChannelSetForPartialScanMaxCount() {
+ WifiConfiguration network1 = WifiConfigurationTestUtil.createPskNetwork();
+ NetworkUpdateResult result = verifyAddNetworkToWifiConfigManager(network1);
+
+ // Set it to enabled.
+ verifyUpdateNetworkSelectionStatus(
+ result.getNetworkId(), NetworkSelectionStatus.NETWORK_SELECTION_ENABLE, 0);
+
+ WifiConfiguration network2 = WifiConfigurationTestUtil.createOpenNetwork();
+ result = verifyAddNetworkToWifiConfigManager(network2);
+ // Set it to enabled.
+ verifyUpdateNetworkSelectionStatus(
+ result.getNetworkId(), NetworkSelectionStatus.NETWORK_SELECTION_ENABLE, 0);
+
+ // Create 3 scan results with different bssid's & frequencies to network1
+ String test_bssid_base = "af:89:56:34:56:6";
+ for (int i = 0; i < 3; i++) {
+ ScanDetail networkScanDetail =
+ createScanDetailForNetwork(
+ network1, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
+ assertNotNull(
+ mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
+ networkScanDetail));
+ }
+
+ // Create 2 scan results with different bssid's & frequencies to network2
+ for (int i = 3; i < TEST_FREQ_LIST.length; i++) {
+ ScanDetail networkScanDetail =
+ createScanDetailForNetwork(
+ network2, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
+ assertNotNull(
+ mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
+ networkScanDetail));
+ }
+
+ assertEquals(3, mWifiConfigManager.fetchChannelSetForPartialScan(100, 3).size());
+ }
+
+ /**
+ * Verifies the creation of channel list using
* {@link WifiConfigManager#fetchChannelSetForNetworkForPartialScan(int, long, int)}.
*/
@Test