summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMingguang Xu <mingguangxu@google.com>2019-04-23 05:59:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-23 05:59:50 +0000
commit26baf9944cf023afe8dfba6d0e7619b57f6d1c79 (patch)
tree2b4747abe9fbf9f7786e30b6e143468489ac33e5 /tests
parent773ebaf049a110adc4751eef9a2a100f5a54e3c6 (diff)
parent094ab86334602dd5402f371b0b7e71746df7a476 (diff)
Merge "Wifi usability: Check screen status before adding bad Wifi usability stats" into qt-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java28
1 files changed, 28 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 303f5b36e..d3b6b2ff8 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -3941,4 +3941,32 @@ public class WifiMetricsTest {
}
}
}
+
+ /**
+ * Verify that the LABEL_BAD Wifi usability stats are not saved if screen state is off.
+ * @throws Exception
+ */
+ @Test
+ public void verifyLabelBadStatsAreNotSavedIfScreenIsOff() throws Exception {
+ mWifiMetrics.setScreenState(false);
+ WifiInfo info = mock(WifiInfo.class);
+ when(info.getRssi()).thenReturn(nextRandInt());
+ when(info.getLinkSpeed()).thenReturn(nextRandInt());
+ WifiLinkLayerStats stats1 = nextRandomStats(new WifiLinkLayerStats());
+ mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats1);
+
+ // Add 1 LABEL_GOOD
+ WifiLinkLayerStats statsGood = addGoodWifiUsabilityStats(nextRandomStats(stats1));
+ // IP reachability lost occurs
+ mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
+ WifiUsabilityStats.TYPE_IP_REACHABILITY_LOST, -1);
+ // Wifi data stall occurs
+ mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
+ WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX, -1);
+ // Firmware alert occurs
+ mWifiMetrics.logFirmwareAlert(2);
+
+ dumpProtoAndDeserialize();
+ assertEquals(0, mDecodedProto.wifiUsabilityStatsList.length);
+ }
}