Loading tests/telephonytests/src/android/telephony/ims/ImsMmTelManagerTests.java +8 −5 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class ImsMmTelManagerTests extends TelephonyTest { */ @SmallTest @Test public void testCallbackValues() throws Exception { public void testDeprecatedCallbackValues() throws Exception { LocalCallback cb = new LocalCallback(); ImsMmTelManager managerUT = new ImsMmTelManager(0, mBinderCache); managerUT.registerImsRegistrationCallback(Runnable::run, cb); Loading @@ -80,14 +80,17 @@ public class ImsMmTelManagerTests extends TelephonyTest { IImsRegistrationCallback cbBinder = callbackCaptor.getValue(); // Ensure the transport types are correct cbBinder.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build()); assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, cb.mRegResult); cbBinder.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN).build()); assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WLAN, cb.mRegResult); cbBinder.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_NONE); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_NONE).build()); assertEquals(-1, cb.mRegResult); // Wacky value cbBinder.onRegistered(0xDEADBEEF); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder(0xDEADBEEF).build()); assertEquals(-1, cb.mRegResult); } } tests/telephonytests/src/android/telephony/ims/ImsRegistrationTests.java +24 −10 Original line number Diff line number Diff line Loading @@ -26,13 +26,13 @@ import static org.mockito.Mockito.verify; import android.net.Uri; import android.os.Parcel; import android.os.RemoteException; import android.telephony.ServiceState; import android.telephony.ims.aidl.IImsRegistration; import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.feature.ImsFeature; import android.telephony.ims.stub.ImsFeatureConfiguration; import android.telephony.ims.stub.ImsRegistrationImplBase; import android.test.suitebuilder.annotation.SmallTest; import android.util.ArraySet; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -121,17 +121,24 @@ public class ImsRegistrationTests { @SmallTest @Test public void testRegistrationCallbackOnRegistered() throws RemoteException { mRegistration.onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); verify(mCallback).onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); final ArraySet<String> features = new ArraySet<>(); features.add("feature1"); features.add("feature2"); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).setFeatureTags(features).build(); mRegistration.onRegistered(attr); verify(mCallback).onRegistered(attr); } @SmallTest @Test public void testRegistrationCallbackOnRegistering() throws RemoteException { mRegistration.onRegistering(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build(); mRegistration.onRegistering(ImsRegistrationImplBase.REGISTRATION_TECH_LTE); verify(mCallback).onRegistering(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); verify(mCallback).onRegistering(attr); } @SmallTest Loading Loading @@ -170,19 +177,26 @@ public class ImsRegistrationTests { public void testRegistrationCallbackAfterUnregistered() throws RemoteException { mRegBinder.removeRegistrationCallback(mCallback); mRegistration.onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build(); mRegistration.onRegistered(attr); verify(mCallback, never()).onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); verify(mCallback, never()).onRegistered(attr); } @SmallTest @Test public void testRegistrationCallbackSendCurrentState() throws RemoteException { mRegistration.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE); final ArraySet<String> features = new ArraySet<>(); features.add("feature1"); features.add("feature2"); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).setFeatureTags(features).build(); mRegistration.onRegistered(attr); mRegBinder.addRegistrationCallback(mCallback2); verify(mCallback2).onRegistered(eq(ImsRegistrationImplBase.REGISTRATION_TECH_LTE)); verify(mCallback2).onRegistered(attr); } @SmallTest Loading Loading
tests/telephonytests/src/android/telephony/ims/ImsMmTelManagerTests.java +8 −5 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class ImsMmTelManagerTests extends TelephonyTest { */ @SmallTest @Test public void testCallbackValues() throws Exception { public void testDeprecatedCallbackValues() throws Exception { LocalCallback cb = new LocalCallback(); ImsMmTelManager managerUT = new ImsMmTelManager(0, mBinderCache); managerUT.registerImsRegistrationCallback(Runnable::run, cb); Loading @@ -80,14 +80,17 @@ public class ImsMmTelManagerTests extends TelephonyTest { IImsRegistrationCallback cbBinder = callbackCaptor.getValue(); // Ensure the transport types are correct cbBinder.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build()); assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, cb.mRegResult); cbBinder.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN).build()); assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WLAN, cb.mRegResult); cbBinder.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_NONE); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_NONE).build()); assertEquals(-1, cb.mRegResult); // Wacky value cbBinder.onRegistered(0xDEADBEEF); cbBinder.onRegistered(new ImsRegistrationAttributes.Builder(0xDEADBEEF).build()); assertEquals(-1, cb.mRegResult); } }
tests/telephonytests/src/android/telephony/ims/ImsRegistrationTests.java +24 −10 Original line number Diff line number Diff line Loading @@ -26,13 +26,13 @@ import static org.mockito.Mockito.verify; import android.net.Uri; import android.os.Parcel; import android.os.RemoteException; import android.telephony.ServiceState; import android.telephony.ims.aidl.IImsRegistration; import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.feature.ImsFeature; import android.telephony.ims.stub.ImsFeatureConfiguration; import android.telephony.ims.stub.ImsRegistrationImplBase; import android.test.suitebuilder.annotation.SmallTest; import android.util.ArraySet; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -121,17 +121,24 @@ public class ImsRegistrationTests { @SmallTest @Test public void testRegistrationCallbackOnRegistered() throws RemoteException { mRegistration.onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); verify(mCallback).onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); final ArraySet<String> features = new ArraySet<>(); features.add("feature1"); features.add("feature2"); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).setFeatureTags(features).build(); mRegistration.onRegistered(attr); verify(mCallback).onRegistered(attr); } @SmallTest @Test public void testRegistrationCallbackOnRegistering() throws RemoteException { mRegistration.onRegistering(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build(); mRegistration.onRegistering(ImsRegistrationImplBase.REGISTRATION_TECH_LTE); verify(mCallback).onRegistering(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); verify(mCallback).onRegistering(attr); } @SmallTest Loading Loading @@ -170,19 +177,26 @@ public class ImsRegistrationTests { public void testRegistrationCallbackAfterUnregistered() throws RemoteException { mRegBinder.removeRegistrationCallback(mCallback); mRegistration.onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build(); mRegistration.onRegistered(attr); verify(mCallback, never()).onRegistered(ServiceState.RIL_RADIO_TECHNOLOGY_LTE); verify(mCallback, never()).onRegistered(attr); } @SmallTest @Test public void testRegistrationCallbackSendCurrentState() throws RemoteException { mRegistration.onRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE); final ArraySet<String> features = new ArraySet<>(); features.add("feature1"); features.add("feature2"); ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder( ImsRegistrationImplBase.REGISTRATION_TECH_LTE).setFeatureTags(features).build(); mRegistration.onRegistered(attr); mRegBinder.addRegistrationCallback(mCallback2); verify(mCallback2).onRegistered(eq(ImsRegistrationImplBase.REGISTRATION_TECH_LTE)); verify(mCallback2).onRegistered(attr); } @SmallTest Loading