summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTammo Spalink <tammo@google.com>2009-05-22 13:08:52 +0800
committerTammo Spalink <tammo@google.com>2009-05-22 13:38:35 +0800
commit550885d158f5371cb207228eb1b7fb06aac32ea3 (patch)
treedf542e5961e2cdd7e32a78676c2eeca04b921fe1 /tests
parent84ce47e64f9aa5600b6b3e205f8c6930a8095c7d (diff)
downloadframeworks_base-550885d158f5371cb207228eb1b7fb06aac32ea3.zip
frameworks_base-550885d158f5371cb207228eb1b7fb06aac32ea3.tar.gz
frameworks_base-550885d158f5371cb207228eb1b7fb06aac32ea3.tar.bz2
added SmsMessage ConcatRef parsing validation
addresses bugs: http://b/issue?id=1870607 http://b/issue?id=1688238 and prior perforce commit: http://s9/?change_num=136189
Diffstat (limited to 'tests')
-rw-r--r--tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
index f8d5d4d..75fd157 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
@@ -169,6 +169,43 @@ public class CdmaSmsTest extends AndroidTestCase {
}
@SmallTest
+ public void testUserDataHeaderIllegalConcatRef() throws Exception {
+ BearerData bearerData = new BearerData();
+ bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+ bearerData.messageId = 55;
+ SmsHeader.ConcatRef concatRef = new SmsHeader.ConcatRef();
+ concatRef.refNumber = 0x10;
+ concatRef.msgCount = 0;
+ concatRef.seqNumber = 2;
+ concatRef.isEightBits = true;
+ SmsHeader smsHeader = new SmsHeader();
+ smsHeader.concatRef = concatRef;
+ byte[] encodedHeader = SmsHeader.toByteArray(smsHeader);
+ SmsHeader decodedHeader = SmsHeader.fromByteArray(encodedHeader);
+ assertEquals(decodedHeader.concatRef, null);
+ concatRef.isEightBits = false;
+ encodedHeader = SmsHeader.toByteArray(smsHeader);
+ decodedHeader = SmsHeader.fromByteArray(encodedHeader);
+ assertEquals(decodedHeader.concatRef, null);
+ concatRef.msgCount = 1;
+ concatRef.seqNumber = 2;
+ encodedHeader = SmsHeader.toByteArray(smsHeader);
+ decodedHeader = SmsHeader.fromByteArray(encodedHeader);
+ assertEquals(decodedHeader.concatRef, null);
+ concatRef.msgCount = 1;
+ concatRef.seqNumber = 0;
+ encodedHeader = SmsHeader.toByteArray(smsHeader);
+ decodedHeader = SmsHeader.fromByteArray(encodedHeader);
+ assertEquals(decodedHeader.concatRef, null);
+ concatRef.msgCount = 2;
+ concatRef.seqNumber = 1;
+ encodedHeader = SmsHeader.toByteArray(smsHeader);
+ decodedHeader = SmsHeader.fromByteArray(encodedHeader);
+ assertEquals(decodedHeader.concatRef.msgCount, 2);
+ assertEquals(decodedHeader.concatRef.seqNumber, 1);
+ }
+
+ @SmallTest
public void testUserDataHeaderMixedFeedback() throws Exception {
BearerData bearerData = new BearerData();
bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;