diff options
author | Nate Jiang <qiangjiang@google.com> | 2020-03-26 17:00:10 -0700 |
---|---|---|
committer | Nate Jiang <qiangjiang@google.com> | 2020-03-26 20:49:57 -0700 |
commit | 060438fd2b162bf91a296013ce8ca91006728219 (patch) | |
tree | e69a97c470c7798654e89ae8310dccc3df2ef31a /tests | |
parent | 607c5a66ec3bc3075af80f45e39101f2562ae33b (diff) |
Add or Remove WifiNetworkSuggestion with null should fail.
Bug: 152554222
Test: atest com.android.server.wifi
Change-Id: I5764f63b8054d56bfc6423c26a78631a1546c077
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java index f26ceb664..ea2953a20 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java @@ -649,6 +649,24 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest { } /** + * Verify add or remove suggestion list with null object will result error code. + */ + @Test + public void testAddRemoveNetworkSuggestionWithNullObject() { + assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_ERROR_ADD_INVALID, + mWifiNetworkSuggestionsManager.add(Collections.singletonList(null), + TEST_UID_1, TEST_PACKAGE_1, TEST_FEATURE)); + WifiNetworkSuggestion networkSuggestion = new WifiNetworkSuggestion( + WifiConfigurationTestUtil.createOpenNetwork(), null, false, false, true, true); + assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS, + mWifiNetworkSuggestionsManager.add(Collections.singletonList(networkSuggestion), + TEST_UID_1, TEST_PACKAGE_1, TEST_FEATURE)); + assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_ERROR_REMOVE_INVALID, + mWifiNetworkSuggestionsManager.remove(Collections.singletonList(null), + TEST_UID_1, TEST_PACKAGE_1)); + } + + /** * Verify a successful lookup of a single network suggestion matching the provided scan detail. */ @Test @@ -3292,6 +3310,7 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest { List<ScanResult> allSrList = new ArrayList<>() {{ add(passpointScanResult); add(nonPasspointScanResult); + add(null); }}; when(mPasspointManager.getMatchingScanResults(eq(mockPasspoint), eq(allSrList))) .thenReturn(ppSrList); |