summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJames.cf Lin <jamescflin@google.com>2021-05-11 15:28:34 +0800
committerJames.cf Lin <jamescflin@google.com>2021-05-11 15:42:57 +0800
commiteafce0a2e02e44fd220eed63aee4e1b44dc87104 (patch)
treeb1d7292e25165ea95798dca3431f3710a7cae075 /tests
parent1a4bab6ab0cdd8dc499e7d8d474f5d5cdf8ae6ab (diff)
downloadplatform_packages_services_Telephony-eafce0a2e02e44fd220eed63aee4e1b44dc87104.tar.gz
platform_packages_services_Telephony-eafce0a2e02e44fd220eed63aee4e1b44dc87104.tar.bz2
platform_packages_services_Telephony-eafce0a2e02e44fd220eed63aee4e1b44dc87104.zip
Fix creating the UceController instance associated with the invalid subscription ID
Bug: 185322224 Test: atest ImsServiceTest RcsUceAdapterTest Change-Id: I6eaf69127a8ebe1115b743ffcb29de6e7b2e9970
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/services/telephony/rcs/UceControllerManagerTest.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/src/com/android/services/telephony/rcs/UceControllerManagerTest.java b/tests/src/com/android/services/telephony/rcs/UceControllerManagerTest.java
index 75ddb962c..8d719fd48 100644
--- a/tests/src/com/android/services/telephony/rcs/UceControllerManagerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/UceControllerManagerTest.java
@@ -17,6 +17,7 @@
package com.android.services.telephony.rcs;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
@@ -108,6 +109,21 @@ public class UceControllerManagerTest extends TelephonyTestBase {
}
@Test
+ public void testSubIdAndCarrierConfigUpdateWithInvalidSubId() throws Exception {
+ UceControllerManager uceCtrlManager = getUceControllerManager();
+
+ // Updates with the same subId should not destroy the UceController
+ uceCtrlManager.onCarrierConfigChanged();
+ verify(mUceController, never()).onDestroy();
+
+ // Updates with invalid subscription ID
+ uceCtrlManager.onAssociatedSubscriptionUpdated(-1);
+
+ verify(mUceController).onDestroy();
+ assertNull(uceCtrlManager.getUceController());
+ }
+
+ @Test
public void testRequestCapabilitiesWithRcsUnavailable() throws Exception {
UceControllerManager uceCtrlManager = getUceControllerManager();
doReturn(true).when(mUceController).isUnavailable();
@@ -242,7 +258,7 @@ public class UceControllerManagerTest extends TelephonyTestBase {
}
private UceControllerManager getUceControllerManager() {
- UceControllerManager manager = new UceControllerManager(mContext, mSlotId, mSubId,
+ UceControllerManager manager = new UceControllerManager(mContext, mSlotId,
mExecutorService, mUceController);
return manager;
}