[Wi-Fi] Add a new intent handler process for adding new networks panel page.

For the R feature "Add saved networks to the
device for apps", need to handle the new intent case to update the content to be the specific networks in the new intent.

Bug: 146105504
Test: Add following unit test case to check if UI list had been updated:
      getThreeNetworksNewIntent_shouldHaveThreeItemsInUiList.

Change-Id: Id043fabb16ba5a75aa81be8cacd403e62e5268b8
This commit is contained in:
govenliu
2019-12-23 09:39:00 +08:00
parent 80e1cf7b79
commit d9a414b61e
3 changed files with 69 additions and 20 deletions

View File

@@ -129,8 +129,7 @@ public class AddAppNetworksFragmentTest {
mAddAppNetworksFragment.mResultCodeArrayList = mFakedResultArrayList;
// Act
mAddAppNetworksFragment.mUiToRequestedList = mAddAppNetworksFragment.filterSavedNetworks(
mFakeSavedNetworksList);
mAddAppNetworksFragment.filterSavedNetworks(mFakeSavedNetworksList);
// Assert
assertThat(mAddAppNetworksFragment.mUiToRequestedList).hasSize(1);
@@ -146,6 +145,23 @@ public class AddAppNetworksFragmentTest {
SettingsEnums.PANEL_ADD_WIFI_NETWORKS);
}
@Test
public void getThreeNetworksNewIntent_shouldHaveThreeItemsInUiList() {
addOneSpecifiedNetworkConfig(mNewWpaConfigEntry);
setUpBundle(mFakedSpecifiedNetworksList);
setupFragment();
// Add two more networks and update framework bundle.
addOneSpecifiedNetworkConfig(mNewWpaConfigEntry);
addOneSpecifiedNetworkConfig(mNewOpenConfigEntry);
setUpBundle(mFakedSpecifiedNetworksList);
Bundle bundle = mAddAppNetworksFragment.getArguments();
mAddAppNetworksFragment.createContent(bundle);
// Ui list should contain 3 networks.
assertThat(mAddAppNetworksFragment.mUiToRequestedList).hasSize(3);
}
private void addOneSavedNetworkConfig(@NonNull WifiConfiguration wifiConfiguration) {
if (mFakeSavedNetworksList == null) {
mFakeSavedNetworksList = new ArrayList<>();