use of android.telephony.ims.feature.MmTelFeature.MmTelCapabilities in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method isAvailable_imsRegisteredWifi_voiceAndVideoMmTelCapabilitiesSet_voiceAndVideoOverWifiAvailable.
@Test
public void isAvailable_imsRegisteredWifi_voiceAndVideoMmTelCapabilitiesSet_voiceAndVideoOverWifiAvailable() {
shadowImsMmTelManager.setImsRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN);
MmTelCapabilities voiceAndVideoMmTelCapabilities = new MmTelCapabilities();
voiceAndVideoMmTelCapabilities.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VOICE);
voiceAndVideoMmTelCapabilities.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(voiceAndVideoMmTelCapabilities);
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VIDEO, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isTrue();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VOICE, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isTrue();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_SMS, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_SMS, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VIDEO, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_UT, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_UT, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VOICE, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
}
use of android.telephony.ims.feature.MmTelFeature.MmTelCapabilities in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method registerMmTelCapabilityCallback_imsNotRegistered_availabilityChange_onCapabilitiesStatusChangedNotInvoked.
@Test
public void registerMmTelCapabilityCallback_imsNotRegistered_availabilityChange_onCapabilitiesStatusChangedNotInvoked() throws ImsException {
MmTelCapabilities[] mmTelCapabilities = new MmTelCapabilities[1];
CapabilityCallback capabilityCallback = new CapabilityCallback() {
@Override
public void onCapabilitiesStatusChanged(MmTelCapabilities capabilities) {
super.onCapabilitiesStatusChanged(capabilities);
mmTelCapabilities[0] = capabilities;
}
};
shadowImsMmTelManager.registerMmTelCapabilityCallback(Runnable::run, capabilityCallback);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(new MmTelCapabilities());
assertThat(mmTelCapabilities[0]).isNull();
}
use of android.telephony.ims.feature.MmTelFeature.MmTelCapabilities in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method registerMmTelCapabilityCallback_imsRegistered_availabilityChange_onCapabilitiesStatusChangedInvoked.
@Test
public void registerMmTelCapabilityCallback_imsRegistered_availabilityChange_onCapabilitiesStatusChangedInvoked() throws ImsException {
MmTelCapabilities[] mmTelCapabilities = new MmTelCapabilities[1];
CapabilityCallback capabilityCallback = new CapabilityCallback() {
@Override
public void onCapabilitiesStatusChanged(MmTelCapabilities capabilities) {
super.onCapabilitiesStatusChanged(capabilities);
mmTelCapabilities[0] = capabilities;
}
};
shadowImsMmTelManager.setImsRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
shadowImsMmTelManager.registerMmTelCapabilityCallback(Runnable::run, capabilityCallback);
MmTelCapabilities mmTelCapabilitiesWithCallbackRegistered = new MmTelCapabilities();
mmTelCapabilitiesWithCallbackRegistered.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
mmTelCapabilitiesWithCallbackRegistered.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VOICE);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(mmTelCapabilitiesWithCallbackRegistered);
assertThat(mmTelCapabilities[0]).isNotNull();
assertThat(mmTelCapabilities[0]).isEqualTo(mmTelCapabilitiesWithCallbackRegistered);
shadowImsMmTelManager.unregisterMmTelCapabilityCallback(capabilityCallback);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(new MmTelCapabilities());
assertThat(mmTelCapabilities[0]).isEqualTo(mmTelCapabilitiesWithCallbackRegistered);
}
use of android.telephony.ims.feature.MmTelFeature.MmTelCapabilities in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method isAvailable_imsNotRegistered_voiceAndVideoMmTelCapabilitiesSet_noneAvailable.
@Test
public void isAvailable_imsNotRegistered_voiceAndVideoMmTelCapabilitiesSet_noneAvailable() {
MmTelCapabilities voiceAndVideoMmTelCapabilities = new MmTelCapabilities();
voiceAndVideoMmTelCapabilities.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VOICE);
voiceAndVideoMmTelCapabilities.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(voiceAndVideoMmTelCapabilities);
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_SMS, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_SMS, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VIDEO, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VIDEO, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_UT, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_UT, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VOICE, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)).isFalse();
assertThat(shadowImsMmTelManager.isAvailable(MmTelCapabilities.CAPABILITY_TYPE_VOICE, ImsRegistrationImplBase.REGISTRATION_TECH_LTE)).isFalse();
}
Aggregations