use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiScanWorkerTest method getWifiEntry_connectedWifiKey_shouldGetConnectedWifi.
@Test
public void getWifiEntry_connectedWifiKey_shouldGetConnectedWifi() {
final String key = "key";
final WifiEntry connectedWifiEntry = mock(WifiEntry.class);
when(connectedWifiEntry.getKey()).thenReturn(key);
when(mWifiPickerTracker.getConnectedWifiEntry()).thenReturn(connectedWifiEntry);
assertThat(mWifiScanWorker.getWifiEntry(key)).isEqualTo(connectedWifiEntry);
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiSettingsTest method openSubscriptionHelpPage_shouldCallStartActivityForResult.
@Test
public void openSubscriptionHelpPage_shouldCallStartActivityForResult() {
doReturn(new Intent()).when(mWifiSettings).getHelpIntent(mContext, FAKE_URI_STRING);
doNothing().when(mWifiSettings).startActivityForResult(any(Intent.class), anyInt());
final WifiEntry mockWifiEntry = mock(WifiEntry.class);
when(mockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING);
mWifiSettings.openSubscriptionHelpPage(mockWifiEntry);
verify(mWifiSettings, times(1)).startActivityForResult(any(), anyInt());
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiConnectionPreferenceControllerTest method onConnectedChanged_wifiBecameDisconnected_preferenceRemoved.
@Test
public void onConnectedChanged_wifiBecameDisconnected_preferenceRemoved() {
final WifiEntry wifiEntry = mock(WifiEntry.class);
when(mWifiPickerTracker.getConnectedWifiEntry()).thenReturn(wifiEntry);
mController.displayPreference(mScreen);
final ArgumentCaptor<WifiEntryPreference> captor = ArgumentCaptor.forClass(WifiEntryPreference.class);
verify(mPreferenceCategory).addPreference(captor.capture());
final WifiEntryPreference pref = captor.getValue();
// Become disconnected.
when(mWifiPickerTracker.getConnectedWifiEntry()).thenReturn(null);
final int onUpdatedCountBefore = mOnChildUpdatedCount;
mController.onWifiStateChanged();
verify(mPreferenceCategory).removePreference(pref);
assertThat(mOnChildUpdatedCount).isEqualTo(onUpdatedCountBefore + 1);
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiConnectionPreferenceControllerTest method displayPreference_hasConnectedWifiEntry_preferenceAdded.
@Test
public void displayPreference_hasConnectedWifiEntry_preferenceAdded() {
final WifiEntry wifiEntry = mock(WifiEntry.class);
when(mWifiPickerTracker.getConnectedWifiEntry()).thenReturn(wifiEntry);
mController.displayPreference(mScreen);
verify(mPreferenceCategory).addPreference(any(WifiEntryPreference.class));
}
use of com.android.wifitrackerlib.WifiEntry 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