summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMingguang Xu <mingguangxu@google.com>2019-03-27 15:32:48 -0700
committerMingguang Xu <mingguangxu@google.com>2019-03-29 16:55:08 -0700
commit7267db0fa7dd9ac9bffd4d376b90ea944aef5a72 (patch)
treec3b38b0ff0e1039bc23e2e87120740907358dcdc /tests
parent793f05e61dc14bd53d7bcc631728904edbfbcc52 (diff)
Wifi usability: Add firmware alert reason code into WifiUsabilityStats
Firmware alert can trigger Wifi usability stats data collection. Currently the reason code of firmware alert is not collected as an attribute. Populate the reason code when collecting Wifi usability stats. Bug: 129426122 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I990496ac25b47e6d7fc75e6a383ed4988d9c3ef1 Signed-off-by: Mingguang Xu <mingguangxu@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java18
2 files changed, 13 insertions, 11 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index b9ee6af5b..6b44d4762 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -3156,7 +3156,7 @@ public class ClientModeImplTest {
mLooper.dispatchAll();
verify(mWifiMetrics).updateWifiUsabilityStatsEntries(any(), eq(stats));
verify(mWifiMetrics, never()).addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- eq(anyInt()));
+ eq(anyInt()), eq(-1));
when(mWifiDataStall.checkForDataStall(any(), any()))
.thenReturn(WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX);
@@ -3164,7 +3164,7 @@ public class ClientModeImplTest {
mLooper.dispatchAll();
verify(mWifiMetrics, times(2)).updateWifiUsabilityStatsEntries(any(), eq(stats));
verify(mWifiMetrics).addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX);
+ WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX, -1);
}
/**
@@ -3416,6 +3416,6 @@ public class ClientModeImplTest {
verify(mWifiMetrics).logWifiIsUnusableEvent(
WifiIsUnusableEvent.TYPE_IP_REACHABILITY_LOST);
verify(mWifiMetrics).addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_IP_REACHABILITY_LOST);
+ WifiUsabilityStats.TYPE_IP_REACHABILITY_LOST, -1);
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 7bfb82719..d933a49c8 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -2730,7 +2730,7 @@ public class WifiMetricsTest {
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats1);
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats2);
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX);
+ WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX, -1);
return nextRandomStats(stats2);
}
@@ -2776,7 +2776,7 @@ public class WifiMetricsTest {
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats2);
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX);
+ WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX, -1);
// Add 2 LABEL_GOOD but only 1 should remain in the converted proto
WifiLinkLayerStats statsGood = addGoodWifiUsabilityStats(nextRandomStats(stats2));
@@ -2930,7 +2930,7 @@ public class WifiMetricsTest {
}
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats3);
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX);
+ WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX, -1);
for (int i = 0; i < WifiMetrics.MAX_WIFI_USABILITY_STATS_ENTRIES_LIST_SIZE - 1; i++) {
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats4);
stats4 = nextRandomStats(stats4);
@@ -2938,7 +2938,7 @@ public class WifiMetricsTest {
stats4.timeStampInMs = stats3.timeStampInMs - 1 + WifiMetrics.MIN_DATA_STALL_WAIT_MS;
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats4);
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX);
+ WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX, -1);
dumpProtoAndDeserialize();
assertEquals(2, mDecodedProto.wifiUsabilityStatsList.length);
}
@@ -2969,7 +2969,7 @@ public class WifiMetricsTest {
}
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats3);
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX);
+ WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX, -1);
for (int i = 0; i < WifiMetrics.MAX_WIFI_USABILITY_STATS_ENTRIES_LIST_SIZE - 1; i++) {
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats4);
stats4 = nextRandomStats(stats4);
@@ -2977,7 +2977,7 @@ public class WifiMetricsTest {
stats4.timeStampInMs = stats3.timeStampInMs + 1 + WifiMetrics.MIN_DATA_STALL_WAIT_MS;
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats4);
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX);
+ WifiUsabilityStats.TYPE_DATA_STALL_BAD_TX, -1);
dumpProtoAndDeserialize();
assertEquals(4, mDecodedProto.wifiUsabilityStatsList.length);
}
@@ -3223,6 +3223,7 @@ public class WifiMetricsTest {
assertEquals(WifiUsabilityStats.LABEL_GOOD, statsList[0].label);
assertEquals(WifiUsabilityStats.LABEL_BAD, statsList[1].label);
assertEquals(WifiIsUnusableEvent.TYPE_FIRMWARE_ALERT, statsList[1].triggerType);
+ assertEquals(2, statsList[1].firmwareAlertCode);
}
/**
@@ -3242,13 +3243,14 @@ public class WifiMetricsTest {
WifiLinkLayerStats statsGood = addGoodWifiUsabilityStats(nextRandomStats(stats1));
// Wifi data stall occurs
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX);
+ WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX, -1);
dumpProtoAndDeserialize();
assertEquals(2, mDecodedProto.wifiUsabilityStatsList.length);
WifiUsabilityStats[] statsList = mDecodedProto.wifiUsabilityStatsList;
assertEquals(WifiUsabilityStats.LABEL_BAD, statsList[1].label);
assertEquals(WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX, statsList[1].triggerType);
+ assertEquals(-1, statsList[1].firmwareAlertCode);
}
/**
@@ -3567,7 +3569,7 @@ public class WifiMetricsTest {
WifiLinkLayerStats statsGood = addGoodWifiUsabilityStats(nextRandomStats(stats1));
// IP reachability lost occurs
mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
- WifiUsabilityStats.TYPE_IP_REACHABILITY_LOST);
+ WifiUsabilityStats.TYPE_IP_REACHABILITY_LOST, -1);
dumpProtoAndDeserialize();
assertEquals(2, mDecodedProto.wifiUsabilityStatsList.length);