Search in sources :

Example 11 with WifiEntry

use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSettingsTest method createWifiDialog2.

private WifiDialog2 createWifiDialog2(int mode, WifiConfiguration config) {
    final WifiEntry wifiEntry = mock(WifiEntry.class);
    when(wifiEntry.canConnect()).thenReturn(true);
    final WifiConfigController2 controller = mock(WifiConfigController2.class);
    when(controller.getConfig()).thenReturn(config);
    final WifiDialog2 wifiDialog2 = spy(WifiDialog2.createModal(mContext, null, /* listener */
    wifiEntry, mode));
    when(wifiDialog2.getController()).thenReturn(controller);
    return wifiDialog2;
}
Also used : WifiConfigController2(com.android.settings.wifi.WifiConfigController2) WifiDialog2(com.android.settings.wifi.WifiDialog2) WifiEntry(com.android.wifitrackerlib.WifiEntry)

Example 12 with WifiEntry

use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSettingsTest method createConnectedWifiEntryPreference_internetCellular_createFirstWifiPreference.

@Test
public void createConnectedWifiEntryPreference_internetCellular_createFirstWifiPreference() {
    final WifiEntry wifiEntry = mock(WifiEntry.class);
    doReturn(InternetUpdater.INTERNET_CELLULAR).when(mInternetUpdater).getInternetType();
    final Preference p = mNetworkProviderSettings.createConnectedWifiEntryPreference(wifiEntry);
    assertThat(p instanceof NetworkProviderSettings.FirstWifiEntryPreference).isTrue();
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference) DataUsagePreference(com.android.settings.datausage.DataUsagePreference) LayoutPreference(com.android.settingslib.widget.LayoutPreference) ConnectedWifiEntryPreference(com.android.settings.wifi.ConnectedWifiEntryPreference) AddWifiNetworkPreference(com.android.settings.wifi.AddWifiNetworkPreference) Preference(androidx.preference.Preference) LongPressWifiEntryPreference(com.android.settingslib.wifi.LongPressWifiEntryPreference) WifiEntry(com.android.wifitrackerlib.WifiEntry) Test(org.junit.Test)

Example 13 with WifiEntry

use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSettingsTest method onSubmit_modeConnectNoConfig_connectWifiEntry.

@Test
public void onSubmit_modeConnectNoConfig_connectWifiEntry() {
    WifiDialog2 dialog = createWifiDialog2(MODE_CONNECT, null);
    final WifiEntry wifiEntry = dialog.getWifiEntry();
    mNetworkProviderSettings.onAttach(mContext);
    mNetworkProviderSettings.onSubmit(dialog);
    verify(mNetworkProviderSettings).connect(wifiEntry, false, /* editIfNoConfig */
    false);
}
Also used : WifiDialog2(com.android.settings.wifi.WifiDialog2) WifiEntry(com.android.wifitrackerlib.WifiEntry) Test(org.junit.Test)

Example 14 with WifiEntry

use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.

the class WifiSliceTest method createWifiSliceItem.

private WifiSliceItem createWifiSliceItem(String title, @ConnectedState int connectedState) {
    final WifiEntry wifiEntry = mock(WifiEntry.class);
    when(wifiEntry.getTitle()).thenReturn(title);
    when(wifiEntry.getKey()).thenReturn("key");
    when(wifiEntry.getConnectedState()).thenReturn(connectedState);
    when(wifiEntry.getLevel()).thenReturn(WifiEntry.WIFI_LEVEL_MAX);
    return new WifiSliceItem(mContext, wifiEntry);
}
Also used : WifiEntry(com.android.wifitrackerlib.WifiEntry)

Example 15 with WifiEntry

use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.

the class SavedAccessPointsPreferenceController2Test method getAvailability_oneSavedAccessPoint_shouldAvailable.

@Test
public void getAvailability_oneSavedAccessPoint_shouldAvailable() {
    final WifiEntry mockWifiEntry = mock(WifiEntry.class);
    mController.mWifiEntries = Arrays.asList(mockWifiEntry);
    assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
Also used : WifiEntry(com.android.wifitrackerlib.WifiEntry) Test(org.junit.Test)

Aggregations

WifiEntry (com.android.wifitrackerlib.WifiEntry)54 Test (org.junit.Test)28 WifiConfiguration (android.net.wifi.WifiConfiguration)10 WifiEntryPreference (com.android.settingslib.wifi.WifiEntryPreference)10 LongPressWifiEntryPreference (com.android.settingslib.wifi.LongPressWifiEntryPreference)8 Intent (android.content.Intent)7 Preference (androidx.preference.Preference)5 Context (android.content.Context)4 Bundle (android.os.Bundle)4 DataUsagePreference (com.android.settings.datausage.DataUsagePreference)4 WifiManager (android.net.wifi.WifiManager)3 Handler (android.os.Handler)3 View (android.view.View)3 FragmentActivity (androidx.fragment.app.FragmentActivity)3 SubSettingLauncher (com.android.settings.core.SubSettingLauncher)3 AddWifiNetworkPreference (com.android.settings.wifi.AddWifiNetworkPreference)3 ConnectedWifiEntryPreference (com.android.settings.wifi.ConnectedWifiEntryPreference)3 FooterPreference (com.android.settingslib.widget.FooterPreference)3 LayoutPreference (com.android.settingslib.widget.LayoutPreference)3 ArrayList (java.util.ArrayList)3