summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2020-05-04 16:57:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-04 16:57:01 +0000
commit412814b217444fb8799956d5e629565aaaae24ad (patch)
treef5e7579bdd9b9d9d6f9c7bb981aaade567605ea4 /tests
parent2eeb28d2fe35854db0ca672443314712cb65cfd1 (diff)
parent4c783d941d4b7dd4c22dc94bcd7bd338678bf59a (diff)
Merge "[Suggestion] Add or remove suggestion before userData loaded will fail." into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
index 79c9c0a3e..f2f9c8ad4 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
@@ -262,6 +262,7 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
verify(mWifiInjector).makeNetworkSuggestionStoreData(dataSourceArgumentCaptor.capture());
mDataSource = dataSourceArgumentCaptor.getValue();
assertNotNull(mDataSource);
+ mDataSource.fromDeserialized(Collections.EMPTY_MAP);
verify(mWifiCarrierInfoManager).addImsiExemptionUserApprovalListener(
mUserApproveCarrierListenerArgumentCaptor.capture());
@@ -374,6 +375,24 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
assertEquals(maxSizesCaptor.getValue(), new ArrayList<Integer>() {{ add(1); add(1); }});
}
+ /**
+ * Add or remove suggestion before user data store loaded will fail.
+ */
+ @Test
+ public void testAddRemoveSuggestionBeforeUserDataLoaded() {
+ // Clear the data source, and user data store is not loaded
+ mDataSource.reset();
+ WifiNetworkSuggestion networkSuggestion = new WifiNetworkSuggestion(
+ WifiConfigurationTestUtil.createOpenNetwork(), null, false, false, true, true);
+ List<WifiNetworkSuggestion> networkSuggestionList = Arrays.asList(networkSuggestion);
+ assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_ERROR_INTERNAL,
+ mWifiNetworkSuggestionsManager.add(networkSuggestionList, TEST_UID_1,
+ TEST_PACKAGE_1, TEST_FEATURE));
+ assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_ERROR_INTERNAL,
+ mWifiNetworkSuggestionsManager.remove(networkSuggestionList, TEST_UID_1,
+ TEST_PACKAGE_1));
+ }
+
@Test
public void testAddRemoveEnterpriseNetworkSuggestion() {
WifiNetworkSuggestion networkSuggestion1 = new WifiNetworkSuggestion(
@@ -3676,7 +3695,7 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
.add(networkSuggestionList, TEST_UID_1, TEST_PACKAGE_1, TEST_FEATURE));
mWifiNetworkSuggestionsManager.setHasUserApprovedForApp(true, TEST_PACKAGE_1);
when(mLruConnectionTracker.isMostRecentlyConnected(any())).thenReturn(true);
- Map<String, PerAppInfo> suggestionStore = mDataSource.toSerialize();
+ Map<String, PerAppInfo> suggestionStore = new HashMap<>(mDataSource.toSerialize());
PerAppInfo perAppInfo = suggestionStore.get(TEST_PACKAGE_1);
ExtendedWifiNetworkSuggestion ewns = perAppInfo.extNetworkSuggestions.iterator().next();
assertTrue(ewns.wns.wifiConfiguration.isMostRecentlyConnected);