Search in sources :

Example 1 with WifiPickerTracker

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

the class NetworkRequestDialogFragmentTest method onMatchManyResult_showNeutralButton.

@Test
public void onMatchManyResult_showNeutralButton() {
    networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), /* tag */
    null);
    final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    List<WifiEntry> wifiEntryList = createWifiEntryList();
    final WifiPickerTracker wifiPickerTracker = mock(WifiPickerTracker.class);
    when(wifiPickerTracker.getWifiEntries()).thenReturn(wifiEntryList);
    networkRequestDialogFragment.mWifiPickerTracker = wifiPickerTracker;
    final String ssidAp = "Test AP ";
    final List<ScanResult> scanResults = new ArrayList<>();
    for (int i = 0; i < 7; i++) {
        ScanResult scanResult = mock(ScanResult.class);
        scanResult.SSID = ssidAp + i;
        scanResult.capabilities = "WEP";
        scanResults.add(scanResult);
    }
    networkRequestDialogFragment.onMatch(scanResults);
    final Button button = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
    assertThat(button).isNotNull();
    assertThat(button.getVisibility()).isEqualTo(View.VISIBLE);
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) ScanResult(android.net.wifi.ScanResult) Button(android.widget.Button) WifiPickerTracker(com.android.wifitrackerlib.WifiPickerTracker) WifiEntry(com.android.wifitrackerlib.WifiEntry) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

ScanResult (android.net.wifi.ScanResult)1 Button (android.widget.Button)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 WifiEntry (com.android.wifitrackerlib.WifiEntry)1 WifiPickerTracker (com.android.wifitrackerlib.WifiPickerTracker)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1