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;
}
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());
}
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));
}
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));
}
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);
}
Aggregations