use of android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback in project android_packages_apps_Settings by omnirom.
the class NetworkRequestDialogFragmentTest method cancelDialog_callsReject.
@Test
public void cancelDialog_callsReject() {
networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), /* tag */
null);
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
final NetworkRequestUserSelectionCallback selectionCallback = mock(NetworkRequestUserSelectionCallback.class);
networkRequestDialogFragment.onUserSelectionCallbackRegistration(selectionCallback);
// Action
final Button button = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
button.performClick();
// Check
verify(selectionCallback, times(1)).reject();
}
use of android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback in project android_packages_apps_Settings by omnirom.
the class NetworkRequestDialogFragmentTest method onClick_validSelection_shouldCallSelect.
@Test
public void onClick_validSelection_shouldCallSelect() {
final int indexClickItem = 3;
final List<WifiEntry> wifiEntryList = createWifiEntryList();
final WifiEntry clickedWifiEntry = wifiEntryList.get(indexClickItem);
final WifiConfiguration wifiConfig = new WifiConfiguration();
when(clickedWifiEntry.getWifiConfiguration()).thenReturn(wifiConfig);
networkRequestDialogFragment.mFilteredWifiEntries = wifiEntryList;
final NetworkRequestUserSelectionCallback selectionCallback = mock(NetworkRequestUserSelectionCallback.class);
final AlertDialog dialog = mock(AlertDialog.class);
networkRequestDialogFragment.onUserSelectionCallbackRegistration(selectionCallback);
networkRequestDialogFragment.onClick(dialog, indexClickItem);
verify(selectionCallback, times(1)).select(wifiConfig);
}
Aggregations