Merge "tether setting: Remove dual mode check for band convert"

This commit is contained in:
TreeHugger Robot
2020-02-10 09:06:57 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 63 deletions

View File

@@ -81,7 +81,6 @@ public class WifiTetherApBandPreferenceControllerTest {
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
when(mWifiManager.getSoftApConfiguration()).thenReturn(
new SoftApConfiguration.Builder().build());
when(mWifiManager.isStaApConcurrencySupported()).thenReturn(false);
mController = new WifiTetherApBandPreferenceController(mContext, mListener);
}
@@ -90,9 +89,8 @@ public class WifiTetherApBandPreferenceControllerTest {
public void display_5GhzSupported_shouldDisplayFullList() {
when(mWifiManager.getCountryCode()).thenReturn("US");
when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
when(mWifiManager.isStaApConcurrencySupported()).thenReturn(true);
// Create a new instance to pick the proper value of isDualModeSupported()
// Create a new instance
mController = new WifiTetherApBandPreferenceController(mContext, mListener);
mController.displayPreference(mScreen);
@@ -126,38 +124,10 @@ public class WifiTetherApBandPreferenceControllerTest {
}
@Test
public void changePreference_noDualModeWith5G_shouldUpdateValue() {
public void changePreference_With5G_shouldUpdateValue() {
when(mWifiManager.getCountryCode()).thenReturn("US");
when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
mController.displayPreference(mScreen);
// 'Auto' option should be prevented from being set since
// it is invalid for this configuration
mController.onPreferenceChange(mPreference, VAL_2_5_GHZ_STR);
assertThat(mController.getBandIndex()).isEqualTo(VAL_5GHZ_INT);
assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
verify(mListener, times(1)).onTetherConfigUpdated(mController);
// set to 5 Ghz
mController.onPreferenceChange(mPreference, VAL_5GHZ_STR);
assertThat(mController.getBandIndex()).isEqualTo(VAL_5GHZ_INT);
assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
verify(mListener, times(2)).onTetherConfigUpdated(mController);
// set to 2 Ghz
mController.onPreferenceChange(mPreference, VAL_2GHZ_STR);
assertThat(mController.getBandIndex()).isEqualTo(VAL_2GHZ_INT);
assertThat(mPreference.getSummary()).isEqualTo(TWO_GHZ_STRING);
verify(mListener, times(3)).onTetherConfigUpdated(mController);
}
@Test
public void changePreference_dualModeWith5G_shouldUpdateValue() {
when(mWifiManager.getCountryCode()).thenReturn("US");
when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
when(mWifiManager.isStaApConcurrencySupported()).thenReturn(true);
// Create a new instance to pick the proper value of isDualModeSupported()
mController = new WifiTetherApBandPreferenceController(mContext, mListener);