Search in sources :

Example 26 with SoftApConfiguration

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

the class WifiTetherSecurityPreferenceControllerTest method updateDisplay_toWpa3SaeTransition_shouldUpdateSecurityValue.

@Test
public void updateDisplay_toWpa3SaeTransition_shouldUpdateSecurityValue() {
    SoftApConfiguration config = new SoftApConfiguration.Builder(mConfig).setPassphrase("test_password", SoftApConfiguration.SECURITY_TYPE_WPA3_SAE_TRANSITION).build();
    when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
    mController.updateDisplay();
    assertThat(mController.getSecurityType()).isEqualTo(SoftApConfiguration.SECURITY_TYPE_WPA3_SAE_TRANSITION);
    assertThat(mPreference.getSummary().toString()).isEqualTo("WPA2/WPA3-Personal");
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 27 with SoftApConfiguration

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

the class WifiTetherSecurityPreferenceControllerTest method updateDisplay_toWpa2Psk_shouldUpdateSecurityValue.

@Test
public void updateDisplay_toWpa2Psk_shouldUpdateSecurityValue() {
    SoftApConfiguration config = new SoftApConfiguration.Builder(mConfig).setPassphrase("test_password", SoftApConfiguration.SECURITY_TYPE_WPA2_PSK).build();
    when(mWifiManager.getSoftApConfiguration()).thenReturn(config);
    mController.updateDisplay();
    assertThat(mController.getSecurityType()).isEqualTo(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
    assertThat(mPreference.getSummary().toString()).isEqualTo("WPA2-Personal");
}
Also used : SoftApConfiguration(android.net.wifi.SoftApConfiguration) Test(org.junit.Test)

Example 28 with SoftApConfiguration

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

the class DeviceNamePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(ApplicationProvider.getApplicationContext());
    when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
    mResources = spy(mContext.getResources());
    when(mContext.getResources()).thenReturn(mResources);
    if (Looper.myLooper() == null) {
        Looper.prepare();
    }
    PreferenceManager preferenceManager = new PreferenceManager(mContext);
    mScreen = preferenceManager.createPreferenceScreen(mContext);
    mPreference = new ValidatedEditTextPreference(mContext);
    mPreference.setKey(TEST_PREFERENCE_KEY);
    mScreen.addPreference(mPreference);
    final SoftApConfiguration configuration = new SoftApConfiguration.Builder().setSsid("test-ap").build();
    when(mWifiManager.getSoftApConfiguration()).thenReturn(configuration);
    mController = new DeviceNamePreferenceController(mContext, TEST_PREFERENCE_KEY);
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
Also used : ValidatedEditTextPreference(com.android.settings.widget.ValidatedEditTextPreference) SoftApConfiguration(android.net.wifi.SoftApConfiguration) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

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