summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMingguang Xu <mingguangxu@google.com>2020-02-26 21:41:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-02-26 21:41:03 +0000
commit8714ca9f17c7b4cc06bb601c094beb6417c77a74 (patch)
treeac74b38a070a96d01f173be4a72dca1c5e2784f3 /tests
parent30bb825c32f030aee393b7604c46a227f290a481 (diff)
parent4c35610c475d562120c17a2dfa6e4122b3155bb1 (diff)
Merge "Extension API: Replace NetworkScore object with integer in API surface" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java54
1 files changed, 22 insertions, 32 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
index adfdc0082..33dbcd1ca 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
@@ -660,26 +660,24 @@ public class WifiScoreReportTest extends WifiBaseTest {
mWifiScoreReport.startConnectedNetworkScorer(anyInt());
// Invalid session ID
- final NetworkScore ns1 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(-1, ns1);
+ scorerImpl.mScoreChangeCallback.onScoreChange(-1, 49);
assertEquals(mWifiScoreReport.getScore(), ConnectedScore.WIFI_MAX_SCORE);
// Incorrect session ID
- final NetworkScore ns2 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId + 10, ns2);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId + 10, 49);
assertEquals(mWifiScoreReport.getScore(), ConnectedScore.WIFI_MAX_SCORE);
- final NetworkScore ns3 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns3);
+ final NetworkScore ns3 = new NetworkScore.Builder().setLegacyScore(49).build();
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
verify(mNetworkAgent).sendNetworkScore(eq(ns3));
assertEquals(mWifiScoreReport.getScore(), 49);
- final NetworkScore ns4 = new NetworkScore.Builder().setExiting(false).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns4);
+ final NetworkScore ns4 = new NetworkScore.Builder().setLegacyScore(59).build();
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 59);
mLooper.dispatchAll();
verify(mNetworkAgent).sendNetworkScore(eq(ns4));
- assertEquals(mWifiScoreReport.getScore(), 51);
+ assertEquals(mWifiScoreReport.getScore(), 59);
}
/**
@@ -711,27 +709,25 @@ public class WifiScoreReportTest extends WifiBaseTest {
mClock.mStepMillis = 0;
mClock.mWallClockMillis = 5001;
- final NetworkScore ns1 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns1);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
assertTrue(mWifiScoreReport.shouldCheckIpLayer());
mWifiScoreReport.noteIpCheck();
mClock.mWallClockMillis = 10000;
- final NetworkScore ns2 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns2);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
assertFalse(mWifiScoreReport.shouldCheckIpLayer());
mClock.mWallClockMillis = 10001;
- final NetworkScore ns3 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns3);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
assertTrue(mWifiScoreReport.shouldCheckIpLayer());
}
/**
- * Verify BSSID blocklist doesnot happen when exiting is set for less than the minimum duration
+ * Verify BSSID blocklist doesnot happen when score stays below threshold for less than the
+ * minimum duration
*/
@Test
public void bssidBlockListDoesnotHappenWhenExitingIsLessThanMinDuration() throws Exception {
@@ -742,12 +738,10 @@ public class WifiScoreReportTest extends WifiBaseTest {
mClock.mStepMillis = 0;
mClock.mWallClockMillis = 10;
- final NetworkScore ns1 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns1);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
mClock.mWallClockMillis = 29009;
- final NetworkScore ns2 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns2);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
mWifiScoreReport.stopConnectedNetworkScorer();
mLooper.dispatchAll();
@@ -755,7 +749,8 @@ public class WifiScoreReportTest extends WifiBaseTest {
}
/**
- * Verify BSSID blocklist happens when exiting is set for longer than the minimum duration
+ * Verify BSSID blocklist happens when score stays below threshold for longer than the
+ * minimum duration
*/
@Test
public void bssidBlockListHappensWhenExitingIsLongerThanMinDuration() throws Exception {
@@ -766,12 +761,10 @@ public class WifiScoreReportTest extends WifiBaseTest {
mClock.mStepMillis = 0;
mClock.mWallClockMillis = 10;
- final NetworkScore ns1 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns1);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
mClock.mWallClockMillis = 29011;
- final NetworkScore ns2 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns2);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
mWifiScoreReport.stopConnectedNetworkScorer();
mLooper.dispatchAll();
@@ -779,7 +772,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
}
/**
- * Verify BSSID blocklist doesnot happen exiting is reset
+ * Verify BSSID blocklist doesnot happen when there is score flip flop
*/
@Test
public void bssidBlockListDoesnotHappenWhenExitingIsReset() throws Exception {
@@ -790,16 +783,13 @@ public class WifiScoreReportTest extends WifiBaseTest {
mClock.mStepMillis = 0;
mClock.mWallClockMillis = 10;
- final NetworkScore ns1 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns1);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
mClock.mWallClockMillis = 15000;
- final NetworkScore ns2 = new NetworkScore.Builder().setExiting(false).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns2);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 51);
mLooper.dispatchAll();
mClock.mWallClockMillis = 29011;
- final NetworkScore ns3 = new NetworkScore.Builder().setExiting(true).build();
- scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, ns3);
+ scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
mWifiScoreReport.stopConnectedNetworkScorer();
mLooper.dispatchAll();