Search in sources :

Example 31 with FlakyTest

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));
}
Also used : Intent(android.content.Intent) AsyncResult(android.os.AsyncResult) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) MediumTest(androidx.test.filters.MediumTest) Test(org.junit.Test) MediumTest(androidx.test.filters.MediumTest)

Example 32 with FlakyTest

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));
}
Also used : DataProfile(android.telephony.data.DataProfile) Message(android.os.Message) AsyncResult(android.os.AsyncResult) FlakyTest(androidx.test.filters.FlakyTest) Ignore(org.junit.Ignore) FlakyTest(androidx.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

FlakyTest (androidx.test.filters.FlakyTest)32 Test (org.junit.Test)32 SmallTest (android.test.suitebuilder.annotation.SmallTest)13 TelephonyTest (com.android.internal.telephony.TelephonyTest)13 Ignore (org.junit.Ignore)11 MediumTest (android.test.suitebuilder.annotation.MediumTest)10 Message (android.os.Message)9 WorkSource (android.os.WorkSource)9 AsyncResult (android.os.AsyncResult)6 Intent (android.content.Intent)5 DataProfile (android.telephony.data.DataProfile)5 Context (android.content.Context)4 GsmSmsMessage (android.hardware.radio.V1_0.GsmSmsMessage)4 CdmaSmsMessage (android.hardware.radio.V1_0.CdmaSmsMessage)3 ImsSmsMessage (android.hardware.radio.V1_0.ImsSmsMessage)3 ContentResolver (android.content.ContentResolver)2 DataProfileInfo (android.hardware.radio.V1_0.DataProfileInfo)2 NvWriteItem (android.hardware.radio.V1_0.NvWriteItem)2 SmsWriteArgs (android.hardware.radio.V1_0.SmsWriteArgs)2 CellIdentityCdma (android.telephony.CellIdentityCdma)2