From 3e0366caf14aa4754d756a03a6d4c6f4e8f7831d Mon Sep 17 00:00:00 2001 From: Mingguang Xu Date: Sun, 2 Aug 2020 23:04:16 -0700 Subject: Extension API: Set initial score value to the max when starting connected network scorer Bug: 161192240 Test: atest WifiScoreReportTest Signed-off-by: Mingguang Xu Change-Id: I8b7c96581d49f6156708c081099c9614259f666e --- .../src/com/android/server/wifi/WifiScoreReportTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java index 674ff8c9d..3c752f97a 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java @@ -833,4 +833,15 @@ public class WifiScoreReportTest extends WifiBaseTest { mLooper.dispatchAll(); verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(any(), any(), anyLong()); } + + /** + * Verify that the initial score value in WifiInfo is the max when onStart is called. + */ + @Test + public void testOnStartInitialScoreInWifiInfoIsMaxScore() throws Exception { + when(mNetwork.getNetId()).thenReturn(TEST_NETWORK_ID); + mWifiScoreReport.startConnectedNetworkScorer(TEST_NETWORK_ID); + mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, mWifiConnectedNetworkScorer); + assertEquals(ConnectedScore.WIFI_MAX_SCORE, mWifiInfo.getScore()); + } } -- cgit v1.2.3