diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java | 5 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java index 16eb976ea..1f42d45b6 100644 --- a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java @@ -249,10 +249,12 @@ public class BssidBlocklistMonitorTest { } /** - * Verify that handleBssidConnectionSuccess resets appropriate blocklist streak counts. + * Verify that handleBssidConnectionSuccess resets appropriate blocklist streak counts, and + * notifies WifiScorecard of the successful connection. */ @Test public void testNetworkConnectionResetsBlocklistStreak() { + when(mClock.getWallClockMillis()).thenReturn(100L); mBssidBlocklistMonitor.handleBssidConnectionSuccess(TEST_BSSID_1, TEST_SSID_1); verify(mWifiScoreCard).resetBssidBlocklistStreak(TEST_SSID_1, TEST_BSSID_1, BssidBlocklistMonitor.REASON_AP_UNABLE_TO_HANDLE_NEW_STA); @@ -266,6 +268,7 @@ public class BssidBlocklistMonitorTest { BssidBlocklistMonitor.REASON_ASSOCIATION_TIMEOUT); verify(mWifiScoreCard).resetBssidBlocklistStreak(TEST_SSID_1, TEST_BSSID_1, BssidBlocklistMonitor.REASON_AUTHENTICATION_FAILURE); + verify(mWifiScoreCard).setBssidConnectionTimeMs(TEST_SSID_1, TEST_BSSID_1, 100L); } /** diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java index c02ecf0f8..135a71ee2 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreCardTest.java @@ -194,6 +194,22 @@ public class WifiScoreCardTest extends WifiBaseTest { } /** + * Test the update and retrieval of the last connection time to a BSSID. + */ + @Test + public void testSetBssidConnectionTimestampMs() { + mWifiInfo.setSSID(TEST_SSID_1); + mWifiInfo.setBSSID(TEST_BSSID_1.toString()); + mWifiScoreCard.noteIpConfiguration(mWifiInfo); + + String ssid = mWifiInfo.getSSID(); + String bssid = mWifiInfo.getBSSID(); + assertEquals(0L, mWifiScoreCard.getBssidConnectionTimestampMs(ssid, bssid)); + assertEquals(0L, mWifiScoreCard.setBssidConnectionTimestampMs(ssid, bssid, 100L)); + assertEquals(100L, mWifiScoreCard.getBssidConnectionTimestampMs(ssid, bssid)); + } + + /** * Test identifiers. */ @Test |