use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettingsTest method openSubscriptionHelpPage_shouldCallStartActivityForResult.
@Test
public void openSubscriptionHelpPage_shouldCallStartActivityForResult() {
doReturn(new Intent()).when(mNetworkProviderSettings).getHelpIntent(mContext, FAKE_URI_STRING);
doNothing().when(mNetworkProviderSettings).startActivityForResult(any(Intent.class), anyInt());
final WifiEntry mockWifiEntry = mock(WifiEntry.class);
when(mockWifiEntry.getHelpUriString()).thenReturn(FAKE_URI_STRING);
mNetworkProviderSettings.openSubscriptionHelpPage(mockWifiEntry);
verify(mNetworkProviderSettings, times(1)).startActivityForResult(any(), anyInt());
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettingsTest method createConnectedWifiEntryPreference_internetWiFi_createConnectedPreference.
@Test
public void createConnectedWifiEntryPreference_internetWiFi_createConnectedPreference() {
final WifiEntry wifiEntry = mock(WifiEntry.class);
doReturn(InternetUpdater.INTERNET_WIFI).when(mInternetUpdater).getInternetType();
final Preference p = mNetworkProviderSettings.createConnectedWifiEntryPreference(wifiEntry);
assertThat(p instanceof ConnectedWifiEntryPreference).isTrue();
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettingsTest method onCreateContextMenu_shouldHaveForgetAndDisconnectMenuForConnectedWifiEntry.
@Test
public void onCreateContextMenu_shouldHaveForgetAndDisconnectMenuForConnectedWifiEntry() {
final FragmentActivity activity = mock(FragmentActivity.class);
when(activity.getApplicationContext()).thenReturn(mContext);
when(mNetworkProviderSettings.getActivity()).thenReturn(activity);
final WifiEntry wifiEntry = mock(WifiEntry.class);
when(wifiEntry.canDisconnect()).thenReturn(true);
when(wifiEntry.canForget()).thenReturn(true);
when(wifiEntry.isSaved()).thenReturn(true);
when(wifiEntry.getConnectedState()).thenReturn(WifiEntry.CONNECTED_STATE_CONNECTED);
final LongPressWifiEntryPreference connectedWifiEntryPreference = mNetworkProviderSettings.createLongPressWifiEntryPreference(wifiEntry);
final View view = mock(View.class);
when(view.getTag()).thenReturn(connectedWifiEntryPreference);
final ContextMenu menu = mock(ContextMenu.class);
mNetworkProviderSettings.onCreateContextMenu(menu, view, null);
verify(menu).add(anyInt(), eq(NetworkProviderSettings.MENU_ID_FORGET), anyInt(), anyInt());
verify(menu).add(anyInt(), eq(NetworkProviderSettings.MENU_ID_DISCONNECT), anyInt(), anyInt());
}
use of com.android.wifitrackerlib.WifiEntry in project android_packages_apps_Settings by omnirom.
the class WifiUtilsTest method getWifiConfigByWifiEntry_shouldReturnCorrectConfig.
@Test
public void getWifiConfigByWifiEntry_shouldReturnCorrectConfig() {
final String testSSID = "WifiUtilsTest";
final WifiEntry wifiEntry = mock(WifiEntry.class);
when(wifiEntry.getSsid()).thenReturn(testSSID);
final WifiConfiguration config = WifiUtils.getWifiConfig(wifiEntry, null);
assertThat(config).isNotNull();
assertThat(config.SSID).isEqualTo("\"" + testSSID + "\"");
}
Aggregations