summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMingguang Xu <mingguangxu@google.com>2019-04-19 14:06:38 -0700
committerMingguang Xu <mingguangxu@google.com>2019-04-19 14:06:38 -0700
commitd9c0f4c52fbb2a0b0824688a8461a60874a675c2 (patch)
treed0afdd714d7c0eed77d8f358450a7fe7685b6bc3 /tests
parentd859819c298d65cb01aece60182d65057fc5b088 (diff)
Wifi usability: Add timestamp in WifiUsabilityStats
Together with the timestamps in each entry (WifiUsabilityStatsEntry) of WifiUsabilityStats, the added timestamp allows us to check whether the WifiUsabilityStats is obsolete or not. Bug: 129282057 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: If7ffcbc028eab747c4f632da2c438a773cad938d Signed-off-by: Mingguang Xu <mingguangxu@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java9
1 files changed, 9 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 9b9f032ce..42881d185 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -3259,6 +3259,8 @@ public class WifiMetricsTest {
WifiInfo info = mock(WifiInfo.class);
when(info.getRssi()).thenReturn(nextRandInt());
when(info.getLinkSpeed()).thenReturn(nextRandInt());
+ long eventTimeMs = nextRandInt();
+ when(mClock.getElapsedSinceBootMillis()).thenReturn(eventTimeMs);
WifiLinkLayerStats stats1 = nextRandomStats(new WifiLinkLayerStats());
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats1);
@@ -3274,6 +3276,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(eventTimeMs, statsList[1].timeStampMs);
assertEquals(2, statsList[1].firmwareAlertCode);
}
@@ -3287,6 +3290,8 @@ public class WifiMetricsTest {
WifiInfo info = mock(WifiInfo.class);
when(info.getRssi()).thenReturn(nextRandInt());
when(info.getLinkSpeed()).thenReturn(nextRandInt());
+ long eventTimeMs = nextRandInt();
+ when(mClock.getElapsedSinceBootMillis()).thenReturn(eventTimeMs);
WifiLinkLayerStats stats1 = nextRandomStats(new WifiLinkLayerStats());
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats1);
@@ -3302,6 +3307,7 @@ public class WifiMetricsTest {
assertEquals(WifiUsabilityStats.LABEL_BAD, statsList[1].label);
assertEquals(WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX, statsList[1].triggerType);
assertEquals(-1, statsList[1].firmwareAlertCode);
+ assertEquals(eventTimeMs, statsList[1].timeStampMs);
}
/**
@@ -3624,6 +3630,8 @@ public class WifiMetricsTest {
WifiInfo info = mock(WifiInfo.class);
when(info.getRssi()).thenReturn(nextRandInt());
when(info.getLinkSpeed()).thenReturn(nextRandInt());
+ long eventTimeMs = nextRandInt();
+ when(mClock.getElapsedSinceBootMillis()).thenReturn(eventTimeMs);
WifiLinkLayerStats stats1 = nextRandomStats(new WifiLinkLayerStats());
mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats1);
@@ -3638,6 +3646,7 @@ public class WifiMetricsTest {
WifiUsabilityStats[] statsList = mDecodedProto.wifiUsabilityStatsList;
assertEquals(WifiUsabilityStats.LABEL_BAD, statsList[1].label);
assertEquals(WifiUsabilityStats.TYPE_IP_REACHABILITY_LOST, statsList[1].triggerType);
+ assertEquals(eventTimeMs, statsList[1].timeStampMs);
}
/**