Loading tests/telephonytests/src/com/android/internal/telephony/CarrierAppUtilsTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -21,7 +21,9 @@ import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.telephony.TelephonyManager; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; Loading @@ -45,6 +47,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** No apps configured - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_EmptyList() { CarrierAppUtils.disableCarrierAppsUntilPrivileged(CALLING_PACKAGE, mPackageManager, mTelephonyManager, USER_ID, new String[0]); Loading @@ -52,6 +55,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app is missing - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_MissingApp() throws Exception { Mockito.when(mPackageManager.getApplicationInfo("com.example.missing.app", PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS, USER_ID)).thenReturn(null); Loading @@ -67,6 +71,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app is not bundled with the system - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NonSystemApp() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Mockito.when(mPackageManager.getApplicationInfo(CARRIER_APP, Loading @@ -86,6 +91,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { * Configured app has privileges, but was disabled by the user - should only grant * permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_DisabledUser() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Loading @@ -106,6 +112,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, but was disabled - should only grant permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_Disabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -125,6 +132,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, and is already enabled - should only grant permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_Enabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -144,6 +152,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured /data app has privileges - should only grant permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_UpdatedApp() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -163,6 +172,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, and is in the default state - should enable. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_Default() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -182,6 +192,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, and is disabled until used - should enable. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_DisabledUntilUsed() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Loading @@ -202,6 +213,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and was disabled by the user - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUser() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -222,6 +234,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and was disabled - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_Disabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -242,6 +255,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and is explicitly enabled - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_Enabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -262,6 +276,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured /data app has no privileges - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_UpdatedApp() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -282,6 +297,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and is in the default state - should disable until use. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_Default() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -302,6 +318,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and is disabled until used - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUntilUsed() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ public class GsmCdmaCallTest { mCallUnderTest = null; } @SmallTest @Test @SmallTest public void testAttachDetach() { //verify mConnections has 0 connections and is in IDLE state assertEquals(0, mCallUnderTest.mConnections.size()); Loading @@ -72,7 +72,7 @@ public class GsmCdmaCallTest { assertEquals(Call.State.IDLE, mCallUnderTest.getState()); } @SmallTest @Test @SmallTest public void testMultiparty() { //verify mConnections has 0 connections and is in IDLE state assertEquals(0, mCallUnderTest.mConnections.size()); Loading @@ -95,7 +95,7 @@ public class GsmCdmaCallTest { assertEquals(true, mCallUnderTest.isMultiparty()); } @SmallTest @Test @SmallTest public void testHangup() { //verify hangup calls mCallTracker.hangup try { Loading tests/telephonytests/src/com/android/internal/telephony/IntRangeManagerTest.java +28 −1 Original line number Diff line number Diff line Loading @@ -17,9 +17,12 @@ package com.android.internal.telephony; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import org.junit.Test; import java.util.ArrayList; /** Loading Loading @@ -95,6 +98,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } } @Test @SmallTest public void testEmptyRangeManager() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("expecting empty configlist", 0, testManager.mConfigList.size()); Loading @@ -109,6 +113,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("selected", selected, info.isSelected()); } @Test @SmallTest public void testAddSingleChannel() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading @@ -125,6 +130,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testRemoveSingleChannel() { TestIntRangeManager testManager = new TestIntRangeManager(); assertTrue("enabling range", testManager.enableRange(123, 123, "client1")); Loading @@ -142,6 +148,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testRemoveBadChannel() { TestIntRangeManager testManager = new TestIntRangeManager(); assertFalse("disabling missing range", testManager.disableRange(123, 123, "client1")); Loading @@ -149,6 +156,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddTwoChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading @@ -173,6 +181,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testOverlappingChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -211,6 +220,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testOverlappingChannels2() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -245,6 +255,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } // new [3, 6] existing [1, 2] [5, 7] @Test @SmallTest public void testOverlappingChannels3() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -285,6 +296,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } @Test @SmallTest public void testMultipleOverlappingChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -431,6 +443,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddSingleDigitChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -503,6 +516,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddSingleDigitChannels2() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading @@ -525,6 +539,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddSingleDigitChannels3() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -560,6 +575,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddSingleDigitChannels4() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -598,6 +614,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddSingleDigitChannels5() { TestIntRangeManager testManager = new TestIntRangeManager(); for (int i = 0; i <= 10; i++) { Loading Loading @@ -647,6 +664,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } // new [1, 5] existing [1, 2] [1, 4] [1, 7] [2, 5] @Test @SmallTest public void testClientInsert() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -691,6 +709,7 @@ public class IntRangeManagerTest extends AndroidTestCase { testManager.reset(); } @Test @SmallTest public void testAddTwoSameChannelsDifferentClient() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -723,6 +742,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddTwoSameChannelsSameClient() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -761,6 +781,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddTwoChannels2() { // test non contiguous case where 2nd range precedes 2nd range TestIntRangeManager testManager = new TestIntRangeManager(); Loading @@ -787,6 +808,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } // new [2, 10] existing [1, 4] [7, 15] @Test @SmallTest public void testAddThreeChannels() { // 3rd range can include first two ranges. Test combine case. TestIntRangeManager testManager = new TestIntRangeManager(); Loading Loading @@ -835,6 +857,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddThreeChannels2() { // 3rd range can include first two ranges. Test combine case. TestIntRangeManager testManager = new TestIntRangeManager(); Loading Loading @@ -884,6 +907,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } @Test @SmallTest public void testAddChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -931,6 +955,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddChannels2() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -975,7 +1000,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddChannels3() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -1011,6 +1036,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddChannels4() { // new [2, 10] existing [1, 4] [6, 6] [8, 9] [12, 14] TestIntRangeManager testManager = new TestIntRangeManager(); Loading Loading @@ -1091,6 +1117,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddChannels5() { // range already enclosed in existing: new [3, 3], [1,3] TestIntRangeManager testManager = new TestIntRangeManager(); Loading tests/telephonytests/src/com/android/internal/telephony/PhoneNumberWatcherTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -17,12 +17,16 @@ package com.android.internal.telephony; import android.telephony.PhoneNumberFormattingTextWatcher; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.text.Editable; import android.text.Selection; import android.text.SpannableStringBuilder; import android.text.TextWatcher; import org.junit.Test; public class PhoneNumberWatcherTest extends AndroidTestCase { @Test @SmallTest public void testAppendChars() { final String multiChars = "65012345"; final String formatted1 = "(650) 123-45"; Loading @@ -49,6 +53,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(formatted2.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest public void testRemoveLastChars() { final String init = "65012345678"; final String result1 = "(650) 123-4567"; Loading @@ -74,6 +79,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(result2.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest public void testInsertChars() { final String init = "650-23"; final String expected1 = "650-123"; Loading Loading @@ -102,6 +108,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(12, Selection.getSelectionEnd(number)); } @Test @SmallTest public void testStopFormatting() { final String init = "(650) 123"; final String expected1 = "(650) 123 4"; Loading Loading @@ -145,6 +152,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(9, Selection.getSelectionEnd(number)); } @Test @SmallTest public void testRestartFormatting() { final String init = "(650) 123"; final String expected1 = "(650) 123 4"; Loading Loading @@ -180,6 +188,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(expected2.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest public void testTextChangedByOtherTextWatcher() { final TextWatcher cleanupTextWatcher = new TextWatcher() { @Override Loading Loading @@ -214,6 +223,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithFormattedNumber() { String init = "650-1"; String expected = "+1-650-123-4567"; // Different formatting than ours Loading @@ -223,6 +233,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithFormattedNameAndNumber() { String init = "650-1"; String expected = "Test User <650-123-4567>"; Loading @@ -232,6 +243,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithNumericNameAndNumber() { String init = "650"; String expected = "2nd Test User <650-123-4567>"; Loading @@ -241,6 +253,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithUnformattedNumber() { String init = "650-1"; String expected = "6501234567"; Loading @@ -252,6 +265,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { * the deleted text doesn't have any formatting and neither does the replacement text: in this * case the replacement text should be formatted by the PhoneNumberFormattingTextWatcher. */ @Test @SmallTest public void testAutoCompleteUnformattedWithUnformattedNumber() { String init = "650"; String replacement = "6501234567"; Loading Loading @@ -286,6 +300,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(expected.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest private TextWatcher getTextWatcher() { return new PhoneNumberFormattingTextWatcher("US"); } Loading tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsCbTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.telephony.SmsCbMessage; import android.telephony.cdma.CdmaSmsCbProgramData; import android.test.AndroidTestCase; import android.telephony.Rlog; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.GsmAlphabet; import com.android.internal.telephony.cdma.sms.BearerData; Loading @@ -31,6 +32,8 @@ import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.util.BitwiseOutputStream; import org.junit.Test; import java.util.Arrays; import java.util.List; import java.util.Random; Loading Loading @@ -364,18 +367,22 @@ public class CdmaSmsCbTest extends AndroidTestCase { assertEquals(false, cbMessage.isCmasMessage()); } @Test @SmallTest public void testNonEmergencyBroadcast7bitAscii() throws Exception { doTestNonEmergencyBroadcast(UserData.ENCODING_7BIT_ASCII); } @Test @SmallTest public void testNonEmergencyBroadcast7bitGsm() throws Exception { doTestNonEmergencyBroadcast(UserData.ENCODING_GSM_7BIT_ALPHABET); } @Test @SmallTest public void testNonEmergencyBroadcast16bitUnicode() throws Exception { doTestNonEmergencyBroadcast(UserData.ENCODING_UNICODE_16); } @Test @SmallTest public void testNonEmergencyBroadcastIs91Extended() throws Exception { // IS-91 doesn't support language or priority subparameters, max 14 chars text SmsMessage msg = createBroadcastSmsMessage(987, 654, -1, -1, Loading Loading @@ -416,31 +423,37 @@ public class CdmaSmsCbTest extends AndroidTestCase { assertEquals(SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN, cmasInfo.getCertainty()); } @Test @SmallTest public void testCmasPresidentialAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT, PRES_ALERT); } @Test @SmallTest public void testCmasExtremeAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, SmsCbCmasInfo.CMAS_CLASS_EXTREME_THREAT, EXTREME_ALERT); } @Test @SmallTest public void testCmasSevereAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT, SmsCbCmasInfo.CMAS_CLASS_SEVERE_THREAT, SEVERE_ALERT); } @Test @SmallTest public void testCmasAmberAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY, SmsCbCmasInfo.CMAS_CLASS_CHILD_ABDUCTION_EMERGENCY, AMBER_ALERT); } @Test @SmallTest public void testCmasTestMessage() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE, SmsCbCmasInfo.CMAS_CLASS_REQUIRED_MONTHLY_TEST, MONTHLY_TEST_ALERT); } @Test @SmallTest public void testCmasExtremeAlertType1Elements() throws Exception { SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 5678, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, Loading Loading @@ -469,6 +482,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { // VZW requirement is to discard message with unsupported charset. Verify that we return null // for this unsupported character set. @Test @SmallTest public void testCmasUnsupportedCharSet() throws Exception { SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 12345, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, Loading @@ -480,6 +494,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { // VZW requirement is to discard message with unsupported charset. Verify that we return null // for this unsupported character set. @Test @SmallTest public void testCmasUnsupportedCharSet2() throws Exception { SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 67890, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, Loading @@ -491,6 +506,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { // VZW requirement is to discard message without record type 0. The framework will decode it // and the app will discard it. @Test @SmallTest public void testCmasNoRecordType0() throws Exception { SmsMessage msg = createCmasSmsMessage( SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, 1234, Loading @@ -517,6 +533,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { } // Make sure we don't throw an exception if we feed completely random data to BearerStream. @Test @SmallTest public void testRandomBearerStreamData() { Random r = new Random(54321); for (int run = 0; run < 1000; run++) { Loading @@ -543,6 +560,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { } // Make sure we don't throw an exception if we put random data in the UserData subparam. @Test @SmallTest public void testRandomUserData() { Random r = new Random(94040); for (int run = 0; run < 1000; run++) { Loading Loading @@ -599,6 +617,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { private static final String CAT_SEVERE_THREAT = "Severe Threat to Life and Property"; private static final String CAT_AMBER_ALERTS = "AMBER Alerts"; @Test @SmallTest public void testServiceCategoryProgramDataAddCategory() throws Exception { Parcel p = createServiceCategoryProgramDataParcel(); BitwiseOutputStream bos = createBearerDataStream(123, -1, -1); Loading Loading @@ -640,6 +659,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { assertEquals(CdmaSmsCbProgramData.ALERT_OPTION_DEFAULT_ALERT, programData.getAlertOption()); } @Test @SmallTest public void testServiceCategoryProgramDataDeleteTwoCategories() throws Exception { Parcel p = createServiceCategoryProgramDataParcel(); BitwiseOutputStream bos = createBearerDataStream(456, -1, -1); Loading Loading @@ -721,6 +741,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { }; // Test case for CMAS test message received on the Sprint network. @Test @SmallTest public void testDecodeRawBearerData() throws Exception { Parcel p = createBroadcastParcel(SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE); SmsMessage msg = createMessageFromParcel(p, CMAS_TEST_BEARER_DATA); Loading Loading
tests/telephonytests/src/com/android/internal/telephony/CarrierAppUtilsTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -21,7 +21,9 @@ import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.telephony.TelephonyManager; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; Loading @@ -45,6 +47,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** No apps configured - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_EmptyList() { CarrierAppUtils.disableCarrierAppsUntilPrivileged(CALLING_PACKAGE, mPackageManager, mTelephonyManager, USER_ID, new String[0]); Loading @@ -52,6 +55,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app is missing - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_MissingApp() throws Exception { Mockito.when(mPackageManager.getApplicationInfo("com.example.missing.app", PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS, USER_ID)).thenReturn(null); Loading @@ -67,6 +71,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app is not bundled with the system - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NonSystemApp() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Mockito.when(mPackageManager.getApplicationInfo(CARRIER_APP, Loading @@ -86,6 +91,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { * Configured app has privileges, but was disabled by the user - should only grant * permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_DisabledUser() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Loading @@ -106,6 +112,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, but was disabled - should only grant permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_Disabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -125,6 +132,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, and is already enabled - should only grant permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_Enabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -144,6 +152,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured /data app has privileges - should only grant permissions. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_UpdatedApp() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -163,6 +172,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, and is in the default state - should enable. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_Default() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -182,6 +192,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has privileges, and is disabled until used - should enable. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_HasPrivileges_DisabledUntilUsed() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Loading @@ -202,6 +213,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and was disabled by the user - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUser() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -222,6 +234,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and was disabled - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_Disabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -242,6 +255,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and is explicitly enabled - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_Enabled() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -262,6 +276,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured /data app has no privileges - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_UpdatedApp() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -282,6 +297,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and is in the default state - should disable until use. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_Default() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); appInfo.packageName = CARRIER_APP; Loading @@ -302,6 +318,7 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase { } /** Configured app has no privileges, and is disabled until used - should do nothing. */ @Test @SmallTest public void testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUntilUsed() throws Exception { ApplicationInfo appInfo = new ApplicationInfo(); Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ public class GsmCdmaCallTest { mCallUnderTest = null; } @SmallTest @Test @SmallTest public void testAttachDetach() { //verify mConnections has 0 connections and is in IDLE state assertEquals(0, mCallUnderTest.mConnections.size()); Loading @@ -72,7 +72,7 @@ public class GsmCdmaCallTest { assertEquals(Call.State.IDLE, mCallUnderTest.getState()); } @SmallTest @Test @SmallTest public void testMultiparty() { //verify mConnections has 0 connections and is in IDLE state assertEquals(0, mCallUnderTest.mConnections.size()); Loading @@ -95,7 +95,7 @@ public class GsmCdmaCallTest { assertEquals(true, mCallUnderTest.isMultiparty()); } @SmallTest @Test @SmallTest public void testHangup() { //verify hangup calls mCallTracker.hangup try { Loading
tests/telephonytests/src/com/android/internal/telephony/IntRangeManagerTest.java +28 −1 Original line number Diff line number Diff line Loading @@ -17,9 +17,12 @@ package com.android.internal.telephony; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import org.junit.Test; import java.util.ArrayList; /** Loading Loading @@ -95,6 +98,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } } @Test @SmallTest public void testEmptyRangeManager() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("expecting empty configlist", 0, testManager.mConfigList.size()); Loading @@ -109,6 +113,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("selected", selected, info.isSelected()); } @Test @SmallTest public void testAddSingleChannel() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading @@ -125,6 +130,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testRemoveSingleChannel() { TestIntRangeManager testManager = new TestIntRangeManager(); assertTrue("enabling range", testManager.enableRange(123, 123, "client1")); Loading @@ -142,6 +148,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testRemoveBadChannel() { TestIntRangeManager testManager = new TestIntRangeManager(); assertFalse("disabling missing range", testManager.disableRange(123, 123, "client1")); Loading @@ -149,6 +156,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddTwoChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading @@ -173,6 +181,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testOverlappingChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -211,6 +220,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testOverlappingChannels2() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -245,6 +255,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } // new [3, 6] existing [1, 2] [5, 7] @Test @SmallTest public void testOverlappingChannels3() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -285,6 +296,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } @Test @SmallTest public void testMultipleOverlappingChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -431,6 +443,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddSingleDigitChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -503,6 +516,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddSingleDigitChannels2() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading @@ -525,6 +539,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddSingleDigitChannels3() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -560,6 +575,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddSingleDigitChannels4() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -598,6 +614,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddSingleDigitChannels5() { TestIntRangeManager testManager = new TestIntRangeManager(); for (int i = 0; i <= 10; i++) { Loading Loading @@ -647,6 +664,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } // new [1, 5] existing [1, 2] [1, 4] [1, 7] [2, 5] @Test @SmallTest public void testClientInsert() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -691,6 +709,7 @@ public class IntRangeManagerTest extends AndroidTestCase { testManager.reset(); } @Test @SmallTest public void testAddTwoSameChannelsDifferentClient() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -723,6 +742,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddTwoSameChannelsSameClient() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -761,6 +781,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddTwoChannels2() { // test non contiguous case where 2nd range precedes 2nd range TestIntRangeManager testManager = new TestIntRangeManager(); Loading @@ -787,6 +808,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } // new [2, 10] existing [1, 4] [7, 15] @Test @SmallTest public void testAddThreeChannels() { // 3rd range can include first two ranges. Test combine case. TestIntRangeManager testManager = new TestIntRangeManager(); Loading Loading @@ -835,6 +857,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddThreeChannels2() { // 3rd range can include first two ranges. Test combine case. TestIntRangeManager testManager = new TestIntRangeManager(); Loading Loading @@ -884,6 +907,7 @@ public class IntRangeManagerTest extends AndroidTestCase { } @Test @SmallTest public void testAddChannels() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -931,6 +955,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddChannels2() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -975,7 +1000,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddChannels3() { TestIntRangeManager testManager = new TestIntRangeManager(); assertEquals("flags before test", 0, testManager.flags); Loading Loading @@ -1011,6 +1036,7 @@ public class IntRangeManagerTest extends AndroidTestCase { assertEquals("configlist size", 0, testManager.mConfigList.size()); } @Test @SmallTest public void testAddChannels4() { // new [2, 10] existing [1, 4] [6, 6] [8, 9] [12, 14] TestIntRangeManager testManager = new TestIntRangeManager(); Loading Loading @@ -1091,6 +1117,7 @@ public class IntRangeManagerTest extends AndroidTestCase { SMS_CB_CODE_SCHEME_MAX, true); } @Test @SmallTest public void testAddChannels5() { // range already enclosed in existing: new [3, 3], [1,3] TestIntRangeManager testManager = new TestIntRangeManager(); Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneNumberWatcherTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -17,12 +17,16 @@ package com.android.internal.telephony; import android.telephony.PhoneNumberFormattingTextWatcher; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.text.Editable; import android.text.Selection; import android.text.SpannableStringBuilder; import android.text.TextWatcher; import org.junit.Test; public class PhoneNumberWatcherTest extends AndroidTestCase { @Test @SmallTest public void testAppendChars() { final String multiChars = "65012345"; final String formatted1 = "(650) 123-45"; Loading @@ -49,6 +53,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(formatted2.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest public void testRemoveLastChars() { final String init = "65012345678"; final String result1 = "(650) 123-4567"; Loading @@ -74,6 +79,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(result2.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest public void testInsertChars() { final String init = "650-23"; final String expected1 = "650-123"; Loading Loading @@ -102,6 +108,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(12, Selection.getSelectionEnd(number)); } @Test @SmallTest public void testStopFormatting() { final String init = "(650) 123"; final String expected1 = "(650) 123 4"; Loading Loading @@ -145,6 +152,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(9, Selection.getSelectionEnd(number)); } @Test @SmallTest public void testRestartFormatting() { final String init = "(650) 123"; final String expected1 = "(650) 123 4"; Loading Loading @@ -180,6 +188,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(expected2.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest public void testTextChangedByOtherTextWatcher() { final TextWatcher cleanupTextWatcher = new TextWatcher() { @Override Loading Loading @@ -214,6 +223,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithFormattedNumber() { String init = "650-1"; String expected = "+1-650-123-4567"; // Different formatting than ours Loading @@ -223,6 +233,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithFormattedNameAndNumber() { String init = "650-1"; String expected = "Test User <650-123-4567>"; Loading @@ -232,6 +243,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithNumericNameAndNumber() { String init = "650"; String expected = "2nd Test User <650-123-4567>"; Loading @@ -241,6 +253,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { /** * Test the case where some other component is auto-completing what the user is typing */ @Test @SmallTest public void testAutoCompleteWithUnformattedNumber() { String init = "650-1"; String expected = "6501234567"; Loading @@ -252,6 +265,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { * the deleted text doesn't have any formatting and neither does the replacement text: in this * case the replacement text should be formatted by the PhoneNumberFormattingTextWatcher. */ @Test @SmallTest public void testAutoCompleteUnformattedWithUnformattedNumber() { String init = "650"; String replacement = "6501234567"; Loading Loading @@ -286,6 +300,7 @@ public class PhoneNumberWatcherTest extends AndroidTestCase { assertEquals(expected.length(), Selection.getSelectionEnd(number)); } @Test @SmallTest private TextWatcher getTextWatcher() { return new PhoneNumberFormattingTextWatcher("US"); } Loading
tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsCbTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.telephony.SmsCbMessage; import android.telephony.cdma.CdmaSmsCbProgramData; import android.test.AndroidTestCase; import android.telephony.Rlog; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.GsmAlphabet; import com.android.internal.telephony.cdma.sms.BearerData; Loading @@ -31,6 +32,8 @@ import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.util.BitwiseOutputStream; import org.junit.Test; import java.util.Arrays; import java.util.List; import java.util.Random; Loading Loading @@ -364,18 +367,22 @@ public class CdmaSmsCbTest extends AndroidTestCase { assertEquals(false, cbMessage.isCmasMessage()); } @Test @SmallTest public void testNonEmergencyBroadcast7bitAscii() throws Exception { doTestNonEmergencyBroadcast(UserData.ENCODING_7BIT_ASCII); } @Test @SmallTest public void testNonEmergencyBroadcast7bitGsm() throws Exception { doTestNonEmergencyBroadcast(UserData.ENCODING_GSM_7BIT_ALPHABET); } @Test @SmallTest public void testNonEmergencyBroadcast16bitUnicode() throws Exception { doTestNonEmergencyBroadcast(UserData.ENCODING_UNICODE_16); } @Test @SmallTest public void testNonEmergencyBroadcastIs91Extended() throws Exception { // IS-91 doesn't support language or priority subparameters, max 14 chars text SmsMessage msg = createBroadcastSmsMessage(987, 654, -1, -1, Loading Loading @@ -416,31 +423,37 @@ public class CdmaSmsCbTest extends AndroidTestCase { assertEquals(SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN, cmasInfo.getCertainty()); } @Test @SmallTest public void testCmasPresidentialAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT, PRES_ALERT); } @Test @SmallTest public void testCmasExtremeAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, SmsCbCmasInfo.CMAS_CLASS_EXTREME_THREAT, EXTREME_ALERT); } @Test @SmallTest public void testCmasSevereAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT, SmsCbCmasInfo.CMAS_CLASS_SEVERE_THREAT, SEVERE_ALERT); } @Test @SmallTest public void testCmasAmberAlert() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY, SmsCbCmasInfo.CMAS_CLASS_CHILD_ABDUCTION_EMERGENCY, AMBER_ALERT); } @Test @SmallTest public void testCmasTestMessage() throws Exception { doTestCmasBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE, SmsCbCmasInfo.CMAS_CLASS_REQUIRED_MONTHLY_TEST, MONTHLY_TEST_ALERT); } @Test @SmallTest public void testCmasExtremeAlertType1Elements() throws Exception { SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 5678, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, Loading Loading @@ -469,6 +482,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { // VZW requirement is to discard message with unsupported charset. Verify that we return null // for this unsupported character set. @Test @SmallTest public void testCmasUnsupportedCharSet() throws Exception { SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 12345, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, Loading @@ -480,6 +494,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { // VZW requirement is to discard message with unsupported charset. Verify that we return null // for this unsupported character set. @Test @SmallTest public void testCmasUnsupportedCharSet2() throws Exception { SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 67890, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, Loading @@ -491,6 +506,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { // VZW requirement is to discard message without record type 0. The framework will decode it // and the app will discard it. @Test @SmallTest public void testCmasNoRecordType0() throws Exception { SmsMessage msg = createCmasSmsMessage( SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, 1234, Loading @@ -517,6 +533,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { } // Make sure we don't throw an exception if we feed completely random data to BearerStream. @Test @SmallTest public void testRandomBearerStreamData() { Random r = new Random(54321); for (int run = 0; run < 1000; run++) { Loading @@ -543,6 +560,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { } // Make sure we don't throw an exception if we put random data in the UserData subparam. @Test @SmallTest public void testRandomUserData() { Random r = new Random(94040); for (int run = 0; run < 1000; run++) { Loading Loading @@ -599,6 +617,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { private static final String CAT_SEVERE_THREAT = "Severe Threat to Life and Property"; private static final String CAT_AMBER_ALERTS = "AMBER Alerts"; @Test @SmallTest public void testServiceCategoryProgramDataAddCategory() throws Exception { Parcel p = createServiceCategoryProgramDataParcel(); BitwiseOutputStream bos = createBearerDataStream(123, -1, -1); Loading Loading @@ -640,6 +659,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { assertEquals(CdmaSmsCbProgramData.ALERT_OPTION_DEFAULT_ALERT, programData.getAlertOption()); } @Test @SmallTest public void testServiceCategoryProgramDataDeleteTwoCategories() throws Exception { Parcel p = createServiceCategoryProgramDataParcel(); BitwiseOutputStream bos = createBearerDataStream(456, -1, -1); Loading Loading @@ -721,6 +741,7 @@ public class CdmaSmsCbTest extends AndroidTestCase { }; // Test case for CMAS test message received on the Sprint network. @Test @SmallTest public void testDecodeRawBearerData() throws Exception { Parcel p = createBroadcastParcel(SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE); SmsMessage msg = createMessageFromParcel(p, CMAS_TEST_BEARER_DATA); Loading