Merge "Revert back to isDualBandSupported() for Wifi tethering." into oc-mr1-dev am: b975e352a2

am: 91f5a63262

Change-Id: I7288e2082cb68299d6ada715711316d848657015
This commit is contained in:
Rebecca Silberstein
2017-09-13 09:45:52 +00:00
committed by android-build-merger
2 changed files with 35 additions and 16 deletions

View File

@@ -16,6 +16,12 @@
package com.android.settings.wifi.tether;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
@@ -35,12 +41,6 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class WifiTetherApBandPreferenceControllerTest {
@@ -75,16 +75,30 @@ public class WifiTetherApBandPreferenceControllerTest {
@Test
public void display_5GhzSupported_shouldDisplayFullList() {
when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
when(mWifiManager.getCountryCode()).thenReturn("US");
when(mWifiManager.isDualBandSupported()).thenReturn(true);
mController.displayPreference(mScreen);
assertThat(mListPreference.getEntries().length).isEqualTo(2);
}
@Test
public void display_noCountryCode_shouldDisable() {
when(mWifiManager.getCountryCode()).thenReturn(null);
when(mWifiManager.isDualBandSupported()).thenReturn(true);
mController.displayPreference(mScreen);
assertThat(mListPreference.getEntries()).isNull();
assertThat(mListPreference.isEnabled()).isFalse();
assertThat(mListPreference.getSummary())
.isEqualTo(RuntimeEnvironment.application.getString(R.string.wifi_ap_choose_2G));
}
@Test
public void display_5GhzNotSupported_shouldDisable() {
when(mWifiManager.is5GHzBandSupported()).thenReturn(false);
when(mWifiManager.isDualBandSupported()).thenReturn(false);
mController.displayPreference(mScreen);