summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2018-02-20 15:06:19 -0800
committerMichael Plass <mplass@google.com>2018-02-26 09:47:36 -0800
commit989073592737e5b985eec5e196f7ee9b7661d7b0 (patch)
treeaaac696a99489e81d1764d6c625ccb7bb622b2fa /tests
parented3ac0246473f24cfd48248d930a05196bca1049 (diff)
[WifiScoreReport] Bring back a unit test
This test originally pertained to the aggressive scorer, but it works with the new scorer as well. Bug: 72523649 Bug: 73127862 Test: Unit tests Change-Id: Iaea24dafad8f8add72deeff6b0093933feea64d9
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
index cabece18a..1cef87a63 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
@@ -145,8 +145,7 @@ public class WifiScoreReportTest {
@Test
public void calculateAndReportScoreSucceeds() throws Exception {
mWifiInfo.setRssi(-77);
- mWifiScoreReport.calculateAndReportScore(mWifiInfo,
- mNetworkAgent, mWifiMetrics);
+ mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
verify(mNetworkAgent).sendNetworkScore(anyInt());
verify(mWifiMetrics).incrementWifiScoreCount(anyInt());
}
@@ -210,6 +209,23 @@ public class WifiScoreReportTest {
}
/**
+ * When the score ramps down to the exit theshold, let go.
+ */
+ @Test
+ public void giveUpOnBadRssiAggressively() throws Exception {
+ String oops = "giveUpOnBadRssiAggressively";
+ for (int rssi = -60; rssi >= -83; rssi -= 1) {
+ mWifiInfo.setRssi(rssi);
+ oops += " " + mClock.mWallClockMillis + "," + rssi;
+ mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
+ oops += ":" + mWifiInfo.score;
+ }
+ int score = mWifiInfo.score;
+ verify(mNetworkAgent, atLeast(1)).sendNetworkScore(score);
+ assertTrue(oops, score < CELLULAR_THRESHOLD_SCORE);
+ }
+
+ /**
* This setup causes some reports to be generated when println
* methods are called, to check for "concurrent" modification
* errors.