summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2018-03-28 14:36:07 -0700
committerMichael Plass <mplass@google.com>2018-03-30 17:56:59 -0700
commit358daf5df00f5563253ba3465fbc7029f7ac1056 (patch)
treecbd935d949ee1b6bdb2f90465550330dc19b2c32 /tests
parentb485ce7e9ecf0fa448e0224f6e410a1a5f0c86f5 (diff)
[WifiScoreReport] Stay on working wifi
If packets are actually moving in both directions at a sufficiently high rate, stay on wifi. Bug: 74613347 Test: Unit tests Change-Id: I49862984c9c3f67d64669102bb929a07110797ba
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
index d60264c61..bf662f01a 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
@@ -260,6 +260,35 @@ public class WifiScoreReportTest {
}
/**
+ * Don't breach if the success rates are great
+ *
+ * Ramp the RSSI down, but maintain a high packet throughput
+ *
+ * Expect score to stay above above threshold.
+ */
+ @Test
+ public void allowTerribleRssiIfDataIsMovingWell() throws Exception {
+ mWifiInfo.txSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1;
+ mWifiInfo.rxSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1;
+ assertTrue(mWifiInfo.txSuccessRate > 10);
+ mWifiInfo.setFrequency(5220);
+ for (int r = -30; r >= -200; r -= 2) {
+ mWifiInfo.setRssi(r);
+ mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
+ assertTrue(mWifiInfo.score > ConnectedScore.WIFI_TRANSITION_SCORE);
+ }
+ // If the throughput dips, we should let go
+ mWifiInfo.rxSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() - 0.1;
+ mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
+ assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ // And even if throughput improves again, once we have decided to let go, disregard
+ // the good rates.
+ mWifiInfo.rxSuccessRate = mScoringParams.getYippeeSkippyPacketsPerSecond() + 0.1;
+ mWifiScoreReport.calculateAndReportScore(mWifiInfo, mNetworkAgent, mWifiMetrics);
+ assertTrue(mWifiInfo.score < ConnectedScore.WIFI_TRANSITION_SCORE);
+ }
+
+ /**
* This setup causes some reports to be generated when println
* methods are called, to check for "concurrent" modification
* errors.