use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class MobileNetworkSwitchControllerTest method switchChangeListener_fromEnabledToDisabled_setSubscriptionEnabledFailed.
@Test
@UiThreadTest
@Ignore
public void switchChangeListener_fromEnabledToDisabled_setSubscriptionEnabledFailed() {
when(mSubscriptionManager.setSubscriptionEnabled(eq(mSubId), anyBoolean())).thenReturn(false);
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
mController.displayPreference(mScreen);
assertThat(mSwitchBar.isShowing()).isTrue();
assertThat(mSwitchBar.isChecked()).isTrue();
final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
doNothing().when(mContext).startActivity(intentCaptor.capture());
mSwitchBar.setChecked(false);
Bundle extra = intentCaptor.getValue().getExtras();
verify(mContext, times(1)).startActivity(any());
assertThat(extra.getInt(ToggleSubscriptionDialogActivity.ARG_SUB_ID)).isEqualTo(mSubId);
assertThat(extra.getBoolean(ToggleSubscriptionDialogActivity.ARG_enable)).isEqualTo(false);
assertThat(mSwitchBar.isChecked()).isTrue();
}
use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class NetworkProviderWorkerTest method getWifiEntry_connectedWifiKey_shouldGetConnectedWifi.
@Test
@UiThreadTest
public void getWifiEntry_connectedWifiKey_shouldGetConnectedWifi() {
final String key = "key";
final WifiEntry connectedWifiEntry = mock(WifiEntry.class);
when(connectedWifiEntry.getKey()).thenReturn(key);
when(mMockWifiPickerTracker.getConnectedWifiEntry()).thenReturn(connectedWifiEntry);
assertThat(mMockNetworkProviderWorker.getWifiEntry(key)).isEqualTo(connectedWifiEntry);
}
use of androidx.test.annotation.UiThreadTest in project android_packages_apps_Settings by omnirom.
the class NetworkProviderWorkerTest method getWifiEntry_reachableWifiKey_shouldGetReachableWifi.
@Test
@UiThreadTest
public void getWifiEntry_reachableWifiKey_shouldGetReachableWifi() {
final String key = "key";
final WifiEntry reachableWifiEntry = mock(WifiEntry.class);
when(reachableWifiEntry.getKey()).thenReturn(key);
when(mMockWifiPickerTracker.getWifiEntries()).thenReturn(Arrays.asList(reachableWifiEntry));
assertThat(mMockNetworkProviderWorker.getWifiEntry(key)).isEqualTo(reachableWifiEntry);
}
use of androidx.test.annotation.UiThreadTest in project RxBinding by JakeWharton.
the class RxTabLayoutTest method selectionsNoInitial.
@Test
@UiThreadTest
public void selectionsNoInitial() {
TabLayout empty = new TabLayout(context);
RecordingObserver<TabLayout.Tab> o = new RecordingObserver<>();
RxTabLayout.selections(empty).subscribe(o);
o.assertNoMoreEvents();
}
use of androidx.test.annotation.UiThreadTest in project RxBinding by JakeWharton.
the class RxViewTest method focusChanges.
@Test
@UiThreadTest
public void focusChanges() {
// We need a parent which can take focus from our view when it attempts to clear.
LinearLayout parent = new LinearLayout(context);
parent.setFocusable(true);
parent.addView(view);
view.setFocusable(true);
RecordingObserver<Boolean> o = new RecordingObserver<>();
RxView.focusChanges(view).subscribe(o);
assertFalse(o.takeNext());
view.requestFocus();
assertTrue(o.takeNext());
view.clearFocus();
assertFalse(o.takeNext());
o.dispose();
view.requestFocus();
o.assertNoMoreEvents();
}
Aggregations