Add CTS test for exposing NetworkRegistrationInfo for PS service
Bug: 148828132
Test: make and CTS run
Change-Id: I58077afce47581caa547a95862892fe990470e73
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
index 427ede3..a5e75c5 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
@@ -15,17 +15,18 @@
*/
package android.telephony.cts;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-
import android.telephony.AccessNetworkConstants;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.TelephonyManager;
-import java.util.Arrays;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import java.util.Arrays;
+
public class NetworkRegistrationInfoTest {
@Test
@@ -87,6 +88,30 @@
}
@Test
+ public void testGetEmergencyServices() {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setAvailableServices(Arrays.asList(NetworkRegistrationInfo.SERVICE_TYPE_EMERGENCY,
+ NetworkRegistrationInfo.SERVICE_TYPE_VOICE))
+ .build();
+ assertEquals(Arrays.asList(NetworkRegistrationInfo.SERVICE_TYPE_EMERGENCY,
+ NetworkRegistrationInfo.SERVICE_TYPE_VOICE), nri.getAvailableServices());
+ }
+
+ /**
+ * Basic test to ensure {@link NetworkRegistrationInfo#isSearching()} does not throw any
+ * exception.
+ */
+ @Test
+ public void testNetworkRegistrationInfoIsSearching() {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setRegistrationState(
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING)
+ .build();
+ assertTrue(nri.isSearching());
+ }
+
+
+ @Test
public void testGetDomain() {
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
.setDomain(NetworkRegistrationInfo.DOMAIN_CS)