use of android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestDialogFragmentTest method onUserSelectionCallbackRegistration_onClick_shouldCallSelect.
@Test
public void onUserSelectionCallbackRegistration_onClick_shouldCallSelect() {
// Assert.
final int indexClickItem = 3;
List<AccessPoint> accessPointList = createAccessPointList();
AccessPoint clickedAccessPoint = accessPointList.get(indexClickItem);
clickedAccessPoint.generateOpenNetworkConfig();
when(networkRequestDialogFragment.getAccessPointList()).thenReturn(accessPointList);
NetworkRequestUserSelectionCallback selectionCallback = mock(NetworkRequestUserSelectionCallback.class);
AlertDialog dialog = mock(AlertDialog.class);
networkRequestDialogFragment.onUserSelectionCallbackRegistration(selectionCallback);
// Act.
networkRequestDialogFragment.onClick(dialog, indexClickItem);
// Check.
verify(selectionCallback, times(1)).select(clickedAccessPoint.getConfig());
}
use of android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestErrorDialogFragmentTest method clickNegativeButton_shouldCallReject.
@Test
public void clickNegativeButton_shouldCallReject() {
final NetworkRequestUserSelectionCallback rejectCallback = mock(NetworkRequestUserSelectionCallback.class);
mFragment.setRejectCallback(rejectCallback);
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
final Button negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
negativeButton.performClick();
verify(rejectCallback, times(1)).reject();
}
use of android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestDialogFragmentTest method cancelDialog_callsReject.
@Test
public void cancelDialog_callsReject() {
// Assert
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 NetworkRequestDialogActivityTest method onClickConnectButton_shouldShowProgressDialog.
@Test
public void onClickConnectButton_shouldShowProgressDialog() {
NetworkRequestUserSelectionCallback networkRequestUserSelectionCallback = mock(NetworkRequestUserSelectionCallback.class);
startSpecifiedActivity();
final List<ScanResult> scanResults = new ArrayList<>();
scanResults.add(getScanResult(TEST_SSID, TEST_CAPABILITY));
mActivity.onMatch(scanResults);
mActivity.onUserSelectionCallbackRegistration(networkRequestUserSelectionCallback);
mActivity.onClickConnectButton();
assertThat(mActivity.mProgressDialog.isShowing()).isTrue();
assertThat(mActivity.mDialogFragment).isNull();
}
use of android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback in project android_packages_apps_Settings by omnirom.
the class NetworkRequestErrorDialogFragmentTest method clickNegativeButton_shouldCallReject.
@Test
public void clickNegativeButton_shouldCallReject() {
final NetworkRequestUserSelectionCallback rejectCallback = mock(NetworkRequestUserSelectionCallback.class);
mFragment.setRejectCallback(rejectCallback);
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
final Button negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
negativeButton.performClick();
verify(rejectCallback, times(1)).reject();
}
Aggregations