use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.
the class RILTest method testWakeLockTimeout.
@FlakyTest
@Test
public void testWakeLockTimeout() {
invokeMethod(mRILInstance, "obtainRequest", new Class<?>[] { Integer.TYPE, Message.class, WorkSource.class }, new Object[] { RIL_REQUEST_GET_SIM_STATUS, obtainMessage(), new WorkSource() });
// The wake lock should be held when obtain a RIL request.
assertTrue(mRILInstance.getWakeLock(RIL.FOR_WAKELOCK).isHeld());
moveTimeForward(DEFAULT_WAKE_LOCK_TIMEOUT_MS);
processAllMessages();
// The wake lock should be released after processed the time out event.
assertFalse(mRILInstance.getWakeLock(RIL.FOR_WAKELOCK).isHeld());
}
use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.
the class RILTest method testWriteSmsToSim.
@FlakyTest
@Test
public void testWriteSmsToSim() throws Exception {
String smscPdu = "smscPdu";
String pdu = "pdu";
int status = SmsManager.STATUS_ON_ICC_READ;
SmsWriteArgs args = new SmsWriteArgs();
args.status = 1;
args.smsc = smscPdu;
args.pdu = pdu;
mRILUnderTest.writeSmsToSim(status, smscPdu, pdu, obtainMessage());
verify(mRadioProxy).writeSmsToSim(mSerialNumberCaptor.capture(), eq(args));
verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_WRITE_SMS_TO_SIM);
}
use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.
the class DcTrackerTest method testUserDisableData.
@Test
@MediumTest
@Ignore
@FlakyTest
public void testUserDisableData() throws Exception {
// step 1: setup two DataCalls one for Metered: default, another one for Non-metered: IMS
// set Default and MMS to be metered in the CarrierConfigManager
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);
logd("Sending DATA_DISABLED_CMD");
doReturn(false).when(mDataEnabledSettings).isDataEnabled();
doReturn(false).when(mDataEnabledSettings).isDataEnabled(anyInt());
AsyncResult ar = new AsyncResult(null, new Pair<>(false, DataEnabledSettings.REASON_USER_DATA_ENABLED), 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);
// expected tear down all metered DataConnections
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));
assertEquals(DctConstants.State.CONNECTED, mDct.getState(PhoneConstants.APN_TYPE_IMS));
}
use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.
the class DcTrackerTest method testNetworkStatusChangedRecoveryON.
@FlakyTest
@Test
@SmallTest
public void testNetworkStatusChangedRecoveryON() throws Exception {
ContentResolver resolver = mContext.getContentResolver();
Settings.Global.putInt(resolver, Settings.Global.DATA_STALL_RECOVERY_ON_BAD_NETWORK, 1);
Settings.System.putInt(resolver, "radio.data.stall.recovery.action", 0);
doReturn(new SignalStrength()).when(mPhone).getSignalStrength();
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, timeout(TEST_TIMEOUT).times(2)).setupDataCall(eq(AccessNetworkType.EUTRAN), dpCaptor.capture(), eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(), any(Message.class));
waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 21, 1, NETWORK_TYPE_LTE_BITMASK);
logd("Sending EVENT_NETWORK_STATUS_CHANGED");
mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED, NetworkAgent.VALID_NETWORK, 1, null));
waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
logd("Sending EVENT_NETWORK_STATUS_CHANGED");
mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED, NetworkAgent.INVALID_NETWORK, 1, null));
waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
// Data connection is running on a different thread. Have to wait.
waitForMs(200);
verify(mSimulatedCommandsVerifier, times(1)).getDataCallList(any(Message.class));
}
use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.
the class DcTrackerTest method testRecoveryStepPDPReset.
@FlakyTest
@Test
@SmallTest
public void testRecoveryStepPDPReset() throws Exception {
ContentResolver resolver = mContext.getContentResolver();
Settings.Global.putInt(resolver, Settings.Global.DATA_STALL_RECOVERY_ON_BAD_NETWORK, 1);
Settings.Global.putLong(resolver, Settings.Global.MIN_DURATION_BETWEEN_RECOVERY_STEPS_IN_MS, 100);
Settings.System.putInt(resolver, "radio.data.stall.recovery.action", 1);
doReturn(new SignalStrength()).when(mPhone).getSignalStrength();
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, timeout(TEST_TIMEOUT).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, 21, 1, NETWORK_TYPE_LTE_BITMASK);
logd("Sending EVENT_NETWORK_STATUS_CHANGED false");
mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED, NetworkAgent.INVALID_NETWORK, 1, null));
waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
waitForMs(200);
// expected tear down all DataConnections
verify(mSimulatedCommandsVerifier, times(1)).deactivateDataCall(eq(DataService.REQUEST_REASON_NORMAL), anyInt(), any(Message.class));
}
Aggregations