Loading tests/telephonytests/src/android/telephony/SmsMessageTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ public class SmsMessageTest { // should return null instead of SmsMessage with null wrappedMessage assertEquals(null, SmsMessage.createFromPdu(null, SmsConstants.FORMAT_3GPP2)); assertEquals(null, SmsMessage.createFromPdu(null, SmsConstants.FORMAT_3GPP)); assertEquals(null, SmsMessage.createFromPdu(null)); assertEquals(null, SmsMessage.newFromCMT(null)); } } tests/telephonytests/src/com/android/internal/telephony/GsmSmsTest.java +2 −32 Original line number Diff line number Diff line Loading @@ -16,11 +16,8 @@ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import android.telephony.TelephonyManager; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.gsm.SmsMessage; Loading @@ -28,24 +25,9 @@ import com.android.internal.util.HexDump; import java.util.ArrayList; import org.junit.After; import org.junit.Before; import org.junit.Test; public class GsmSmsTest extends TelephonyTest { @Before public void setUp() throws Exception { super.setUp(this.getClass().getSimpleName()); } @After public void tearDown() throws Exception { super.tearDown(); } public class GsmSmsTest extends AndroidTestCase { @SmallTest @Test public void testAddressing() throws Exception { String pdu = "07914151551512f2040B916105551511f100006060605130308A04D4F29C0E"; SmsMessage sms = SmsMessage.createFromPdu(HexDump.hexStringToByteArray(pdu)); Loading @@ -66,7 +48,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testUdh() throws Exception { String pdu = "07914140279510F6440A8111110301003BF56080207130138A8C0B05040B8423F" + "000032A02010106276170706C69636174696F6E2F766E642E7761702E6D6D732D" Loading Loading @@ -105,7 +86,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testUcs2() throws Exception { String pdu = "07912160130300F4040B914151245584F600087010807121352B1021220" + "0A900AE00680065006C006C006F"; Loading @@ -114,7 +94,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testMultipart() throws Exception { /* * Multi-part text SMS with septet data. Loading @@ -139,7 +118,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testCPHSVoiceMail() throws Exception { // "set MWI flag" Loading Loading @@ -173,7 +151,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testCingularVoiceMail() throws Exception { // "set MWI flag" Loading @@ -193,7 +170,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testEmailGateway() throws Exception { String pdu = "07914151551512f204038105f300007011103164638a28e6f71b50c687db" + "7076d9357eb7412f7a794e07cdeb6275794c07bde8e5391d247e93f3"; Loading Loading @@ -225,7 +201,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testExtendedCharacterTable() throws Exception { String pdu = "07914151551512f2040B916105551511f100006080615131728A44D4F29C0E2" + "AE3E96537B94C068DD16179784C2FCB41F4B0985D06B958ADD00FB0E94536AF9749" + Loading Loading @@ -264,7 +239,6 @@ public class GsmSmsTest extends TelephonyTest { }; @SmallTest @Test public void testFragmentText() throws Exception { boolean isGsmPhone = (TelephonyManager.getDefault().getPhoneType() == TelephonyManager.PHONE_TYPE_GSM); Loading Loading @@ -304,7 +278,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testFragmentTurkishText() throws Exception { boolean isGsmPhone = (TelephonyManager.getDefault().getPhoneType() == TelephonyManager.PHONE_TYPE_GSM); Loading Loading @@ -370,7 +343,6 @@ public class GsmSmsTest extends TelephonyTest { @SmallTest @Test public void testDecode() throws Exception { decodeSingle(0); // default table decodeSingle(1); // Turkish locking shift table Loading Loading @@ -446,7 +418,6 @@ public class GsmSmsTest extends TelephonyTest { }; @SmallTest @Test public void testDecodeExtended() throws Exception { for (int language = 0; language < 3; language++) { int[] tableIndex = sExtendedTableIndexes[language]; Loading Loading @@ -497,7 +468,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testDecodeExtendedFallback() throws Exception { // verify that unmapped characters in extension table fall back to locking shift table for (int language = 0; language < 3; language++) { Loading tests/telephonytests/src/com/android/internal/telephony/SmsMessageBodyTest.java +7 −19 Original line number Diff line number Diff line Loading @@ -16,18 +16,18 @@ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import android.telephony.SmsMessage; import android.telephony.TelephonyManager; import android.telephony.Rlog; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; import com.android.internal.telephony.SmsConstants; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.Random; /** * Test cases to verify selection of the optimal 7 bit encoding tables Loading @@ -39,7 +39,7 @@ import org.junit.Test; * Tests both encoding variations: unsupported characters mapped to space, * and unsupported characters force entire message to UCS-2. */ public class SmsMessageBodyTest extends TelephonyTest { public class SmsMessageBodyTest extends AndroidTestCase { private static final String TAG = "SmsMessageBodyTest"; // ASCII chars in the GSM 7 bit default alphabet Loading Loading @@ -256,18 +256,7 @@ public class SmsMessageBodyTest extends TelephonyTest { */ private static final int UDH_SEPTET_COST_CONCATENATED_MESSAGE = 6; @Before public void setUp() throws Exception { super.setUp(this.getClass().getSimpleName()); } @After public void tearDown() throws Exception { super.tearDown(); } @SmallTest @Test public void testCalcLengthAscii() throws Exception { StringBuilder sb = new StringBuilder(320); int[] values = {0, 0, 0, SmsConstants.ENCODING_7BIT, 0, 0}; Loading Loading @@ -300,7 +289,6 @@ public class SmsMessageBodyTest extends TelephonyTest { } @SmallTest @Test public void testCalcLengthUnicode() throws Exception { StringBuilder sb = new StringBuilder(160); int[] values = {0, 0, 0, SmsConstants.ENCODING_16BIT, 0, 0}; Loading tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java +2 −54 Original line number Diff line number Diff line Loading @@ -16,28 +16,19 @@ package com.android.internal.telephony.cdma.sms; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.telephony.TelephonyManager; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails; import com.android.internal.telephony.SmsHeader; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.cdma.SmsMessage; import com.android.internal.util.HexDump; import java.util.ArrayList; import java.util.Arrays; import org.junit.After; import org.junit.Before; import org.junit.Test; public class CdmaSmsTest extends TelephonyTest { public class CdmaSmsTest extends AndroidTestCase { // CJK ideographs, Hiragana, Katakana, full width letters, Cyrillic, etc. private static final String sUnicodeChars = "\u4e00\u4e01\u4e02\u4e03" + Loading @@ -52,18 +43,7 @@ public class CdmaSmsTest extends TelephonyTest { // "Hello, world" in Japanese. private static final String sHelloWorldJa = "\u3053\u3093\u306b\u3061\u306f\u4e16\u754c"; @Before public void setUp() throws Exception { super.setUp(this.getClass().getSimpleName()); } @After public void tearDown() throws Exception { super.tearDown(); } @SmallTest @Test public void testCdmaSmsAddrParsing() throws Exception { CdmaSmsAddress addr = CdmaSmsAddress.parse("6502531000"); assertEquals(addr.ton, CdmaSmsAddress.TON_UNKNOWN); Loading Loading @@ -135,7 +115,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitGsm() throws Exception { String pdu = "00031040900112488ea794e074d69e1b7392c270326cde9e98"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -143,7 +122,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitAscii() throws Exception { String pdu = "0003100160010610262d5ab500"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -151,7 +129,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitAsciiTwo() throws Exception { String pdu = "00031001d00109104539b4d052ebb3d0"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -159,7 +136,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataIa5() throws Exception { String pdu = "00031002100109184539b4d052ebb3d0"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -167,7 +143,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitAsciiFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -198,7 +173,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitGsmFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -253,7 +227,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataUtf16Feedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -290,7 +263,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMonolithicOne() throws Exception { String pdu = "0003200010010410168d2002010503060812011101590501c706069706180000000701c108" + "01c00901800a01e00b01030c01c00d01070e05039acc13880f018011020566"; Loading Loading @@ -338,7 +310,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMonolithicTwo() throws Exception { String pdu = "0003200010010410168d200201050306081201110159050192060697061800000007013d0" + "801c00901800a01e00b01030c01c00d01070e05039acc13880f018011020566"; Loading Loading @@ -386,7 +357,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderConcatRefFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -420,7 +390,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderIllegalConcatRef() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -458,7 +427,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderMixedFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -501,7 +469,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testReplyOption() throws Exception { String pdu1 = "0003104090011648b6a794e0705476bf77bceae934fe5f6d94d87450080a0180"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading Loading @@ -534,7 +501,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testReplyOptionFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -577,7 +543,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testNumberOfMessages() throws Exception { // Note that the message text below does not properly reflect // the message count. The author of these messages was Loading @@ -595,7 +560,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testCallbackNum() throws Exception { String pdu1 = "00031040900112488ea794e070d436cb638bc5e035ce2f97900e06910431323334"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -608,7 +572,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testCallbackNumDtmf() throws Exception { String pdu1 = "00031002300109104539b4d052ebb3d00e07052d4c90a55080"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -621,7 +584,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testCallbackNumFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -659,7 +621,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testPrivacyIndicator() throws Exception { String pdu1 = "0003104090010c485f4194dfea34becf61b840090140"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -673,7 +634,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testPrivacyIndicatorFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -696,7 +656,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMsgDeliveryAlert() throws Exception { String pdu1 = "0003104090010d4866a794e07055965b91d040300c0100"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading Loading @@ -727,7 +686,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMiscParams() throws Exception { String pdu1 = "00031002400109104539b4d052ebb3d00c0180"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -749,7 +707,6 @@ public class CdmaSmsTest extends TelephonyTest { assertEquals(bd4.userData.payloadStr, "SMS Rulz"); } @SmallTest @Test public void testMsgDeliveryAlertFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -774,7 +731,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testLanguageIndicator() throws Exception { String pdu1 = "0003104090011748bea794e0731436ef3bd7c2e0352eef27a1c263fe58080d0101"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -787,7 +743,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testLanguageIndicatorFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -812,7 +767,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testDisplayMode() throws Exception { String pdu1 = "0003104090010c485f4194dfea34becf61b8400f0100"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -826,7 +780,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testDisplayModeFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -851,7 +804,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testIs91() throws Exception { String pdu1 = "000320001001070c2039acc13880"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -862,7 +814,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderWithEightCharMsg() throws Exception { SmsHeader smsHeader = getConcatUserDataHeader(2, 2); encodeDecodeAssertEquals("01234567", smsHeader, -1); Loading @@ -871,14 +822,12 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testShiftJis() throws Exception { encodeDecodeAssertEquals(sHelloWorldJa, null, UserData.ENCODING_UNICODE_16); encodeDecodeAssertEquals(sHelloWorldJa, null, UserData.ENCODING_SHIFT_JIS); } @SmallTest @Test public void testIgnoreReservedSubparam() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -961,7 +910,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testFragmentText() throws Exception { boolean isCdmaPhone = (TelephonyManager.getDefault().getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA); Loading Loading
tests/telephonytests/src/android/telephony/SmsMessageTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ public class SmsMessageTest { // should return null instead of SmsMessage with null wrappedMessage assertEquals(null, SmsMessage.createFromPdu(null, SmsConstants.FORMAT_3GPP2)); assertEquals(null, SmsMessage.createFromPdu(null, SmsConstants.FORMAT_3GPP)); assertEquals(null, SmsMessage.createFromPdu(null)); assertEquals(null, SmsMessage.newFromCMT(null)); } }
tests/telephonytests/src/com/android/internal/telephony/GsmSmsTest.java +2 −32 Original line number Diff line number Diff line Loading @@ -16,11 +16,8 @@ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import android.telephony.TelephonyManager; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.gsm.SmsMessage; Loading @@ -28,24 +25,9 @@ import com.android.internal.util.HexDump; import java.util.ArrayList; import org.junit.After; import org.junit.Before; import org.junit.Test; public class GsmSmsTest extends TelephonyTest { @Before public void setUp() throws Exception { super.setUp(this.getClass().getSimpleName()); } @After public void tearDown() throws Exception { super.tearDown(); } public class GsmSmsTest extends AndroidTestCase { @SmallTest @Test public void testAddressing() throws Exception { String pdu = "07914151551512f2040B916105551511f100006060605130308A04D4F29C0E"; SmsMessage sms = SmsMessage.createFromPdu(HexDump.hexStringToByteArray(pdu)); Loading @@ -66,7 +48,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testUdh() throws Exception { String pdu = "07914140279510F6440A8111110301003BF56080207130138A8C0B05040B8423F" + "000032A02010106276170706C69636174696F6E2F766E642E7761702E6D6D732D" Loading Loading @@ -105,7 +86,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testUcs2() throws Exception { String pdu = "07912160130300F4040B914151245584F600087010807121352B1021220" + "0A900AE00680065006C006C006F"; Loading @@ -114,7 +94,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testMultipart() throws Exception { /* * Multi-part text SMS with septet data. Loading @@ -139,7 +118,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testCPHSVoiceMail() throws Exception { // "set MWI flag" Loading Loading @@ -173,7 +151,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testCingularVoiceMail() throws Exception { // "set MWI flag" Loading @@ -193,7 +170,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testEmailGateway() throws Exception { String pdu = "07914151551512f204038105f300007011103164638a28e6f71b50c687db" + "7076d9357eb7412f7a794e07cdeb6275794c07bde8e5391d247e93f3"; Loading Loading @@ -225,7 +201,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testExtendedCharacterTable() throws Exception { String pdu = "07914151551512f2040B916105551511f100006080615131728A44D4F29C0E2" + "AE3E96537B94C068DD16179784C2FCB41F4B0985D06B958ADD00FB0E94536AF9749" + Loading Loading @@ -264,7 +239,6 @@ public class GsmSmsTest extends TelephonyTest { }; @SmallTest @Test public void testFragmentText() throws Exception { boolean isGsmPhone = (TelephonyManager.getDefault().getPhoneType() == TelephonyManager.PHONE_TYPE_GSM); Loading Loading @@ -304,7 +278,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testFragmentTurkishText() throws Exception { boolean isGsmPhone = (TelephonyManager.getDefault().getPhoneType() == TelephonyManager.PHONE_TYPE_GSM); Loading Loading @@ -370,7 +343,6 @@ public class GsmSmsTest extends TelephonyTest { @SmallTest @Test public void testDecode() throws Exception { decodeSingle(0); // default table decodeSingle(1); // Turkish locking shift table Loading Loading @@ -446,7 +418,6 @@ public class GsmSmsTest extends TelephonyTest { }; @SmallTest @Test public void testDecodeExtended() throws Exception { for (int language = 0; language < 3; language++) { int[] tableIndex = sExtendedTableIndexes[language]; Loading Loading @@ -497,7 +468,6 @@ public class GsmSmsTest extends TelephonyTest { } @SmallTest @Test public void testDecodeExtendedFallback() throws Exception { // verify that unmapped characters in extension table fall back to locking shift table for (int language = 0; language < 3; language++) { Loading
tests/telephonytests/src/com/android/internal/telephony/SmsMessageBodyTest.java +7 −19 Original line number Diff line number Diff line Loading @@ -16,18 +16,18 @@ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import android.telephony.SmsMessage; import android.telephony.TelephonyManager; import android.telephony.Rlog; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; import com.android.internal.telephony.SmsConstants; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.Random; /** * Test cases to verify selection of the optimal 7 bit encoding tables Loading @@ -39,7 +39,7 @@ import org.junit.Test; * Tests both encoding variations: unsupported characters mapped to space, * and unsupported characters force entire message to UCS-2. */ public class SmsMessageBodyTest extends TelephonyTest { public class SmsMessageBodyTest extends AndroidTestCase { private static final String TAG = "SmsMessageBodyTest"; // ASCII chars in the GSM 7 bit default alphabet Loading Loading @@ -256,18 +256,7 @@ public class SmsMessageBodyTest extends TelephonyTest { */ private static final int UDH_SEPTET_COST_CONCATENATED_MESSAGE = 6; @Before public void setUp() throws Exception { super.setUp(this.getClass().getSimpleName()); } @After public void tearDown() throws Exception { super.tearDown(); } @SmallTest @Test public void testCalcLengthAscii() throws Exception { StringBuilder sb = new StringBuilder(320); int[] values = {0, 0, 0, SmsConstants.ENCODING_7BIT, 0, 0}; Loading Loading @@ -300,7 +289,6 @@ public class SmsMessageBodyTest extends TelephonyTest { } @SmallTest @Test public void testCalcLengthUnicode() throws Exception { StringBuilder sb = new StringBuilder(160); int[] values = {0, 0, 0, SmsConstants.ENCODING_16BIT, 0, 0}; Loading
tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java +2 −54 Original line number Diff line number Diff line Loading @@ -16,28 +16,19 @@ package com.android.internal.telephony.cdma.sms; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import android.telephony.TelephonyManager; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails; import com.android.internal.telephony.SmsHeader; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.cdma.SmsMessage; import com.android.internal.util.HexDump; import java.util.ArrayList; import java.util.Arrays; import org.junit.After; import org.junit.Before; import org.junit.Test; public class CdmaSmsTest extends TelephonyTest { public class CdmaSmsTest extends AndroidTestCase { // CJK ideographs, Hiragana, Katakana, full width letters, Cyrillic, etc. private static final String sUnicodeChars = "\u4e00\u4e01\u4e02\u4e03" + Loading @@ -52,18 +43,7 @@ public class CdmaSmsTest extends TelephonyTest { // "Hello, world" in Japanese. private static final String sHelloWorldJa = "\u3053\u3093\u306b\u3061\u306f\u4e16\u754c"; @Before public void setUp() throws Exception { super.setUp(this.getClass().getSimpleName()); } @After public void tearDown() throws Exception { super.tearDown(); } @SmallTest @Test public void testCdmaSmsAddrParsing() throws Exception { CdmaSmsAddress addr = CdmaSmsAddress.parse("6502531000"); assertEquals(addr.ton, CdmaSmsAddress.TON_UNKNOWN); Loading Loading @@ -135,7 +115,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitGsm() throws Exception { String pdu = "00031040900112488ea794e074d69e1b7392c270326cde9e98"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -143,7 +122,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitAscii() throws Exception { String pdu = "0003100160010610262d5ab500"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -151,7 +129,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitAsciiTwo() throws Exception { String pdu = "00031001d00109104539b4d052ebb3d0"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -159,7 +136,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataIa5() throws Exception { String pdu = "00031002100109184539b4d052ebb3d0"; BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu)); Loading @@ -167,7 +143,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitAsciiFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -198,7 +173,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserData7bitGsmFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -253,7 +227,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataUtf16Feedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -290,7 +263,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMonolithicOne() throws Exception { String pdu = "0003200010010410168d2002010503060812011101590501c706069706180000000701c108" + "01c00901800a01e00b01030c01c00d01070e05039acc13880f018011020566"; Loading Loading @@ -338,7 +310,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMonolithicTwo() throws Exception { String pdu = "0003200010010410168d200201050306081201110159050192060697061800000007013d0" + "801c00901800a01e00b01030c01c00d01070e05039acc13880f018011020566"; Loading Loading @@ -386,7 +357,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderConcatRefFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -420,7 +390,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderIllegalConcatRef() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -458,7 +427,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderMixedFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -501,7 +469,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testReplyOption() throws Exception { String pdu1 = "0003104090011648b6a794e0705476bf77bceae934fe5f6d94d87450080a0180"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading Loading @@ -534,7 +501,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testReplyOptionFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -577,7 +543,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testNumberOfMessages() throws Exception { // Note that the message text below does not properly reflect // the message count. The author of these messages was Loading @@ -595,7 +560,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testCallbackNum() throws Exception { String pdu1 = "00031040900112488ea794e070d436cb638bc5e035ce2f97900e06910431323334"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -608,7 +572,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testCallbackNumDtmf() throws Exception { String pdu1 = "00031002300109104539b4d052ebb3d00e07052d4c90a55080"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -621,7 +584,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testCallbackNumFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -659,7 +621,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testPrivacyIndicator() throws Exception { String pdu1 = "0003104090010c485f4194dfea34becf61b840090140"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -673,7 +634,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testPrivacyIndicatorFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -696,7 +656,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMsgDeliveryAlert() throws Exception { String pdu1 = "0003104090010d4866a794e07055965b91d040300c0100"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading Loading @@ -727,7 +686,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testMiscParams() throws Exception { String pdu1 = "00031002400109104539b4d052ebb3d00c0180"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -749,7 +707,6 @@ public class CdmaSmsTest extends TelephonyTest { assertEquals(bd4.userData.payloadStr, "SMS Rulz"); } @SmallTest @Test public void testMsgDeliveryAlertFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -774,7 +731,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testLanguageIndicator() throws Exception { String pdu1 = "0003104090011748bea794e0731436ef3bd7c2e0352eef27a1c263fe58080d0101"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -787,7 +743,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testLanguageIndicatorFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -812,7 +767,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testDisplayMode() throws Exception { String pdu1 = "0003104090010c485f4194dfea34becf61b8400f0100"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -826,7 +780,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testDisplayModeFeedback() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading @@ -851,7 +804,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testIs91() throws Exception { String pdu1 = "000320001001070c2039acc13880"; BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1)); Loading @@ -862,7 +814,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testUserDataHeaderWithEightCharMsg() throws Exception { SmsHeader smsHeader = getConcatUserDataHeader(2, 2); encodeDecodeAssertEquals("01234567", smsHeader, -1); Loading @@ -871,14 +822,12 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testShiftJis() throws Exception { encodeDecodeAssertEquals(sHelloWorldJa, null, UserData.ENCODING_UNICODE_16); encodeDecodeAssertEquals(sHelloWorldJa, null, UserData.ENCODING_SHIFT_JIS); } @SmallTest @Test public void testIgnoreReservedSubparam() throws Exception { BearerData bearerData = new BearerData(); bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER; Loading Loading @@ -961,7 +910,6 @@ public class CdmaSmsTest extends TelephonyTest { } @SmallTest @Test public void testFragmentText() throws Exception { boolean isCdmaPhone = (TelephonyManager.getDefault().getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA); Loading