Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaConnectionTest.java +0 −61 Original line number Diff line number Diff line Loading @@ -89,11 +89,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { @Test @SmallTest public void testOriginalDialString(){ doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, "+8610000", mCT, null, new DialArgs.Builder().build()); assertEquals("+8610000", connection.getOrigDialString()); doReturn(PhoneConstants.PHONE_TYPE_GSM).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, "+8610000", mCT, null, new DialArgs.Builder().build()); Loading @@ -117,24 +112,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { assertEquals("+1 (700).555-41NN,1234", connection.getOrigDialString()); } @Test @SmallTest public void testSanityCDMA() { doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, String.format( "+1 (700).555-41NN%c1234", PhoneNumberUtils.PAUSE), mCT, null, new DialArgs.Builder().build()); logd("Testing initial state of GsmCdmaConnection"); assertEquals(GsmCdmaCall.State.IDLE, connection.getState()); assertEquals(Connection.PostDialState.NOT_STARTED, connection.getPostDialState()); assertEquals(DisconnectCause.NOT_DISCONNECTED, DisconnectCause.NOT_DISCONNECTED); assertEquals(0, connection.getDisconnectTime()); assertEquals(0, connection.getHoldDurationMillis()); assertEquals(PhoneConstants.PRESENTATION_ALLOWED, connection.getNumberPresentation()); assertFalse(connection.isMultiparty()); assertNotNull(connection.getRemainingPostDialString()); assertEquals("+1 (700).555-41NN,1234", connection.getOrigDialString()); } @Test @SmallTest public void testConnectionStateUpdate() { connection = new GsmCdmaConnection(mPhone, String.format( Loading @@ -154,25 +131,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { assertTrue(connection.getHoldDurationMillis() >= 50); } @Test @MediumTest public void testCDMAPostDialPause() { doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, String.format( "+1 (700).555-41NN%c1234", PhoneNumberUtils.PAUSE), mCT, null, new DialArgs.Builder().build()); logd("Mock connection state from alerting to active "); mDC.state = DriverCall.State.ALERTING; connection.update(mDC); mDC.state = DriverCall.State.ACTIVE; connection.update(mDC); logd("process post dail sequence with pause"); assertEquals(Connection.PostDialState.PAUSE, connection.getPostDialState()); /* pause for 2000 ms */ moveTimeForward(GsmCdmaConnection.PAUSE_DELAY_MILLIS_CDMA); processAllMessages(); assertEquals(Connection.PostDialState.COMPLETE, connection.getPostDialState()); } @Test @MediumTest public void testGSMPostDialPause() { connection = new GsmCdmaConnection(mPhone, String.format( Loading @@ -191,25 +149,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { assertEquals(Connection.PostDialState.COMPLETE, connection.getPostDialState()); } @Test @SmallTest public void testPostDialWait() { doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, String.format("+1 (700).555-41NN%c1234", PhoneNumberUtils.WAIT),mCT,null, new DialArgs.Builder().build()); logd("Mock connection state transition from alerting to active "); mDC.state = DriverCall.State.ALERTING; connection.update(mDC); mDC.state = DriverCall.State.ACTIVE; connection.update(mDC); logd("Process the post dial sequence with wait "); assertEquals(Connection.PostDialState.WAIT, connection.getPostDialState()); connection.proceedAfterWaitChar(); processAllMessages(); assertEquals(Connection.PostDialState.COMPLETE, connection.getPostDialState()); } @Test @SmallTest public void testHangUpConnection() { connection = new GsmCdmaConnection(mPhone, String.format( Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +0 −303 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; Loading @@ -64,7 +63,6 @@ import android.os.Handler; import android.os.Message; import android.os.PersistableBundle; import android.os.Process; import android.os.UserHandle; import android.os.UserManager; import android.os.WorkSource; import android.preference.PreferenceManager; Loading Loading @@ -107,7 +105,6 @@ import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.IccCardStatus; import com.android.internal.telephony.uicc.IccConstants; import com.android.internal.telephony.uicc.IccRecords; import com.android.internal.telephony.uicc.IccVmNotSupportedException; import com.android.internal.telephony.uicc.UiccController; import com.android.internal.telephony.uicc.UiccPort; import com.android.internal.telephony.uicc.UiccProfile; Loading @@ -119,7 +116,6 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; Loading Loading @@ -159,14 +155,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(PhoneConstants.PHONE_TYPE_GSM, mPhoneUT.getPhoneType()); } private void switchToCdma() { mSimulatedCommands.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_IS95A); mPhoneUT.sendMessage(mPhoneUT.obtainMessage(GsmCdmaPhone.EVENT_VOICE_RADIO_TECH_CHANGED, new AsyncResult(null, new int[]{ServiceState.RIL_RADIO_TECHNOLOGY_IS95A}, null))); processAllMessages(); assertEquals(PhoneConstants.PHONE_TYPE_CDMA, mPhoneUT.getPhoneType()); } @Before public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); Loading Loading @@ -209,14 +197,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { super.tearDown(); } @Test @SmallTest public void testPhoneTypeSwitch() { assertTrue(mPhoneUT.isPhoneTypeGsm()); switchToCdma(); assertTrue(mPhoneUT.isPhoneTypeCdmaLte()); } @Test @SmallTest public void testGetServiceState() { Loading Loading @@ -447,9 +427,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { doReturn(cellLocation).when(mSST).getCellIdentity(); assertEquals(cellLocation, mPhoneUT.getCurrentCellIdentity()); // Switch to CDMA switchToCdma(); CellIdentityCdma cdmaCellLocation = new CellIdentityCdma(); doReturn(cdmaCellLocation).when(mSST).getCellIdentity(); Loading @@ -459,50 +436,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(actualCellLocation, cdmaCellLocation); } @Test @SmallTest public void testGetPhoneType() { assertEquals(PhoneConstants.PHONE_TYPE_GSM, mPhoneUT.getPhoneType()); // Switch to CDMA switchToCdma(); assertEquals(PhoneConstants.PHONE_TYPE_CDMA, mPhoneUT.getPhoneType()); } @Test @SmallTest public void testHandleInCallMmiCommands() { try { // Switch to CDMA switchToCdma(); assertFalse(mPhoneUT.handleInCallMmiCommands("0")); // Switch to GSM switchToGsm(); mCT.mForegroundCall = mGsmCdmaCall; mCT.mBackgroundCall = mGsmCdmaCall; mCT.mRingingCall = mGsmCdmaCall; doReturn(GsmCdmaCall.State.IDLE).when(mGsmCdmaCall).getState(); // !isInCall assertFalse(mPhoneUT.handleInCallMmiCommands("0")); // isInCall doReturn(GsmCdmaCall.State.ACTIVE).when(mGsmCdmaCall).getState(); assertTrue(mPhoneUT.handleInCallMmiCommands("0")); // empty dialString assertFalse(mPhoneUT.handleInCallMmiCommands("")); assertFalse(mPhoneUT.handleInCallMmiCommands(null)); } catch (Exception e) { fail(e.toString()); } } @Test @SmallTest public void testDial() throws Exception { Loading Loading @@ -763,37 +696,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertTrue(mPhoneUT.isInEmergencySmsMode()); } @Test @SmallTest public void testSendBurstDtmf() { //Should do nothing for GSM mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); switchToCdma(); //invalid character mPhoneUT.sendBurstDtmf("12345a67890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); //state IDLE mCT.mState = PhoneConstants.State.IDLE; mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); //state RINGING mCT.mState = PhoneConstants.State.RINGING; mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); mCT.mState = PhoneConstants.State.OFFHOOK; mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier).sendBurstDtmf("1234567890", 0, 0, null); } @Test @SmallTest public void testVoiceMailNumberGsm() { Loading Loading @@ -855,90 +757,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); } @Test @SmallTest public void testVoiceMailNumberCdma() { switchToCdma(); String voiceMailNumber = "1234567890"; // config_telephony_use_own_number_for_voicemail mContextFixture.getCarrierConfigBundle() .putBoolean(CarrierConfigManager .KEY_CONFIG_TELEPHONY_USE_OWN_NUMBER_FOR_VOICEMAIL_BOOL, true); doReturn(voiceMailNumber).when(mSST).getMdnNumber(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from config voiceMailNumber = "1234567891"; mContextFixture.getCarrierConfigBundle(). putString(CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_STRING, voiceMailNumber); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from config for roaming network String voiceMailNumberForRoaming = "1234567892"; mContextFixture.getCarrierConfigBundle() .putString(CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_ROAMING_STRING, voiceMailNumberForRoaming); // voicemail number from config for roaming network and ims unregistered String voiceMailNumberForImsRoamingAndUnregistered = "1234567893"; mContextFixture.getCarrierConfigBundle().putString( CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_ROAMING_AND_IMS_UNREGISTERED_STRING, voiceMailNumberForImsRoamingAndUnregistered); //Verify voicemail number for home doReturn(false).when(mSST.mSS).getRoaming(); doReturn(true).when(mSST).isImsRegistered(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); //Move to ims condition, verify voicemail number for ims unregistered doReturn(false).when(mSST).isImsRegistered(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); //Move to roaming condition, verify voicemail number for roaming doReturn(true).when(mSST.mSS).getRoaming(); assertEquals(voiceMailNumberForImsRoamingAndUnregistered, mPhoneUT.getVoiceMailNumber()); //Move to ims condition, verify voicemail number for roaming doReturn(true).when(mSST).isImsRegistered(); assertEquals(voiceMailNumberForRoaming, mPhoneUT.getVoiceMailNumber()); //Move to home condition, verify voicemail number for home doReturn(false).when(mSST.mSS).getRoaming(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from sharedPreference voiceMailNumber = "1234567893"; mPhoneUT.setVoiceMailNumber("alphaTag", voiceMailNumber, null); ArgumentCaptor<Message> messageArgumentCaptor = ArgumentCaptor.forClass(Message.class); InOrder inOrder = inOrder(mSimRecords); inOrder.verify(mSimRecords).setVoiceMailNumber(eq("alphaTag"), eq(voiceMailNumber), messageArgumentCaptor.capture()); // SIM does not support voicemail number (IccVmNotSupportedException) so should be saved in // shared pref Message msg = messageArgumentCaptor.getValue(); AsyncResult.forMessage(msg).exception = new IccVmNotSupportedException("setVoiceMailNumber not implemented"); msg.sendToTarget(); processAllMessages(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from SIM voiceMailNumber = "1234567894"; mPhoneUT.setVoiceMailNumber("alphaTag", voiceMailNumber, null); messageArgumentCaptor = ArgumentCaptor.forClass(Message.class); inOrder.verify(mSimRecords).setVoiceMailNumber(eq("alphaTag"), eq(voiceMailNumber), messageArgumentCaptor.capture()); // successfully saved on SIM msg = messageArgumentCaptor.getValue(); AsyncResult.forMessage(msg); msg.sendToTarget(); processAllMessages(); doReturn(voiceMailNumber).when(mSimRecords).getVoiceMailNumber(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); } @FlakyTest @Test @Ignore Loading Loading @@ -1044,60 +862,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { verify(mSimRecords).setVoiceCallForwardingFlag(anyInt(), anyBoolean(), eq(cfNumber)); } /** * GsmCdmaPhone handles a lot of messages. This function verifies behavior for messages that are * received when obj is created and that are received on phone type switch */ @FlakyTest @Ignore @Test @SmallTest public void testHandleInitialMessages() { // EVENT_RADIO_AVAILABLE verify(mSimulatedCommandsVerifier).getBasebandVersion(nullable(Message.class)); verify(mSimulatedCommandsVerifier).getDeviceIdentity(nullable(Message.class)); verify(mSimulatedCommandsVerifier).getRadioCapability(nullable(Message.class)); // EVENT_RADIO_ON verify(mSimulatedCommandsVerifier).getVoiceRadioTechnology(nullable(Message.class)); verify(mSimulatedCommandsVerifier).setPreferredNetworkType( eq(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA), nullable(Message.class)); // verify responses for above requests: // baseband version verify(mTelephonyManager).setBasebandVersionForPhone(eq(mPhoneUT.getPhoneId()), nullable(String.class)); // IMEI assertEquals(FAKE_IMEI, mPhoneUT.getImei()); // IMEISV assertEquals(SimulatedCommands.FAKE_IMEISV, mPhoneUT.getDeviceSvn()); // radio capability verify(mSimulatedCommandsVerifier).getNetworkSelectionMode(nullable(Message.class)); switchToCdma(); // this leads to eventRadioAvailable handling on cdma // EVENT_RADIO_AVAILABLE verify(mSimulatedCommandsVerifier, times(2)).getBasebandVersion(nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(2)).getDeviceIdentity(nullable(Message.class)); // EVENT_RADIO_ON verify(mSimulatedCommandsVerifier, times(2)).getVoiceRadioTechnology( nullable(Message.class)); // once on radio on, and once on get baseband version verify(mSimulatedCommandsVerifier, times(3)).setPreferredNetworkType( eq(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA), nullable(Message.class)); // verify responses for above requests: // baseband version verify(mTelephonyManager, times(2)).setBasebandVersionForPhone(eq(mPhoneUT.getPhoneId()), nullable(String.class)); // device identity assertEquals(FAKE_IMEI, mPhoneUT.getImei()); assertEquals(SimulatedCommands.FAKE_IMEISV, mPhoneUT.getDeviceSvn()); assertEquals(SimulatedCommands.FAKE_ESN, mPhoneUT.getEsn()); assertEquals(SimulatedCommands.FAKE_MEID, mPhoneUT.getMeid()); } @Test public void testZeroMeid() { doReturn(false).when(mSST).isDeviceShuttingDown(); Loading Loading @@ -1309,22 +1073,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(msisdn, mPhoneUT.getLine1Number()); } @Test @SmallTest public void testGetLine1NumberForCdmaPhone() { final String mdn = "1234567890"; final String msisdn = "+1234567890"; doReturn(mdn).when(mSST).getMdnNumber(); doReturn(msisdn).when(mSimRecords).getMsisdnNumber(); switchToCdma(); assertEquals(mdn, mPhoneUT.getLine1Number()); mContextFixture.getCarrierConfigBundle().putBoolean( CarrierConfigManager.KEY_USE_USIM_BOOL, true); assertEquals(msisdn, mPhoneUT.getLine1Number()); } @Test @SmallTest public void testEnableUiccApplications() throws Exception { Loading Loading @@ -2781,57 +2529,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { verify(est).exitEmergencyCallbackMode(); } @Test @SmallTest public void testEcbmOnModemResetForNonGsmPhone() throws Exception { switchToCdma(); assertFalse(mPhoneUT.isInEcm()); mPhoneUT.handleMessage(mPhoneUT.obtainMessage( GsmCdmaPhone.EVENT_EMERGENCY_CALLBACK_MODE_ENTER)); assertTrue(mPhoneUT.isInEcm()); Message m = mPhoneUT.obtainMessage(GsmCdmaPhone.EVENT_MODEM_RESET); AsyncResult.forMessage(m); mPhoneUT.handleMessage(m); assertFalse(mPhoneUT.isInEcm()); verifyEcbmIntentWasSent(2 /*times*/, false /*inEcm*/); } @Test @SmallTest public void testEcbmOnModemResetWhenDomainSelectionEnabled() throws Exception { DomainSelectionResolver dsResolver = Mockito.mock(DomainSelectionResolver.class); doReturn(true).when(dsResolver).isDomainSelectionSupported(); DomainSelectionResolver.setDomainSelectionResolver(dsResolver); EmergencyStateTracker est = Mockito.mock(EmergencyStateTracker.class); doReturn(true).when(est).isInEcm(); replaceInstance(EmergencyStateTracker.class, "INSTANCE", null, est); GsmCdmaPhone spyPhone = spy(mPhoneUT); doReturn(true).when(spyPhone).isInEcm(); mPhoneUT.handleMessage(mPhoneUT.obtainMessage(GsmCdmaPhone.EVENT_MODEM_RESET)); verify(est).exitEmergencyCallbackMode(); } @Test public void testGetUserHandle() { UserHandle userHandle = new UserHandle(123); doReturn(userHandle).when(mSubscriptionManager).getSubscriptionUserHandle(anyInt()); assertEquals(userHandle, mPhoneUT.getUserHandle()); doReturn(null).when(mSubscriptionManager).getSubscriptionUserHandle(anyInt()); assertNull(mPhoneUT.getUserHandle()); doThrow(IllegalArgumentException.class).when(mSubscriptionManager) .getSubscriptionUserHandle(anyInt()); assertNull(mPhoneUT.getUserHandle()); } @Test public void testResetNetworkSelectionModeOnSimSwap() { // Set current network selection manual mode. Loading tests/telephonytests/src/com/android/internal/telephony/SmsDispatchersControllerTest.java +1 −65 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.internal.telephony; import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE; import static com.android.internal.telephony.SmsDispatchersController.PendingRequest; import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; Loading @@ -32,7 +32,6 @@ import static org.mockito.Matchers.isNull; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; Loading Loading @@ -241,11 +240,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { switchImsSmsFormat(PhoneConstants.PHONE_TYPE_GSM); assertEquals(SmsConstants.FORMAT_3GPP, mSmsDispatchersController.getImsSmsFormat()); assertTrue(mSmsDispatchersController.isIms()); //Mock ImsNetWorkStateChange with Cdma Phone type switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA); assertEquals(SmsConstants.FORMAT_3GPP2, mSmsDispatchersController.getImsSmsFormat()); assertTrue(mSmsDispatchersController.isIms()); } @Test @SmallTest Loading Loading @@ -291,30 +285,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { anyInt(), anyInt(), any(Message.class)); } @Test @SmallTest @FlakyTest /* flakes 0.73% of the time on gce, 0.57% on marlin */ public void testSendImsCdmaTest() throws Exception { switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA); mSmsDispatchersController.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG, null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L); verify(mSimulatedCommandsVerifier).sendImsCdmaSms((byte[])any(), eq(0), eq(0), any(Message.class)); } @Test @SmallTest @FlakyTest /* flakes 0.71% of the time on marlin, 0.61% on gce */ public void testSendRetrySmsCdmaTest() throws Exception { // newFormat will be based on voice technology ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClass(byte[].class); switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA); replaceInstance(SMSDispatcher.SmsTracker.class, "mFormat", mTracker, SmsConstants.FORMAT_3GPP2); doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); mSmsDispatchersController.sendRetrySms(mTracker); verify(mSimulatedCommandsVerifier).sendImsCdmaSms(captor.capture(), eq(0), eq(0), any(Message.class)); assertEquals(1, captor.getAllValues().size()); assertNull(captor.getAllValues().get(0)); } @Test @SmallTest @FlakyTest /* flakes 0.85% of the time on gce, 0.43% on marlin */ public void testSendRetrySmsGsmTest() throws Exception { // newFormat will be based on voice technology will be GSM if phone type is not CDMA Loading Loading @@ -385,13 +355,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { sendDataWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, false); } @Test @SmallTest public void testSendDataWhenDomainCsAndCdma() throws Exception { when(mPhone.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_CDMA); sendDataWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, true); } @Test @SmallTest public void testSendDataWhenDomainCsAndGsm() throws Exception { Loading @@ -405,13 +368,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { sendTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, false); } @Test @SmallTest public void testSendTextWhenDomainCsAndCdma() throws Exception { when(mPhone.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_CDMA); sendTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, true); } @Test @SmallTest public void testSendTextWhenDomainCsAndGsm() throws Exception { Loading @@ -425,13 +381,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { sendMultipartTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, false); } @Test @SmallTest public void testSendMultipartTextWhenDomainCsAndCdma() throws Exception { when(mPhone.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_CDMA); sendMultipartTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, true); } @Test @SmallTest public void testSendMultipartTextWhenDomainCsAndGsm() throws Exception { Loading @@ -446,13 +395,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { PhoneConstants.PHONE_TYPE_GSM, SmsConstants.FORMAT_3GPP); } @Test @SmallTest public void testSendRetrySmsWhenDomainCsAndCdma() throws Exception { sendRetrySmsWithDomainSelection(NetworkRegistrationInfo.DOMAIN_CS, PhoneConstants.PHONE_TYPE_CDMA, SmsConstants.FORMAT_3GPP2); } @Test @SmallTest public void testSendRetrySmsWhenDomainCsAndGsm() throws Exception { Loading @@ -460,12 +402,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { PhoneConstants.PHONE_TYPE_GSM, SmsConstants.FORMAT_3GPP); } @Test @SmallTest public void testSendRetrySmsWhenImsAlreadyUsedAndCdma() throws Exception { sendRetrySmsWhenImsAlreadyUsed(PhoneConstants.PHONE_TYPE_CDMA, SmsConstants.FORMAT_3GPP2); } @Test @SmallTest public void testSendRetrySmsWhenImsAlreadyUsedAndGsm() throws Exception { Loading tests/telephonytests/src/com/android/internal/telephony/SmsNumberUtilsTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.database.Cursor; import android.database.MatrixCursor; import android.net.Uri; import android.telephony.CarrierConfigManager; import android.telephony.TelephonyManager; import android.test.mock.MockContentProvider; import android.test.mock.MockContentResolver; Loading Loading @@ -142,15 +141,6 @@ public class SmsNumberUtilsTest extends TelephonyTest { assertEquals("123", SmsNumberUtils.filterDestAddr(mContext, mPhone.getSubId(), "123")); } @Test @SmallTest public void testNaPcCountryCodeAreaLocalNumberConversion() { // NP_NANP_NBPCD_CC_AREA_LOCAL tests doReturn(TelephonyManager.PHONE_TYPE_CDMA).when(mTelephonyManager).getPhoneType(); assertEquals("18583420022", SmsNumberUtils.filterDestAddr(mContext, mPhone.getSubId(), "+1-858-342-0022")); } @Test @SmallTest public void testPcCountryCodeAreaLocalNumberConversion() { Loading tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java +2 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaConnectionTest.java +0 −61 Original line number Diff line number Diff line Loading @@ -89,11 +89,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { @Test @SmallTest public void testOriginalDialString(){ doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, "+8610000", mCT, null, new DialArgs.Builder().build()); assertEquals("+8610000", connection.getOrigDialString()); doReturn(PhoneConstants.PHONE_TYPE_GSM).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, "+8610000", mCT, null, new DialArgs.Builder().build()); Loading @@ -117,24 +112,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { assertEquals("+1 (700).555-41NN,1234", connection.getOrigDialString()); } @Test @SmallTest public void testSanityCDMA() { doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, String.format( "+1 (700).555-41NN%c1234", PhoneNumberUtils.PAUSE), mCT, null, new DialArgs.Builder().build()); logd("Testing initial state of GsmCdmaConnection"); assertEquals(GsmCdmaCall.State.IDLE, connection.getState()); assertEquals(Connection.PostDialState.NOT_STARTED, connection.getPostDialState()); assertEquals(DisconnectCause.NOT_DISCONNECTED, DisconnectCause.NOT_DISCONNECTED); assertEquals(0, connection.getDisconnectTime()); assertEquals(0, connection.getHoldDurationMillis()); assertEquals(PhoneConstants.PRESENTATION_ALLOWED, connection.getNumberPresentation()); assertFalse(connection.isMultiparty()); assertNotNull(connection.getRemainingPostDialString()); assertEquals("+1 (700).555-41NN,1234", connection.getOrigDialString()); } @Test @SmallTest public void testConnectionStateUpdate() { connection = new GsmCdmaConnection(mPhone, String.format( Loading @@ -154,25 +131,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { assertTrue(connection.getHoldDurationMillis() >= 50); } @Test @MediumTest public void testCDMAPostDialPause() { doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, String.format( "+1 (700).555-41NN%c1234", PhoneNumberUtils.PAUSE), mCT, null, new DialArgs.Builder().build()); logd("Mock connection state from alerting to active "); mDC.state = DriverCall.State.ALERTING; connection.update(mDC); mDC.state = DriverCall.State.ACTIVE; connection.update(mDC); logd("process post dail sequence with pause"); assertEquals(Connection.PostDialState.PAUSE, connection.getPostDialState()); /* pause for 2000 ms */ moveTimeForward(GsmCdmaConnection.PAUSE_DELAY_MILLIS_CDMA); processAllMessages(); assertEquals(Connection.PostDialState.COMPLETE, connection.getPostDialState()); } @Test @MediumTest public void testGSMPostDialPause() { connection = new GsmCdmaConnection(mPhone, String.format( Loading @@ -191,25 +149,6 @@ public class GsmCdmaConnectionTest extends TelephonyTest { assertEquals(Connection.PostDialState.COMPLETE, connection.getPostDialState()); } @Test @SmallTest public void testPostDialWait() { doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); connection = new GsmCdmaConnection(mPhone, String.format("+1 (700).555-41NN%c1234", PhoneNumberUtils.WAIT),mCT,null, new DialArgs.Builder().build()); logd("Mock connection state transition from alerting to active "); mDC.state = DriverCall.State.ALERTING; connection.update(mDC); mDC.state = DriverCall.State.ACTIVE; connection.update(mDC); logd("Process the post dial sequence with wait "); assertEquals(Connection.PostDialState.WAIT, connection.getPostDialState()); connection.proceedAfterWaitChar(); processAllMessages(); assertEquals(Connection.PostDialState.COMPLETE, connection.getPostDialState()); } @Test @SmallTest public void testHangUpConnection() { connection = new GsmCdmaConnection(mPhone, String.format( Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +0 −303 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; Loading @@ -64,7 +63,6 @@ import android.os.Handler; import android.os.Message; import android.os.PersistableBundle; import android.os.Process; import android.os.UserHandle; import android.os.UserManager; import android.os.WorkSource; import android.preference.PreferenceManager; Loading Loading @@ -107,7 +105,6 @@ import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.IccCardStatus; import com.android.internal.telephony.uicc.IccConstants; import com.android.internal.telephony.uicc.IccRecords; import com.android.internal.telephony.uicc.IccVmNotSupportedException; import com.android.internal.telephony.uicc.UiccController; import com.android.internal.telephony.uicc.UiccPort; import com.android.internal.telephony.uicc.UiccProfile; Loading @@ -119,7 +116,6 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; Loading Loading @@ -159,14 +155,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(PhoneConstants.PHONE_TYPE_GSM, mPhoneUT.getPhoneType()); } private void switchToCdma() { mSimulatedCommands.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_IS95A); mPhoneUT.sendMessage(mPhoneUT.obtainMessage(GsmCdmaPhone.EVENT_VOICE_RADIO_TECH_CHANGED, new AsyncResult(null, new int[]{ServiceState.RIL_RADIO_TECHNOLOGY_IS95A}, null))); processAllMessages(); assertEquals(PhoneConstants.PHONE_TYPE_CDMA, mPhoneUT.getPhoneType()); } @Before public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); Loading Loading @@ -209,14 +197,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { super.tearDown(); } @Test @SmallTest public void testPhoneTypeSwitch() { assertTrue(mPhoneUT.isPhoneTypeGsm()); switchToCdma(); assertTrue(mPhoneUT.isPhoneTypeCdmaLte()); } @Test @SmallTest public void testGetServiceState() { Loading Loading @@ -447,9 +427,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { doReturn(cellLocation).when(mSST).getCellIdentity(); assertEquals(cellLocation, mPhoneUT.getCurrentCellIdentity()); // Switch to CDMA switchToCdma(); CellIdentityCdma cdmaCellLocation = new CellIdentityCdma(); doReturn(cdmaCellLocation).when(mSST).getCellIdentity(); Loading @@ -459,50 +436,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(actualCellLocation, cdmaCellLocation); } @Test @SmallTest public void testGetPhoneType() { assertEquals(PhoneConstants.PHONE_TYPE_GSM, mPhoneUT.getPhoneType()); // Switch to CDMA switchToCdma(); assertEquals(PhoneConstants.PHONE_TYPE_CDMA, mPhoneUT.getPhoneType()); } @Test @SmallTest public void testHandleInCallMmiCommands() { try { // Switch to CDMA switchToCdma(); assertFalse(mPhoneUT.handleInCallMmiCommands("0")); // Switch to GSM switchToGsm(); mCT.mForegroundCall = mGsmCdmaCall; mCT.mBackgroundCall = mGsmCdmaCall; mCT.mRingingCall = mGsmCdmaCall; doReturn(GsmCdmaCall.State.IDLE).when(mGsmCdmaCall).getState(); // !isInCall assertFalse(mPhoneUT.handleInCallMmiCommands("0")); // isInCall doReturn(GsmCdmaCall.State.ACTIVE).when(mGsmCdmaCall).getState(); assertTrue(mPhoneUT.handleInCallMmiCommands("0")); // empty dialString assertFalse(mPhoneUT.handleInCallMmiCommands("")); assertFalse(mPhoneUT.handleInCallMmiCommands(null)); } catch (Exception e) { fail(e.toString()); } } @Test @SmallTest public void testDial() throws Exception { Loading Loading @@ -763,37 +696,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertTrue(mPhoneUT.isInEmergencySmsMode()); } @Test @SmallTest public void testSendBurstDtmf() { //Should do nothing for GSM mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); switchToCdma(); //invalid character mPhoneUT.sendBurstDtmf("12345a67890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); //state IDLE mCT.mState = PhoneConstants.State.IDLE; mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); //state RINGING mCT.mState = PhoneConstants.State.RINGING; mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier, times(0)).sendBurstDtmf(nullable(String.class), anyInt(), anyInt(), nullable(Message.class)); mCT.mState = PhoneConstants.State.OFFHOOK; mPhoneUT.sendBurstDtmf("1234567890", 0, 0, null); verify(mSimulatedCommandsVerifier).sendBurstDtmf("1234567890", 0, 0, null); } @Test @SmallTest public void testVoiceMailNumberGsm() { Loading Loading @@ -855,90 +757,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); } @Test @SmallTest public void testVoiceMailNumberCdma() { switchToCdma(); String voiceMailNumber = "1234567890"; // config_telephony_use_own_number_for_voicemail mContextFixture.getCarrierConfigBundle() .putBoolean(CarrierConfigManager .KEY_CONFIG_TELEPHONY_USE_OWN_NUMBER_FOR_VOICEMAIL_BOOL, true); doReturn(voiceMailNumber).when(mSST).getMdnNumber(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from config voiceMailNumber = "1234567891"; mContextFixture.getCarrierConfigBundle(). putString(CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_STRING, voiceMailNumber); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from config for roaming network String voiceMailNumberForRoaming = "1234567892"; mContextFixture.getCarrierConfigBundle() .putString(CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_ROAMING_STRING, voiceMailNumberForRoaming); // voicemail number from config for roaming network and ims unregistered String voiceMailNumberForImsRoamingAndUnregistered = "1234567893"; mContextFixture.getCarrierConfigBundle().putString( CarrierConfigManager.KEY_DEFAULT_VM_NUMBER_ROAMING_AND_IMS_UNREGISTERED_STRING, voiceMailNumberForImsRoamingAndUnregistered); //Verify voicemail number for home doReturn(false).when(mSST.mSS).getRoaming(); doReturn(true).when(mSST).isImsRegistered(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); //Move to ims condition, verify voicemail number for ims unregistered doReturn(false).when(mSST).isImsRegistered(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); //Move to roaming condition, verify voicemail number for roaming doReturn(true).when(mSST.mSS).getRoaming(); assertEquals(voiceMailNumberForImsRoamingAndUnregistered, mPhoneUT.getVoiceMailNumber()); //Move to ims condition, verify voicemail number for roaming doReturn(true).when(mSST).isImsRegistered(); assertEquals(voiceMailNumberForRoaming, mPhoneUT.getVoiceMailNumber()); //Move to home condition, verify voicemail number for home doReturn(false).when(mSST.mSS).getRoaming(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from sharedPreference voiceMailNumber = "1234567893"; mPhoneUT.setVoiceMailNumber("alphaTag", voiceMailNumber, null); ArgumentCaptor<Message> messageArgumentCaptor = ArgumentCaptor.forClass(Message.class); InOrder inOrder = inOrder(mSimRecords); inOrder.verify(mSimRecords).setVoiceMailNumber(eq("alphaTag"), eq(voiceMailNumber), messageArgumentCaptor.capture()); // SIM does not support voicemail number (IccVmNotSupportedException) so should be saved in // shared pref Message msg = messageArgumentCaptor.getValue(); AsyncResult.forMessage(msg).exception = new IccVmNotSupportedException("setVoiceMailNumber not implemented"); msg.sendToTarget(); processAllMessages(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); // voicemail number from SIM voiceMailNumber = "1234567894"; mPhoneUT.setVoiceMailNumber("alphaTag", voiceMailNumber, null); messageArgumentCaptor = ArgumentCaptor.forClass(Message.class); inOrder.verify(mSimRecords).setVoiceMailNumber(eq("alphaTag"), eq(voiceMailNumber), messageArgumentCaptor.capture()); // successfully saved on SIM msg = messageArgumentCaptor.getValue(); AsyncResult.forMessage(msg); msg.sendToTarget(); processAllMessages(); doReturn(voiceMailNumber).when(mSimRecords).getVoiceMailNumber(); assertEquals(voiceMailNumber, mPhoneUT.getVoiceMailNumber()); } @FlakyTest @Test @Ignore Loading Loading @@ -1044,60 +862,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { verify(mSimRecords).setVoiceCallForwardingFlag(anyInt(), anyBoolean(), eq(cfNumber)); } /** * GsmCdmaPhone handles a lot of messages. This function verifies behavior for messages that are * received when obj is created and that are received on phone type switch */ @FlakyTest @Ignore @Test @SmallTest public void testHandleInitialMessages() { // EVENT_RADIO_AVAILABLE verify(mSimulatedCommandsVerifier).getBasebandVersion(nullable(Message.class)); verify(mSimulatedCommandsVerifier).getDeviceIdentity(nullable(Message.class)); verify(mSimulatedCommandsVerifier).getRadioCapability(nullable(Message.class)); // EVENT_RADIO_ON verify(mSimulatedCommandsVerifier).getVoiceRadioTechnology(nullable(Message.class)); verify(mSimulatedCommandsVerifier).setPreferredNetworkType( eq(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA), nullable(Message.class)); // verify responses for above requests: // baseband version verify(mTelephonyManager).setBasebandVersionForPhone(eq(mPhoneUT.getPhoneId()), nullable(String.class)); // IMEI assertEquals(FAKE_IMEI, mPhoneUT.getImei()); // IMEISV assertEquals(SimulatedCommands.FAKE_IMEISV, mPhoneUT.getDeviceSvn()); // radio capability verify(mSimulatedCommandsVerifier).getNetworkSelectionMode(nullable(Message.class)); switchToCdma(); // this leads to eventRadioAvailable handling on cdma // EVENT_RADIO_AVAILABLE verify(mSimulatedCommandsVerifier, times(2)).getBasebandVersion(nullable(Message.class)); verify(mSimulatedCommandsVerifier, times(2)).getDeviceIdentity(nullable(Message.class)); // EVENT_RADIO_ON verify(mSimulatedCommandsVerifier, times(2)).getVoiceRadioTechnology( nullable(Message.class)); // once on radio on, and once on get baseband version verify(mSimulatedCommandsVerifier, times(3)).setPreferredNetworkType( eq(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA), nullable(Message.class)); // verify responses for above requests: // baseband version verify(mTelephonyManager, times(2)).setBasebandVersionForPhone(eq(mPhoneUT.getPhoneId()), nullable(String.class)); // device identity assertEquals(FAKE_IMEI, mPhoneUT.getImei()); assertEquals(SimulatedCommands.FAKE_IMEISV, mPhoneUT.getDeviceSvn()); assertEquals(SimulatedCommands.FAKE_ESN, mPhoneUT.getEsn()); assertEquals(SimulatedCommands.FAKE_MEID, mPhoneUT.getMeid()); } @Test public void testZeroMeid() { doReturn(false).when(mSST).isDeviceShuttingDown(); Loading Loading @@ -1309,22 +1073,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(msisdn, mPhoneUT.getLine1Number()); } @Test @SmallTest public void testGetLine1NumberForCdmaPhone() { final String mdn = "1234567890"; final String msisdn = "+1234567890"; doReturn(mdn).when(mSST).getMdnNumber(); doReturn(msisdn).when(mSimRecords).getMsisdnNumber(); switchToCdma(); assertEquals(mdn, mPhoneUT.getLine1Number()); mContextFixture.getCarrierConfigBundle().putBoolean( CarrierConfigManager.KEY_USE_USIM_BOOL, true); assertEquals(msisdn, mPhoneUT.getLine1Number()); } @Test @SmallTest public void testEnableUiccApplications() throws Exception { Loading Loading @@ -2781,57 +2529,6 @@ public class GsmCdmaPhoneTest extends TelephonyTest { verify(est).exitEmergencyCallbackMode(); } @Test @SmallTest public void testEcbmOnModemResetForNonGsmPhone() throws Exception { switchToCdma(); assertFalse(mPhoneUT.isInEcm()); mPhoneUT.handleMessage(mPhoneUT.obtainMessage( GsmCdmaPhone.EVENT_EMERGENCY_CALLBACK_MODE_ENTER)); assertTrue(mPhoneUT.isInEcm()); Message m = mPhoneUT.obtainMessage(GsmCdmaPhone.EVENT_MODEM_RESET); AsyncResult.forMessage(m); mPhoneUT.handleMessage(m); assertFalse(mPhoneUT.isInEcm()); verifyEcbmIntentWasSent(2 /*times*/, false /*inEcm*/); } @Test @SmallTest public void testEcbmOnModemResetWhenDomainSelectionEnabled() throws Exception { DomainSelectionResolver dsResolver = Mockito.mock(DomainSelectionResolver.class); doReturn(true).when(dsResolver).isDomainSelectionSupported(); DomainSelectionResolver.setDomainSelectionResolver(dsResolver); EmergencyStateTracker est = Mockito.mock(EmergencyStateTracker.class); doReturn(true).when(est).isInEcm(); replaceInstance(EmergencyStateTracker.class, "INSTANCE", null, est); GsmCdmaPhone spyPhone = spy(mPhoneUT); doReturn(true).when(spyPhone).isInEcm(); mPhoneUT.handleMessage(mPhoneUT.obtainMessage(GsmCdmaPhone.EVENT_MODEM_RESET)); verify(est).exitEmergencyCallbackMode(); } @Test public void testGetUserHandle() { UserHandle userHandle = new UserHandle(123); doReturn(userHandle).when(mSubscriptionManager).getSubscriptionUserHandle(anyInt()); assertEquals(userHandle, mPhoneUT.getUserHandle()); doReturn(null).when(mSubscriptionManager).getSubscriptionUserHandle(anyInt()); assertNull(mPhoneUT.getUserHandle()); doThrow(IllegalArgumentException.class).when(mSubscriptionManager) .getSubscriptionUserHandle(anyInt()); assertNull(mPhoneUT.getUserHandle()); } @Test public void testResetNetworkSelectionModeOnSimSwap() { // Set current network selection manual mode. Loading
tests/telephonytests/src/com/android/internal/telephony/SmsDispatchersControllerTest.java +1 −65 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.internal.telephony; import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE; import static com.android.internal.telephony.SmsDispatchersController.PendingRequest; import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; Loading @@ -32,7 +32,6 @@ import static org.mockito.Matchers.isNull; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; Loading Loading @@ -241,11 +240,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { switchImsSmsFormat(PhoneConstants.PHONE_TYPE_GSM); assertEquals(SmsConstants.FORMAT_3GPP, mSmsDispatchersController.getImsSmsFormat()); assertTrue(mSmsDispatchersController.isIms()); //Mock ImsNetWorkStateChange with Cdma Phone type switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA); assertEquals(SmsConstants.FORMAT_3GPP2, mSmsDispatchersController.getImsSmsFormat()); assertTrue(mSmsDispatchersController.isIms()); } @Test @SmallTest Loading Loading @@ -291,30 +285,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { anyInt(), anyInt(), any(Message.class)); } @Test @SmallTest @FlakyTest /* flakes 0.73% of the time on gce, 0.57% on marlin */ public void testSendImsCdmaTest() throws Exception { switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA); mSmsDispatchersController.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG, null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L); verify(mSimulatedCommandsVerifier).sendImsCdmaSms((byte[])any(), eq(0), eq(0), any(Message.class)); } @Test @SmallTest @FlakyTest /* flakes 0.71% of the time on marlin, 0.61% on gce */ public void testSendRetrySmsCdmaTest() throws Exception { // newFormat will be based on voice technology ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClass(byte[].class); switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA); replaceInstance(SMSDispatcher.SmsTracker.class, "mFormat", mTracker, SmsConstants.FORMAT_3GPP2); doReturn(PhoneConstants.PHONE_TYPE_CDMA).when(mPhone).getPhoneType(); mSmsDispatchersController.sendRetrySms(mTracker); verify(mSimulatedCommandsVerifier).sendImsCdmaSms(captor.capture(), eq(0), eq(0), any(Message.class)); assertEquals(1, captor.getAllValues().size()); assertNull(captor.getAllValues().get(0)); } @Test @SmallTest @FlakyTest /* flakes 0.85% of the time on gce, 0.43% on marlin */ public void testSendRetrySmsGsmTest() throws Exception { // newFormat will be based on voice technology will be GSM if phone type is not CDMA Loading Loading @@ -385,13 +355,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { sendDataWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, false); } @Test @SmallTest public void testSendDataWhenDomainCsAndCdma() throws Exception { when(mPhone.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_CDMA); sendDataWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, true); } @Test @SmallTest public void testSendDataWhenDomainCsAndGsm() throws Exception { Loading @@ -405,13 +368,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { sendTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, false); } @Test @SmallTest public void testSendTextWhenDomainCsAndCdma() throws Exception { when(mPhone.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_CDMA); sendTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, true); } @Test @SmallTest public void testSendTextWhenDomainCsAndGsm() throws Exception { Loading @@ -425,13 +381,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { sendMultipartTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, false); } @Test @SmallTest public void testSendMultipartTextWhenDomainCsAndCdma() throws Exception { when(mPhone.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_CDMA); sendMultipartTextWithDomainSelection(NetworkRegistrationInfo.DOMAIN_PS, true); } @Test @SmallTest public void testSendMultipartTextWhenDomainCsAndGsm() throws Exception { Loading @@ -446,13 +395,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { PhoneConstants.PHONE_TYPE_GSM, SmsConstants.FORMAT_3GPP); } @Test @SmallTest public void testSendRetrySmsWhenDomainCsAndCdma() throws Exception { sendRetrySmsWithDomainSelection(NetworkRegistrationInfo.DOMAIN_CS, PhoneConstants.PHONE_TYPE_CDMA, SmsConstants.FORMAT_3GPP2); } @Test @SmallTest public void testSendRetrySmsWhenDomainCsAndGsm() throws Exception { Loading @@ -460,12 +402,6 @@ public class SmsDispatchersControllerTest extends TelephonyTest { PhoneConstants.PHONE_TYPE_GSM, SmsConstants.FORMAT_3GPP); } @Test @SmallTest public void testSendRetrySmsWhenImsAlreadyUsedAndCdma() throws Exception { sendRetrySmsWhenImsAlreadyUsed(PhoneConstants.PHONE_TYPE_CDMA, SmsConstants.FORMAT_3GPP2); } @Test @SmallTest public void testSendRetrySmsWhenImsAlreadyUsedAndGsm() throws Exception { Loading
tests/telephonytests/src/com/android/internal/telephony/SmsNumberUtilsTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.database.Cursor; import android.database.MatrixCursor; import android.net.Uri; import android.telephony.CarrierConfigManager; import android.telephony.TelephonyManager; import android.test.mock.MockContentProvider; import android.test.mock.MockContentResolver; Loading Loading @@ -142,15 +141,6 @@ public class SmsNumberUtilsTest extends TelephonyTest { assertEquals("123", SmsNumberUtils.filterDestAddr(mContext, mPhone.getSubId(), "123")); } @Test @SmallTest public void testNaPcCountryCodeAreaLocalNumberConversion() { // NP_NANP_NBPCD_CC_AREA_LOCAL tests doReturn(TelephonyManager.PHONE_TYPE_CDMA).when(mTelephonyManager).getPhoneType(); assertEquals("18583420022", SmsNumberUtils.filterDestAddr(mContext, mPhone.getSubId(), "+1-858-342-0022")); } @Test @SmallTest public void testPcCountryCodeAreaLocalNumberConversion() { Loading
tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java +2 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes