summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2018-10-18 18:41:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-10-18 18:41:05 +0000
commite91ee97bc54facaa7cb7baf4830b7b10eed6bca3 (patch)
tree8f384974ef55fe4e3a4febe65a83b213c315bbac /tests
parentf857825efcf530ff1711c5caac41046c7494733f (diff)
parent41b87ae313f9fc7ab36fb5fcc070466f33112c25 (diff)
Merge "[WifiNetworkSelector] use wifiInfo to test sufficiency"
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
index 6a0dc1305..e723bcc40 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.*;
import android.content.Context;
import android.net.wifi.ScanResult;
+import android.net.wifi.SupplicantState;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiConfiguration.NetworkSelectionStatus;
import android.net.wifi.WifiInfo;
@@ -179,6 +180,7 @@ public class WifiNetworkSelectorTest {
private void setupWifiInfo() {
// simulate a disconnected state
+ when(mWifiInfo.getSupplicantState()).thenReturn(SupplicantState.DISCONNECTED);
when(mWifiInfo.is24GHz()).thenReturn(true);
when(mWifiInfo.is5GHz()).thenReturn(false);
when(mWifiInfo.getFrequency()).thenReturn(2400);
@@ -360,6 +362,7 @@ public class WifiNetworkSelectorTest {
// connect to test1
mWifiNetworkSelector.selectNetwork(scanDetails, blacklist, mWifiInfo, false, true, false);
+ when(mWifiInfo.getSupplicantState()).thenReturn(SupplicantState.COMPLETED);
when(mWifiInfo.getNetworkId()).thenReturn(0);
when(mWifiInfo.getBSSID()).thenReturn(bssids[0]);
when(mWifiInfo.is24GHz()).thenReturn(false);
@@ -407,6 +410,7 @@ public class WifiNetworkSelectorTest {
// connect to test1
mWifiNetworkSelector.selectNetwork(scanDetails, blacklist, mWifiInfo, false, true, false);
+ when(mWifiInfo.getSupplicantState()).thenReturn(SupplicantState.COMPLETED);
when(mWifiInfo.getNetworkId()).thenReturn(0);
when(mWifiInfo.getBSSID()).thenReturn(bssids[0]);
when(mWifiInfo.is24GHz()).thenReturn(false);
@@ -454,6 +458,7 @@ public class WifiNetworkSelectorTest {
// connect to test1
mWifiNetworkSelector.selectNetwork(scanDetails, blacklist, mWifiInfo, false, true, false);
+ when(mWifiInfo.getSupplicantState()).thenReturn(SupplicantState.COMPLETED);
when(mWifiInfo.getNetworkId()).thenReturn(0);
when(mWifiInfo.getBSSID()).thenReturn(bssids[0]);
when(mWifiInfo.is24GHz()).thenReturn(false);
@@ -534,6 +539,7 @@ public class WifiNetworkSelectorTest {
WifiConfiguration candidate = mWifiNetworkSelector.selectNetwork(scanDetails,
blacklist, mWifiInfo, false, true, false);
+ when(mWifiInfo.getSupplicantState()).thenReturn(SupplicantState.COMPLETED);
when(mWifiInfo.getNetworkId()).thenReturn(0);
when(mWifiInfo.getBSSID()).thenReturn(bssids[0]);
when(mWifiInfo.is24GHz()).thenReturn(true);
@@ -962,6 +968,7 @@ public class WifiNetworkSelectorTest {
WifiNetworkSelectorTestUtil.verifySelectedScanResult(mWifiConfigManager,
scanDetails.get(0).getScanResult(), candidate);
+ when(mWifiInfo.getSupplicantState()).thenReturn(SupplicantState.COMPLETED);
when(mWifiInfo.getNetworkId()).thenReturn(0);
when(mWifiInfo.getBSSID()).thenReturn(bssids[0]);
when(mWifiInfo.is24GHz()).thenReturn(!ScanResult.is5GHz(freqs[0]));