summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2019-07-25 20:03:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-07-25 20:03:45 +0000
commit1c65961bc213d53fbb49566bd71770fdafd22643 (patch)
tree44817f41fe2962e9dd6c70e1864e620797c8d8b1 /tests
parentf272b21563525d7c21735df8202a6e90e43f5b77 (diff)
parentfa0ca0bc40a1a7ba0c3701384a756d29ef54c38f (diff)
Merge "Wifi: add per-band Tx and Rx speed histogram in WifiMetrics and add rxLinkSpeed in logLinkMetrics() of WifiScoreReport" into qt-r1-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java55
1 files changed, 55 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 e45906a85..7e086d4ce 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -2577,6 +2577,45 @@ public class WifiMetricsTest {
}
/**
+ * Verify that Tx and Rx per-band LinkSpeedCounts are correctly logged in metrics
+ */
+ @Test
+ public void testTxRxLinkSpeedBandCounts() throws Exception {
+ when(mFacade.getIntegerSetting(eq(mContext),
+ eq(Settings.Global.WIFI_LINK_SPEED_METRICS_ENABLED), anyInt())).thenReturn(1);
+ mWifiMetrics.loadSettings();
+ for (int i = 0; i < NUM_LINK_SPEED_LEVELS_TO_INCREMENT; i++) {
+ for (int j = 0; j <= i; j++) {
+ mWifiMetrics.incrementTxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS + i, RSSI_POLL_FREQUENCY);
+ mWifiMetrics.incrementRxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS + i + 1, RSSI_POLL_FREQUENCY);
+ }
+ }
+ dumpProtoAndDeserialize();
+ assertEquals(0, mDecodedProto.txLinkSpeedCount2G.length);
+ assertEquals(0, mDecodedProto.rxLinkSpeedCount2G.length);
+ assertEquals(NUM_LINK_SPEED_LEVELS_TO_INCREMENT,
+ mDecodedProto.txLinkSpeedCount5GLow.length);
+ assertEquals(NUM_LINK_SPEED_LEVELS_TO_INCREMENT,
+ mDecodedProto.rxLinkSpeedCount5GLow.length);
+ assertEquals(0, mDecodedProto.txLinkSpeedCount5GMid.length);
+ assertEquals(0, mDecodedProto.rxLinkSpeedCount5GMid.length);
+ assertEquals(0, mDecodedProto.txLinkSpeedCount5GHigh.length);
+ assertEquals(0, mDecodedProto.rxLinkSpeedCount5GHigh.length);
+ for (int i = 0; i < NUM_LINK_SPEED_LEVELS_TO_INCREMENT; i++) {
+ assertEquals("Incorrect Tx link speed", WifiMetrics.MIN_LINK_SPEED_MBPS + i,
+ mDecodedProto.txLinkSpeedCount5GLow[i].key);
+ assertEquals("Incorrect Rx link speed", WifiMetrics.MIN_LINK_SPEED_MBPS + i + 1,
+ mDecodedProto.rxLinkSpeedCount5GLow[i].key);
+ assertEquals("Incorrect count of Tx link speed",
+ i + 1, mDecodedProto.txLinkSpeedCount5GLow[i].count);
+ assertEquals("Incorrect count of Rx link speed",
+ i + 1, mDecodedProto.rxLinkSpeedCount5GLow[i].count);
+ }
+ }
+
+ /**
* Verify that LinkSpeedCounts is not logged when disabled in settings
*/
@Test
@@ -2588,11 +2627,19 @@ public class WifiMetricsTest {
for (int j = 0; j <= i; j++) {
mWifiMetrics.incrementLinkSpeedCount(
WifiMetrics.MIN_LINK_SPEED_MBPS + i, TEST_RSSI_LEVEL);
+ mWifiMetrics.incrementTxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
+ mWifiMetrics.incrementRxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
}
}
dumpProtoAndDeserialize();
assertEquals("LinkSpeedCounts should not be logged when disabled in settings",
0, mDecodedProto.linkSpeedCounts.length);
+ assertEquals("Tx LinkSpeedCounts should not be logged when disabled in settings",
+ 0, mDecodedProto.txLinkSpeedCount5GLow.length);
+ assertEquals("Rx LinkSpeedCounts should not be logged when disabled in settings",
+ 0, mDecodedProto.rxLinkSpeedCount5GLow.length);
}
/**
@@ -2608,6 +2655,10 @@ public class WifiMetricsTest {
for (int i = 1; i < NUM_OUT_OF_BOUND_ENTRIES; i++) {
mWifiMetrics.incrementLinkSpeedCount(
WifiMetrics.MIN_LINK_SPEED_MBPS - i, MIN_RSSI_LEVEL);
+ mWifiMetrics.incrementTxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
+ mWifiMetrics.incrementRxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
}
for (int i = 1; i < NUM_OUT_OF_BOUND_ENTRIES; i++) {
mWifiMetrics.incrementLinkSpeedCount(
@@ -2620,6 +2671,10 @@ public class WifiMetricsTest {
dumpProtoAndDeserialize();
assertEquals("LinkSpeedCounts should not be logged for out of bound values",
0, mDecodedProto.linkSpeedCounts.length);
+ assertEquals("Tx LinkSpeedCounts should not be logged for out of bound values",
+ 0, mDecodedProto.txLinkSpeedCount5GLow.length);
+ assertEquals("Rx LinkSpeedCounts should not be logged for out of bound values",
+ 0, mDecodedProto.rxLinkSpeedCount5GLow.length);
}
private int nextRandInt() {