use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.
the class GsmInboundSmsHandlerTest method testInjectSms.
@FlakyTest
@Test
@MediumTest
public void testInjectSms() {
transitionFromStartupToIdle();
mGsmInboundSmsHandler.sendMessage(InboundSmsHandler.EVENT_INJECT_SMS, new AsyncResult(null, mSmsMessage, null));
processAllMessages();
verifySmsIntentBroadcasts(0);
// inject same SMS again, verify no broadcasts are sent
mGsmInboundSmsHandler.sendMessage(InboundSmsHandler.EVENT_INJECT_SMS, new AsyncResult(null, mSmsMessage, null));
processAllMessages();
verify(mContext, times(2)).sendBroadcast(any(Intent.class));
assertEquals("IdleState", getCurrentState().getName());
verifySmsFiltersInvoked(times(1));
}
use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.
the class DcTrackerTest method testCarrierActionSetMeteredApnsEnabled.
// Test for API carrierActionSetMeteredApnsEnabled.
@FlakyTest
@Ignore
@Test
@MediumTest
public void testCarrierActionSetMeteredApnsEnabled() throws Exception {
// step 1: setup two DataCalls one for Internet and IMS
// step 2: set data is enabled
// step 3: cold sim is detected
// step 4: all data connection is torn down
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[] { PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS });
mDct.enableApn(ApnSetting.TYPE_IMS, DcTracker.REQUEST_TYPE_NORMAL, null);
mDct.enableApn(ApnSetting.TYPE_DEFAULT, DcTracker.REQUEST_TYPE_NORMAL, null);
sendInitializationEvents();
ArgumentCaptor<DataProfile> dpCaptor = ArgumentCaptor.forClass(DataProfile.class);
verify(mSimulatedCommandsVerifier, times(2)).setupDataCall(eq(AccessNetworkType.EUTRAN), dpCaptor.capture(), eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(), any(Message.class));
verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 5, 1, NETWORK_TYPE_LTE_BITMASK);
assertTrue(mDct.isAnyDataConnected());
AsyncResult ar = new AsyncResult(null, new Pair<>(false, DataEnabledSettings.REASON_DATA_ENABLED_BY_CARRIER), null);
mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_ENABLED_CHANGED, ar));
waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
// Data connection is running on a different thread. Have to wait.
waitForMs(200);
// Validate all metered data connections have been torn down
verify(mSimulatedCommandsVerifier, times(1)).deactivateDataCall(eq(DataService.REQUEST_REASON_NORMAL), anyInt(), any(Message.class));
assertTrue(mDct.isAnyDataConnected());
assertEquals(DctConstants.State.IDLE, mDct.getState(PhoneConstants.APN_TYPE_DEFAULT));
}
Aggregations