Search in sources :

Example 1 with WifiDialog2

use of com.android.settings.wifi.WifiDialog2 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 2 with WifiDialog2

use of com.android.settings.wifi.WifiDialog2 in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSettingsTest method onSubmit_modeModifyHasConfig_saveWifiManager.

@Test
public void onSubmit_modeModifyHasConfig_saveWifiManager() {
    final WifiConfiguration config = mock(WifiConfiguration.class);
    WifiDialog2 dialog = createWifiDialog2(MODE_MODIFY, config);
    mNetworkProviderSettings.onSubmit(dialog);
    verify(mWifiManager).save(eq(config), any());
}
Also used : WifiDialog2(com.android.settings.wifi.WifiDialog2) WifiConfiguration(android.net.wifi.WifiConfiguration) Test(org.junit.Test)

Example 3 with WifiDialog2

use of com.android.settings.wifi.WifiDialog2 in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSettingsTest method onSubmit_modeModifyNoConfig_toastErrorMessage.

@Test
public void onSubmit_modeModifyNoConfig_toastErrorMessage() {
    WifiDialog2 dialog = createWifiDialog2(MODE_MODIFY, null);
    mNetworkProviderSettings.onSubmit(dialog);
    assertThat(ShadowToast.getTextOfLatestToast()).isEqualTo(mContext.getString(R.string.wifi_failed_save_message));
}
Also used : WifiDialog2(com.android.settings.wifi.WifiDialog2) Test(org.junit.Test)

Example 4 with WifiDialog2

use of com.android.settings.wifi.WifiDialog2 in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSettingsTest method onSubmit_modeConnectHasConfig_connectWifiManager.

@Test
public void onSubmit_modeConnectHasConfig_connectWifiManager() {
    final WifiConfiguration config = mock(WifiConfiguration.class);
    WifiDialog2 dialog = createWifiDialog2(MODE_CONNECT, config);
    mNetworkProviderSettings.onSubmit(dialog);
    verify(mWifiManager).connect(eq(config), any(WifiManager.ActionListener.class));
}
Also used : WifiDialog2(com.android.settings.wifi.WifiDialog2) WifiConfiguration(android.net.wifi.WifiConfiguration) Test(org.junit.Test)

Example 5 with WifiDialog2

use of com.android.settings.wifi.WifiDialog2 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)

Aggregations

WifiDialog2 (com.android.settings.wifi.WifiDialog2)5 Test (org.junit.Test)4 WifiConfiguration (android.net.wifi.WifiConfiguration)2 WifiEntry (com.android.wifitrackerlib.WifiEntry)2 WifiConfigController2 (com.android.settings.wifi.WifiConfigController2)1