use of androidx.fragment.app.FragmentActivity in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettingsTest method onNumSavedNetworksChanged_isFinishing_ShouldNotCrash.
@Test
public void onNumSavedNetworksChanged_isFinishing_ShouldNotCrash() {
final FragmentActivity activity = mock(FragmentActivity.class);
when(activity.isFinishing()).thenReturn(true);
when(mNetworkProviderSettings.getActivity()).thenReturn(activity);
when(mNetworkProviderSettings.getContext()).thenReturn(null);
mNetworkProviderSettings.onNumSavedNetworksChanged();
}
use of androidx.fragment.app.FragmentActivity in project android_packages_apps_Settings by omnirom.
the class KeyboardLayoutPickerControllerTest method testLifecycle_onStart_shouldRegisterInputManager.
@Test
public void testLifecycle_onStart_shouldRegisterInputManager() {
final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
when(mFragment.getActivity()).thenReturn(activity);
mController.onStart();
// Register is called, but unregister should not be called.
verify(mInputManager).registerInputDeviceListener(mController, null);
verify(mInputManager, never()).unregisterInputDeviceListener(mController);
}
use of androidx.fragment.app.FragmentActivity in project android_packages_apps_Settings by omnirom.
the class UtilsTest method setActionBarShadowAnimation_shouldSetElevationToZero.
@Test
public void setActionBarShadowAnimation_shouldSetElevationToZero() {
final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
final ActionBar actionBar = activity.getActionBar();
Utils.setActionBarShadowAnimation(activity, activity.getLifecycle(), new ScrollView(mContext));
assertThat(actionBar.getElevation()).isEqualTo(0.f);
}
use of androidx.fragment.app.FragmentActivity in project android_packages_apps_Settings by omnirom.
the class WifiSettingsTest method onNumSavedSubscriptionsChanged_isFinishing_ShouldNotCrash.
@Test
public void onNumSavedSubscriptionsChanged_isFinishing_ShouldNotCrash() {
final FragmentActivity activity = mock(FragmentActivity.class);
when(activity.isFinishing()).thenReturn(true);
when(mWifiSettings.getActivity()).thenReturn(activity);
when(mWifiSettings.getContext()).thenReturn(null);
mWifiSettings.onNumSavedSubscriptionsChanged();
}
use of androidx.fragment.app.FragmentActivity in project android_packages_apps_Settings by omnirom.
the class WifiSettingsTest method onCreateContextMenu_shouldHaveForgetAndDisconnectMenuForConnectedWifiEntry.
@Test
public void onCreateContextMenu_shouldHaveForgetAndDisconnectMenuForConnectedWifiEntry() {
final FragmentActivity activity = mock(FragmentActivity.class);
when(activity.getApplicationContext()).thenReturn(mContext);
when(mWifiSettings.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 = mWifiSettings.createLongPressWifiEntryPreference(wifiEntry);
final View view = mock(View.class);
when(view.getTag()).thenReturn(connectedWifiEntryPreference);
final ContextMenu menu = mock(ContextMenu.class);
mWifiSettings.onCreateContextMenu(menu, view, null);
verify(menu).add(anyInt(), eq(WifiSettings.MENU_ID_FORGET), anyInt(), anyInt());
verify(menu).add(anyInt(), eq(WifiSettings.MENU_ID_DISCONNECT), anyInt(), anyInt());
}
Aggregations