diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java | 5 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java index 43a16fe4c..a570d2948 100644 --- a/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/DeviceConfigFacadeTest.java @@ -209,6 +209,8 @@ public class DeviceConfigFacadeTest extends WifiBaseTest { mDeviceConfigFacade.getMinConfirmationDurationSendLowScoreMs()); assertEquals(DeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_HIGH_SCORE_MS, mDeviceConfigFacade.getMinConfirmationDurationSendHighScoreMs()); + assertEquals(DeviceConfigFacade.DEFAULT_RSSI_THRESHOLD_NOT_SEND_LOW_SCORE_TO_CS_DBM, + mDeviceConfigFacade.getRssiThresholdNotSendLowScoreToCsDbm()); } /** @@ -315,6 +317,8 @@ public class DeviceConfigFacadeTest extends WifiBaseTest { anyInt())).thenReturn(4000); when(DeviceConfig.getInt(anyString(), eq("min_confirmation_duration_send_high_score_ms"), anyInt())).thenReturn(1000); + when(DeviceConfig.getInt(anyString(), eq("rssi_threshold_not_send_low_score_to_cs_dbm"), + anyInt())).thenReturn(-70); mOnPropertiesChangedListenerCaptor.getValue().onPropertiesChanged(null); // Verifying fields are updated to the new values @@ -373,5 +377,6 @@ public class DeviceConfigFacadeTest extends WifiBaseTest { assertEquals(1000, mDeviceConfigFacade.getHealthMonitorFwAlertValidTimeMs()); assertEquals(4000, mDeviceConfigFacade.getMinConfirmationDurationSendLowScoreMs()); assertEquals(1000, mDeviceConfigFacade.getMinConfirmationDurationSendHighScoreMs()); + assertEquals(-70, mDeviceConfigFacade.getRssiThresholdNotSendLowScoreToCsDbm()); } } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java index 82dbbe941..fb2d128cc 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java @@ -208,6 +208,8 @@ public class WifiScoreReportTest extends WifiBaseTest { DeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_LOW_SCORE_MS); when(mDeviceConfigFacade.getMinConfirmationDurationSendHighScoreMs()).thenReturn( DeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_HIGH_SCORE_MS); + when(mDeviceConfigFacade.getRssiThresholdNotSendLowScoreToCsDbm()).thenReturn( + DeviceConfigFacade.DEFAULT_RSSI_THRESHOLD_NOT_SEND_LOW_SCORE_TO_CS_DBM); } /** @@ -870,6 +872,7 @@ public class WifiScoreReportTest extends WifiBaseTest { mClock.mStepMillis = 0; mClock.mWallClockMillis = 10; + mWifiInfo.setRssi(-65); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 49); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(anyInt()); @@ -891,9 +894,11 @@ public class WifiScoreReportTest extends WifiBaseTest { mClock.mWallClockMillis = 10; scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 60); + mWifiInfo.setRssi(-70); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(60); mClock.mWallClockMillis = 3010; + mWifiInfo.setRssi(-65); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 59); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(59); @@ -904,11 +909,11 @@ public class WifiScoreReportTest extends WifiBaseTest { } /** - * Verify confirmation duration is added for reporting low score when it is enabled in - * config overlay + * Verify confirmation duration and RSSI check is added for reporting low score when it is + * enabled in config overlay */ @Test - public void confirmationDurationIsAddedForSendingLowScore() throws Exception { + public void confirmationDurationAndRssiCheckIsAddedForSendingLowScore() throws Exception { WifiConnectedNetworkScorerImpl scorerImpl = new WifiConnectedNetworkScorerImpl(); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); @@ -929,11 +934,13 @@ public class WifiScoreReportTest extends WifiBaseTest { verify(mNetworkAgent, never()).sendNetworkScore(anyInt()); mClock.mWallClockMillis = 10 + mDeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_LOW_SCORE_MS; + mWifiInfo.setRssi(-65); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 47); mLooper.dispatchAll(); - verify(mNetworkAgent).sendNetworkScore(47); + verify(mNetworkAgent, never()).sendNetworkScore(47); mClock.mWallClockMillis = 10 + mDeviceConfigFacade.DEFAULT_MIN_CONFIRMATION_DURATION_SEND_LOW_SCORE_MS + 3000; + mWifiInfo.setRssi(-68); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 46); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(46); @@ -958,6 +965,7 @@ public class WifiScoreReportTest extends WifiBaseTest { mLooper.dispatchAll(); verify(mNetworkAgent, never()).sendNetworkScore(anyInt()); mClock.mWallClockMillis = 3000; + mWifiInfo.setRssi(-70); scorerImpl.mScoreUpdateObserver.notifyScoreUpdate(scorerImpl.mSessionId, 51); mLooper.dispatchAll(); verify(mNetworkAgent).sendNetworkScore(51); |