summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorxshu <xshu@google.com>2020-04-23 02:31:03 -0700
committerxshu <xshu@google.com>2020-04-23 03:16:03 -0700
commit00355555f01550d6564908b503bc45daab3b47cb (patch)
treef6fdd25f44f1f6b30f33d05c010cf2b7e29528d2 /tests
parenta6153ba33006c65b5507f847d7a5b847ebef001d (diff)
Settings toggle value metrics
Collects metrics on status of the following toggles: - wifi verbose logging (developer option) - wifi scanning - enhanced MAC randomization (developer option) Bug: 153925826 Test: atest com.android.server.wifi Change-Id: I4538f4c4535b0c68a2234f60ecb5a4d9a860f9d4
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java8
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java3
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 191f81cee..0b9885c93 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -317,6 +317,8 @@ public class WifiMetricsTest extends WifiBaseTest {
- NUM_NETWORKS_ADDED_BY_USER;
private static final boolean TEST_VAL_IS_LOCATION_ENABLED = true;
private static final boolean IS_SCANNING_ALWAYS_ENABLED = true;
+ private static final boolean IS_VERBOSE_LOGGING_ENABLED = true;
+ private static final boolean IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED = true;
private static final int NUM_EMPTY_SCAN_RESULTS = 19;
private static final int NUM_NON_EMPTY_SCAN_RESULTS = 23;
private static final int NUM_SCAN_UNKNOWN = 1;
@@ -681,6 +683,9 @@ public class WifiMetricsTest extends WifiBaseTest {
mWifiMetrics.setIsLocationEnabled(TEST_VAL_IS_LOCATION_ENABLED);
mWifiMetrics.setIsScanningAlwaysEnabled(IS_SCANNING_ALWAYS_ENABLED);
+ mWifiMetrics.setVerboseLoggingEnabled(IS_VERBOSE_LOGGING_ENABLED);
+ mWifiMetrics.setEnhancedMacRandomizationForceEnabled(
+ IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED);
for (int i = 0; i < NUM_EMPTY_SCAN_RESULTS; i++) {
mWifiMetrics.incrementEmptyScanResultCount();
@@ -1153,6 +1158,9 @@ public class WifiMetricsTest extends WifiBaseTest {
TEST_VAL_IS_LOCATION_ENABLED, mDecodedProto.isLocationEnabled);
assertEquals("mDecodedProto.isScanningAlwaysEnabled == IS_SCANNING_ALWAYS_ENABLED",
IS_SCANNING_ALWAYS_ENABLED, mDecodedProto.isScanningAlwaysEnabled);
+ assertEquals(IS_VERBOSE_LOGGING_ENABLED, mDecodedProto.isVerboseLoggingEnabled);
+ assertEquals(IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED,
+ mDecodedProto.isEnhancedMacRandomizationForceEnabled);
assertEquals("mDecodedProto.numEmptyScanResults == NUM_EMPTY_SCAN_RESULTS",
NUM_EMPTY_SCAN_RESULTS, mDecodedProto.numEmptyScanResults);
assertEquals("mDecodedProto.numNonEmptyScanResults == NUM_NON_EMPTY_SCAN_RESULTS",
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index 814cfc756..9caac1ff8 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -510,6 +510,9 @@ public class WifiServiceImplTest extends WifiBaseTest {
public void testWifiMetricsDump() {
mWifiServiceImpl.dump(new FileDescriptor(), new PrintWriter(new StringWriter()),
new String[]{mWifiMetrics.PROTO_DUMP_ARG});
+ verify(mWifiMetrics).setEnhancedMacRandomizationForceEnabled(anyBoolean());
+ verify(mWifiMetrics).setIsScanningAlwaysEnabled(anyBoolean());
+ verify(mWifiMetrics).setVerboseLoggingEnabled(anyBoolean());
verify(mWifiMetrics)
.dump(any(FileDescriptor.class), any(PrintWriter.class), any(String[].class));
verify(mClientModeImpl, never())