From bab1104d9cdce66688e45aa04f49d36966bc49e0 Mon Sep 17 00:00:00 2001 From: Randy Pan Date: Tue, 8 Nov 2016 17:03:32 -0800 Subject: WNS: feed filtered scan results to network evaluators Bug: 32745148 Test: Wifi unit tests Change-Id: I32a3e8e2698f2ab7aa58123c0606872e762e151d --- .../server/wifi/WifiNetworkSelectorTest.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java index 5a1645915..3127a0132 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java @@ -487,4 +487,37 @@ public class WifiNetworkSelectorTest { WifiNetworkSelectorTestUtil.verifySelectedScanResult(mWifiConfigManager, chosenScanResult, candidate); } + + /** + * No network selection if the currently connected on is already sufficient. + * + * WifiStateMachine is disconnected. + * scanDetails contains a network which is blacklisted. + * + * Expected behavior: no network recommended by Network Selector + */ + @Test + public void filterOutBlacklistedBssid() { + String[] ssids = {"\"test1\""}; + String[] bssids = {"6c:f3:7f:ae:8c:f3"}; + int[] freqs = {5180}; + String[] caps = {"[WPA2-EAP-CCMP][ESS]"}; + int[] levels = {mThresholdQualifiedRssi5G + 8}; + int[] securities = {SECURITY_PSK}; + + ScanDetailsAndWifiConfigs scanDetailsAndConfigs = + WifiNetworkSelectorTestUtil.setupScanDetailsAndConfigStore(ssids, bssids, + freqs, caps, levels, securities, mWifiConfigManager, mClock); + List scanDetails = scanDetailsAndConfigs.getScanDetails(); + + // Disable this network for BSSID_BLACKLIST_THRESHOLD times so it gets + // blacklisted by WNS. + for (int i = 0; i < WifiNetworkSelector.BSSID_BLACKLIST_THRESHOLD; i++) { + mWifiNetworkSelector.enableBssidForNetworkSelection(bssids[0], false); + } + + WifiConfiguration candidate = mWifiNetworkSelector.selectNetwork(scanDetails, + mWifiInfo, false, true, false); + assertEquals("Expect null configuration", null, candidate); + } } -- cgit v1.2.3