diff options
author | Oscar Shu <xshu@google.com> | 2020-06-18 17:23:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-06-18 17:23:27 +0000 |
commit | c5084bbfcbad824a3c789c99caa42dcb891190e8 (patch) | |
tree | 759ffd31a33426ac18826b059bda11c8525074cb /tests | |
parent | 9f55a68611cdb7f0805af803f3f8f7487c9b208d (diff) | |
parent | ef4f7dc4ea5619b713bcfaa4985338ec07b9f479 (diff) |
Merge "Fix NPE in BssidBlocklistMonitor" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java index 4369a831b..8cb2e376a 100644 --- a/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/BssidBlocklistMonitorTest.java @@ -662,4 +662,24 @@ public class BssidBlocklistMonitorTest { assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); assertEquals(2, mBssidBlocklistMonitor.getBssidStatusHistoryLoggerSize()); } + + /** + * Verify that invalid inputs are handled and result in no-op. + */ + @Test + public void testBlockBssidForDurationMsInvalidInputs() { + // test invalid BSSID + when(mClock.getWallClockMillis()).thenReturn(0L); + long testDuration = 5500L; + mBssidBlocklistMonitor.blockBssidForDurationMs(null, TEST_SSID_1, testDuration); + assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); + + // test invalid SSID + mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, null, testDuration); + assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); + + // test invalid duration + mBssidBlocklistMonitor.blockBssidForDurationMs(TEST_BSSID_1, TEST_SSID_1, -1); + assertEquals(0, mBssidBlocklistMonitor.updateAndGetBssidBlocklist().size()); + } } |