summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorxshu <xshu@google.com>2019-11-08 15:45:36 -0800
committerxshu <xshu@google.com>2019-11-18 12:38:53 -0800
commitd8cc34290cb74db931e0fceaf3e0ec4b8a380716 (patch)
tree8f0ac8502afb70d31d985f1b29a0088e057d43b6 /tests
parent8632ce63c665ab3537133631bdd169a5b2cb16a8 (diff)
Add SSID hotlist in DeviceConfig
Reads from DeviceConfig and parses a comma separated of SSIDs. Bug: 144172117 Test: atest FrameworksWifiTests Test: Manually tested on device Change-Id: I20f940b73a5b8d6818653b634e3a4e8d66ff4018
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java
index e23d402aa..900d3a7f3 100644
--- a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java
@@ -28,6 +28,7 @@ import android.os.Handler;
import android.os.test.TestLooper;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig.OnPropertiesChangedListener;
+import android.util.ArraySet;
import androidx.test.filters.SmallTest;
@@ -42,6 +43,9 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.MockitoSession;
+import java.util.Collections;
+import java.util.Set;
+
/**
* Unit tests for {@link com.android.server.wifi.DeviceConfigFacade}.
@@ -88,6 +92,12 @@ public class DeviceConfigFacadeTest extends WifiBaseTest {
return def;
}
});
+ when(DeviceConfig.getString(anyString(), anyString(), anyString()))
+ .then(new AnswerWithArguments() {
+ public String answer(String namespace, String field, String def) {
+ return def;
+ }
+ });
mDeviceConfigFacade = new DeviceConfigFacade(mContext, new Handler(mLooper.getLooper()),
mWifiMetrics);
@@ -125,6 +135,8 @@ public class DeviceConfigFacadeTest extends WifiBaseTest {
mDeviceConfigFacade.getDataStallTxPerThr());
assertEquals(DeviceConfigFacade.DEFAULT_DATA_STALL_CCA_LEVEL_THR,
mDeviceConfigFacade.getDataStallCcaLevelThr());
+ assertEquals(Collections.emptySet(),
+ mDeviceConfigFacade.getRandomizationFlakySsidHotlist());
// Simulate updating the fields
when(DeviceConfig.getBoolean(anyString(), eq("abnormal_connection_bugreport_enabled"),
@@ -144,9 +156,14 @@ public class DeviceConfigFacadeTest extends WifiBaseTest {
anyInt())).thenReturn(95);
when(DeviceConfig.getInt(anyString(), eq("data_stall_cca_level_thr"),
anyInt())).thenReturn(80);
+ when(DeviceConfig.getString(anyString(), eq("randomization_flaky_ssid_hotlist"),
+ anyString())).thenReturn("ssid_1,ssid_2");
mOnPropertiesChangedListenerCaptor.getValue().onPropertiesChanged(null);
// Verifying fields are updated to the new values
+ Set<String> randomizationFlakySsidSet = new ArraySet<>();
+ randomizationFlakySsidSet.add("\"ssid_1\"");
+ randomizationFlakySsidSet.add("\"ssid_2\"");
assertEquals(true, mDeviceConfigFacade.isAbnormalConnectionBugreportEnabled());
assertEquals(100, mDeviceConfigFacade.getAbnormalConnectionDurationMs());
assertEquals(true, mDeviceConfigFacade.isAggressiveMacRandomizationSsidWhitelistEnabled());
@@ -155,5 +172,7 @@ public class DeviceConfigFacadeTest extends WifiBaseTest {
assertEquals(1500, mDeviceConfigFacade.getDataStallRxTputThrKbps());
assertEquals(95, mDeviceConfigFacade.getDataStallTxPerThr());
assertEquals(80, mDeviceConfigFacade.getDataStallCcaLevelThr());
+ assertEquals(randomizationFlakySsidSet,
+ mDeviceConfigFacade.getRandomizationFlakySsidHotlist());
}
}