Search in sources :

Example 6 with FlakyTest

use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testSetSimCardPowerForPowerUpState.

@FlakyTest
@Test
public void testSetSimCardPowerForPowerUpState() throws Exception {
    mRILUnderTest.setSimCardPower(TelephonyManager.CARD_POWER_UP, obtainMessage(), new WorkSource());
    verify(mRadioProxy).setSimCardPower(mSerialNumberCaptor.capture(), eq(true));
    verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SET_SIM_CARD_POWER);
}
Also used : WorkSource(android.os.WorkSource) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 7 with FlakyTest

use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testGetModemActivityInfoTimeout.

@FlakyTest
@Test
public void testGetModemActivityInfoTimeout() {
    mRILUnderTest.getModemActivityInfo(obtainMessage(), new WorkSource());
    assertEquals(1, mRILUnderTest.getRilRequestList().size());
    moveTimeForward(DEFAULT_BLOCKING_MESSAGE_RESPONSE_TIMEOUT_MS);
    processAllMessages();
    assertEquals(0, mRILUnderTest.getRilRequestList().size());
}
Also used : WorkSource(android.os.WorkSource) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 8 with FlakyTest

use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testSendRetryImsCdmaSms.

@FlakyTest
@Test
public void testSendRetryImsCdmaSms() throws Exception {
    CdmaSmsMessage cdmaMsg = new CdmaSmsMessage();
    ImsSmsMessage firstMsg = new ImsSmsMessage();
    firstMsg.tech = RILConstants.CDMA_PHONE;
    firstMsg.retry = false;
    firstMsg.messageRef = 0;
    firstMsg.cdmaMessage.add(cdmaMsg);
    ImsSmsMessage retryMsg = new ImsSmsMessage();
    retryMsg.tech = RILConstants.CDMA_PHONE;
    retryMsg.retry = true;
    retryMsg.messageRef = 0;
    retryMsg.cdmaMessage.add(cdmaMsg);
    int maxRetryCount = 3;
    int firstTransmission = 0;
    byte[] pdu = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    for (int i = 0; i <= maxRetryCount; i++) {
        mRILUnderTest.sendImsCdmaSms(pdu, i, 0, obtainMessage());
        if (i == firstTransmission) {
            verify(mRadioProxy, times(1)).sendImsSms(mSerialNumberCaptor.capture(), eq(firstMsg));
            verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_IMS_SEND_SMS);
        } else {
            verify(mRadioProxy, times(i)).sendImsSms(mSerialNumberCaptor.capture(), eq(retryMsg));
            verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_IMS_SEND_SMS);
        }
    }
}
Also used : CdmaSmsMessage(android.hardware.radio.V1_0.CdmaSmsMessage) ImsSmsMessage(android.hardware.radio.V1_0.ImsSmsMessage) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 9 with FlakyTest

use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testSetSimCardPowerForPowerDownState.

@FlakyTest
@Test
public void testSetSimCardPowerForPowerDownState() throws Exception {
    mRILUnderTest.setSimCardPower(TelephonyManager.CARD_POWER_DOWN, obtainMessage(), new WorkSource());
    verify(mRadioProxy).setSimCardPower(mSerialNumberCaptor.capture(), eq(false));
    verifyRILResponse(mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SET_SIM_CARD_POWER);
}
Also used : WorkSource(android.os.WorkSource) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 10 with FlakyTest

use of androidx.test.filters.FlakyTest in project android_frameworks_opt_telephony by LineageOS.

the class ServiceStateTrackerTest method testSpnUpdateShowPlmnOnly.

@FlakyTest
@Ignore
@Test
@MediumTest
public void testSpnUpdateShowPlmnOnly() {
    doReturn(0).when(mSimRecords).getCarrierNameDisplayCondition();
    doReturn(IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN).when(mUiccCardApplication3gpp).getState();
    sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_NETWORK_STATE_CHANGED, null));
    waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
    ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class);
    verify(mContextFixture.getTestDouble(), times(3)).sendStickyBroadcastAsUser(intentArgumentCaptor.capture(), eq(UserHandle.ALL));
    // We only want to verify the intent SERVICE_PROVIDERS_UPDATED.
    List<Intent> intents = intentArgumentCaptor.getAllValues();
    logd("Total " + intents.size() + " intents");
    for (Intent intent : intents) {
        logd("  " + intent.getAction());
    }
    Intent intent = intents.get(2);
    assertEquals(TelephonyManager.ACTION_SERVICE_PROVIDERS_UPDATED, intent.getAction());
    Bundle b = intent.getExtras();
    // For boolean we need to make sure the key exists first
    assertTrue(b.containsKey(TelephonyManager.EXTRA_SHOW_SPN));
    assertFalse(b.getBoolean(TelephonyManager.EXTRA_SHOW_SPN));
    assertEquals(null, b.getString(TelephonyManager.EXTRA_SPN));
    assertEquals(null, b.getString(TelephonyManager.EXTRA_DATA_SPN));
    // For boolean we need to make sure the key exists first
    assertTrue(b.containsKey(TelephonyManager.EXTRA_SHOW_PLMN));
    assertTrue(b.getBoolean(TelephonyManager.EXTRA_SHOW_PLMN));
    assertEquals(SimulatedCommands.FAKE_LONG_NAME, b.getString(TelephonyManager.EXTRA_PLMN));
    ArgumentCaptor<Integer> intArgumentCaptor = ArgumentCaptor.forClass(Integer.class);
    verify(mTelephonyManager).setDataNetworkTypeForPhone(anyInt(), intArgumentCaptor.capture());
    assertEquals(ServiceState.RIL_RADIO_TECHNOLOGY_HSPA, intArgumentCaptor.getValue().intValue());
}
Also used : Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) Intent(android.content.Intent) FlakyTest(androidx.test.filters.FlakyTest) Ignore(org.junit.Ignore) FlakyTest(androidx.test.filters.FlakyTest) 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