Search in sources :

Example 31 with MediumTest

use of android.support.test.filters.MediumTest in project android_frameworks_opt_telephony by LineageOS.

the class GsmInboundSmsHandlerTest method testWaitingStateTimeout.

@FlakyTest
@Ignore
@Test
@MediumTest
public void testWaitingStateTimeout() throws Exception {
    transitionFromStartupToIdle();
    // send new SMS to state machine and verify that triggers SMS_DELIVER_ACTION
    mGsmInboundSmsHandler.sendMessage(InboundSmsHandler.EVENT_NEW_SMS, new AsyncResult(null, mSmsMessage, null));
    waitForMs(100);
    ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class);
    verify(mContext, times(1)).sendBroadcast(intentArgumentCaptor.capture());
    assertEquals(Telephony.Sms.Intents.SMS_DELIVER_ACTION, intentArgumentCaptor.getAllValues().get(0).getAction());
    assertEquals("WaitingState", getCurrentState().getName());
    waitForMs(InboundSmsHandler.STATE_TIMEOUT + 300);
    assertEquals("IdleState", getCurrentState().getName());
}
Also used : Intent(android.content.Intent) AsyncResult(android.os.AsyncResult) FlakyTest(android.support.test.filters.FlakyTest) Ignore(org.junit.Ignore) TelephonyTest(com.android.internal.telephony.TelephonyTest) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) MediumTest(android.support.test.filters.MediumTest)

Example 32 with MediumTest

use of android.support.test.filters.MediumTest in project android_frameworks_opt_telephony by LineageOS.

the class GsmInboundSmsHandlerTest method testNewSms.

@FlakyTest
@Ignore
@Test
@MediumTest
public void testNewSms() {
    transitionFromStartupToIdle();
    // send new SMS to state machine and verify that triggers SMS_DELIVER_ACTION
    mGsmInboundSmsHandler.sendMessage(InboundSmsHandler.EVENT_NEW_SMS, new AsyncResult(null, mSmsMessage, null));
    waitForMs(100);
    verifySmsIntentBroadcasts(0);
    // send same SMS again, verify no broadcasts are sent
    mGsmInboundSmsHandler.sendMessage(InboundSmsHandler.EVENT_NEW_SMS, new AsyncResult(null, mSmsMessage, null));
    waitForMs(100);
    verify(mContext, times(2)).sendBroadcast(any(Intent.class));
    assertEquals("IdleState", getCurrentState().getName());
}
Also used : Intent(android.content.Intent) AsyncResult(android.os.AsyncResult) FlakyTest(android.support.test.filters.FlakyTest) Ignore(org.junit.Ignore) TelephonyTest(com.android.internal.telephony.TelephonyTest) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) MediumTest(android.support.test.filters.MediumTest)

Aggregations

MediumTest (android.support.test.filters.MediumTest)32 Test (org.junit.Test)32 Intent (android.content.Intent)11 Handler (android.os.Handler)11 FlakyTest (android.support.test.filters.FlakyTest)11 TelephonyTest (com.android.internal.telephony.TelephonyTest)11 Parcelable (android.os.Parcelable)10 SmallTest (android.support.test.filters.SmallTest)10 AsyncResult (android.os.AsyncResult)9 View (android.view.View)9 NestedScrollView (android.support.v4.widget.NestedScrollView)8 TextView (android.widget.TextView)8 CoordinatesProvider (android.support.test.espresso.action.CoordinatesProvider)6 GeneralSwipeAction (android.support.test.espresso.action.GeneralSwipeAction)6 SmsHeader (com.android.internal.telephony.SmsHeader)5 Ignore (org.junit.Ignore)4 CustomSnackbar (android.support.design.testapp.custom.CustomSnackbar)2 BroadcastReceiver (android.content.BroadcastReceiver)1 ContentValues (android.content.ContentValues)1 IntentFilter (android.content.IntentFilter)1