diff options
author | Nate Jiang <qiangjiang@google.com> | 2020-04-03 05:12:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-03 05:12:32 +0000 |
commit | bb96a3d98cd5411a7d2d81acf409711e1984aa22 (patch) | |
tree | 411dee959535b0e5091108dfc9ac14f60448fbcd /tests | |
parent | cd853d5b7780a7e93cdd5846bd80ea69f5a82328 (diff) | |
parent | 7347b91f448800656c79c0eb0cca39b83861e575 (diff) |
Merge "Duplicate ScanResult should return only one matched suggestion" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java index f53b4c41e..e9bb940be 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java @@ -2982,6 +2982,7 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest { * - app without user approval will not be returned. * - open network will not be returned. * - suggestion doesn't allow user manually connect will not be return. + * - Multiple duplicate ScanResults will only return single matched config. */ @Test public void testGetWifiConfigForMatchedNetworkSuggestionsSharedWithUser() { @@ -2996,8 +2997,14 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest { createScanDetailForNetwork(networkSuggestion1.wifiConfiguration).getScanResult()); scanResults.add( createScanDetailForNetwork(networkSuggestion2.wifiConfiguration).getScanResult()); - scanResults.add( - createScanDetailForNetwork(networkSuggestion3.wifiConfiguration).getScanResult()); + + // Create two same ScanResult for networkSuggestion3 + ScanResult scanResult1 = createScanDetailForNetwork(networkSuggestion3.wifiConfiguration) + .getScanResult(); + ScanResult scanResult2 = new ScanResult(scanResult1); + scanResults.add(scanResult1); + scanResults.add(scanResult2); + List<WifiNetworkSuggestion> networkSuggestionList = new ArrayList<WifiNetworkSuggestion>() {{ add(networkSuggestion1); @@ -3018,6 +3025,7 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest { mWifiNetworkSuggestionsManager.setHasUserApprovedForApp(true, TEST_PACKAGE_1); wifiConfigurationList = mWifiNetworkSuggestionsManager .getWifiConfigForMatchedNetworkSuggestionsSharedWithUser(scanResults); + assertEquals(1, wifiConfigurationList.size()); assertEquals(networkSuggestion3.wifiConfiguration, wifiConfigurationList.get(0)); } |