Search in sources :

Example 1 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherMaximizeCompatibilityPreferenceControllerTest method isMaximizeCompatibilityEnabled_noConcurrencyAndGetBand5gOnly_returnTrue.

@Test
public void isMaximizeCompatibilityEnabled_noConcurrencyAndGetBand5gOnly_returnTrue() {
    doReturn(false).when(mWifiManager).isBridgedApConcurrencySupported();
    SoftApConfiguration config = new SoftApConfiguration.Builder().setBand(SoftApConfiguration.BAND_5GHZ).build();
    doReturn(config).when(mWifiManager).getSoftApConfiguration();
    assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(false);
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 2 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherMaximizeCompatibilityPreferenceControllerTest method isMaximizeCompatibilityEnabled_concurrencySupportedAndDisabled_returnTrue.

@Test
public void isMaximizeCompatibilityEnabled_concurrencySupportedAndDisabled_returnTrue() {
    SoftApConfiguration config = new SoftApConfiguration.Builder().setBridgedModeOpportunisticShutdownEnabled(false).build();
    doReturn(config).when(mWifiManager).getSoftApConfiguration();
    assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(true);
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 3 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherMaximizeCompatibilityPreferenceControllerTest method isMaximizeCompatibilityEnabled_noConcurrencyAndGetBand2gAnd5g_returnTrue.

@Test
public void isMaximizeCompatibilityEnabled_noConcurrencyAndGetBand2gAnd5g_returnTrue() {
    doReturn(false).when(mWifiManager).isBridgedApConcurrencySupported();
    SoftApConfiguration config = new SoftApConfiguration.Builder().setBand(SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ).build();
    doReturn(config).when(mWifiManager).getSoftApConfiguration();
    assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(false);
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 4 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherPasswordPreferenceControllerTest method updateDisplay_shouldUpdateValue.

@Test
public void updateDisplay_shouldUpdateValue() {
    // Set controller password to anything and verify is set.
    mController.displayPreference(mScreen);
    mController.onPreferenceChange(mPreference, VALID_PASS);
    assertThat(mController.getPasswordValidated(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK)).isEqualTo(VALID_PASS);
    // Create a new config using different password
    final SoftApConfiguration config = new SoftApConfiguration.Builder().setPassphrase(VALID_PASS2, SoftApConfiguration.SECURITY_TYPE_WPA2_PSK).build();
    when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
    // Call updateDisplay and verify it's changed.
    mController.updateDisplay();
    assertThat(mController.getPasswordValidated(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK)).isEqualTo(config.getPassphrase());
    assertThat(mPreference.getSummary()).isEqualTo(config.getPassphrase());
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 5 with SoftApConfiguration

use of android.net.wifi.SoftApConfiguration in project android_packages_apps_Settings by omnirom.

the class WifiTetherSSIDPreferenceControllerTest method updateDisplay_shouldUpdateValue.

@Test
public void updateDisplay_shouldUpdateValue() {
    // Set controller ssid to anything and verify is set.
    mController.displayPreference(mScreen);
    mController.onPreferenceChange(mPreference, "1");
    assertThat(mController.getSSID()).isEqualTo("1");
    // Create a new config using different SSID
    final SoftApConfiguration config = new SoftApConfiguration.Builder().setSsid("test_1234").build();
    when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
    // Call updateDisplay and verify it's changed.
    mController.updateDisplay();
    assertThat(mController.getSSID()).isEqualTo(config.getSsid());
    assertThat(mPreference.getSummary()).isEqualTo(config.getSsid());
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Aggregations

SoftApConfiguration (android.net.wifi.SoftApConfiguration)28 Test (org.junit.Test)16 ValidatedEditTextPreference (com.android.settings.widget.ValidatedEditTextPreference)3 VisibleForTesting (androidx.annotation.VisibleForTesting)2 Intent (android.content.Intent)1 WifiManager (android.net.wifi.WifiManager)1 ListPreference (androidx.preference.ListPreference)1 PreferenceManager (androidx.preference.PreferenceManager)1 SwitchPreference (androidx.preference.SwitchPreference)1 ShadowWifiManager (com.android.settings.testutils.shadow.ShadowWifiManager)1 Before (org.junit.Before)1