Bug 797277 - Part 5/5: test cases, r=marshall_law
authorVicamo Yang <vyang@mozilla.com>
Wed, 31 Oct 2012 17:25:26 +0800
changeset 112015 265f424378e8
parent 112014 9ce2043663d8
child 112016 de25c9c57c53
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmarshall_law
bugs797277
milestone19.0a1
Bug 797277 - Part 5/5: test cases, r=marshall_law
dom/sms/tests/marionette/test_getmessage.js
dom/sms/tests/marionette/test_incoming.js
dom/sms/tests/marionette/test_incoming_delete.js
dom/sms/tests/marionette/test_message_classes.js
dom/sms/tests/marionette/test_outgoing.js
dom/sms/tests/marionette/test_outgoing_delete.js
dom/sms/tests/marionette/test_timestamp.js
dom/sms/tests/test_smsservice_createsmsmessage.js
dom/system/gonk/tests/test_ril_worker_sms.js
--- a/dom/sms/tests/marionette/test_getmessage.js
+++ b/dom/sms/tests/marionette/test_getmessage.js
@@ -35,16 +35,17 @@ function simulateIncomingSms() {
     inSmsId = incomingSms.id;
     log("Received SMS (id: " + inSmsId + ").");
     is(incomingSms.body, inText, "msg body");
     is(incomingSms.delivery, "received", "delivery");
     is(incomingSms.deliveryStatus, "success", "deliveryStatus");
     is(incomingSms.read, false, "read");
     is(incomingSms.receiver, null, "receiver");
     is(incomingSms.sender, remoteNumber, "sender");
+    is(incomingSms.messageClass, "normal", "messageClass");
     ok(incomingSms.timestamp instanceof Date, "timestamp is instanceof date");
     inSmsTimeStamp = incomingSms.timestamp;
     sendSms();
   };
   // Simulate incoming sms sent from remoteNumber to our emulator
   runEmulatorCmd("sms send " + remoteNumber + " " + inText, function(result) {
     is(result[0], "OK", "emulator output");
   });
@@ -61,16 +62,17 @@ function sendSms() {
     outSmsId = sentSms.id;
     log("Sent SMS (id: " + outSmsId + ").");
     is(sentSms.body, outText, "msg body");
     is(sentSms.delivery, "sent", "delivery");
     is(sentSms.deliveryStatus, "pending", "deliveryStatus");
     is(sentSms.read, true, "read");
     is(sentSms.receiver, remoteNumber, "receiver");
     is(sentSms.sender, null, "sender");
+    is(sentSms.messageClass, "normal", "messageClass");
     ok(sentSms.timestamp instanceof Date, "timestamp is instanceof date");  
     outSmsTimeStamp = sentSms.timestamp;
 
     if (gotSmsOnsent && gotReqOnsuccess) { getReceivedSms(); }
   };
 
   let requestRet = sms.send(remoteNumber, outText);
   ok(requestRet, "smsrequest obj returned");
@@ -109,16 +111,17 @@ function getReceivedSms() {
     is(foundSms.id, inSmsId, "SMS id matches");
     log("Got SMS (id: " + foundSms.id + ").");
     is(foundSms.body, inText, "SMS msg text matches");
     is(foundSms.delivery, "received", "delivery");
     is(foundSms.deliveryStatus, "success", "deliveryStatus");
     is(foundSms.read, false, "read");
     is(foundSms.receiver, myNumber, "receiver");
     is(foundSms.sender, remoteNumber, "sender");
+    is(foundSms.messageClass, "normal", "messageClass");
     ok(foundSms.timestamp instanceof Date, "timestamp is instanceof date");
     is(foundSms.timestamp.getTime(), inSmsTimeStamp.getTime(), "timestamp matches");
     getSentSms();
   };
 
   requestRet.onerror = function(event) {
     log("Received 'onerror' smsrequest event.");
     ok(event.target.error, "domerror obj");
@@ -141,16 +144,17 @@ function getSentSms() {
     is(foundSms.id, outSmsId, "SMS id matches");
     log("Got SMS (id: " + foundSms.id + ").");
     is(foundSms.body, outText, "SMS msg text matches");
     is(foundSms.delivery, "sent", "delivery");
     is(foundSms.deliveryStatus, "pending", "deliveryStatus");
     is(foundSms.read, true, "read");
     is(foundSms.receiver, remoteNumber, "receiver");
     is(foundSms.sender, myNumber, "sender");
+    is(foundSms.messageClass, "normal", "messageClass");
     ok(foundSms.timestamp instanceof Date, "timestamp is instanceof date");
     is(foundSms.timestamp.getTime(), outSmsTimeStamp.getTime(), "timestamp matches");
     deleteMsgs();
   };
 
   requestRet.onerror = function(event) {
     log("Received 'onerror' smsrequest event.");
     ok(event.target.error, "domerror obj");
--- a/dom/sms/tests/marionette/test_incoming.js
+++ b/dom/sms/tests/marionette/test_incoming.js
@@ -24,16 +24,17 @@ sms.onreceived = function onreceived(eve
   let message = event.message;
   ok(message instanceof MozSmsMessage);
 
   is(message.delivery, "received");
   is(message.deliveryStatus, "success");
   is(message.sender, sender);
   is(message.receiver, null);
   is(message.body, body);
+  is(message.messageClass, "normal");
   ok(message.timestamp instanceof Date);
   // SMSC timestamp is in seconds.
   ok(Math.floor(message.timestamp.getTime() / 1000) >= Math.floor(now / 1000));
 
   cleanUp();
 };
 
 function cleanUp() {
--- a/dom/sms/tests/marionette/test_incoming_delete.js
+++ b/dom/sms/tests/marionette/test_incoming_delete.js
@@ -26,16 +26,17 @@ function simulateIncomingSms() {
     ok(incomingSms.id, "sms id");
     log("Received SMS (id: " + incomingSms.id + ").");
     is(incomingSms.body, msgText, "msg body");
     is(incomingSms.delivery, "received", "delivery");
     is(incomingSms.deliveryStatus, "success", "deliveryStatus");
     is(incomingSms.read, false, "read");
     is(incomingSms.receiver, null, "receiver");
     is(incomingSms.sender, fromNumber, "sender");
+    is(incomingSms.messageClass, "normal", "messageClass");
     ok(incomingSms.timestamp instanceof Date, "timestamp is istanceof date");
 
     verifySmsExists(incomingSms);
   };
   runEmulatorCmd("sms send " + fromNumber + " " + msgText, function(result) {
     is(result[0], "OK", "emulator output");
   });
 }
--- a/dom/sms/tests/marionette/test_message_classes.js
+++ b/dom/sms/tests/marionette/test_message_classes.js
@@ -26,28 +26,29 @@ function sendSmsPduToEmulator(pdu) {
   runEmulatorCmd(cmd, function (result) {
     --pendingEmulatorCmdCount;
 
     is(result[0], "OK", "Emulator response");
   });
 }
 
 const TIMESTAMP = Date.UTC(2000, 0, 1);
-function checkMessage(message, id) {
+function checkMessage(message, id, messageClass) {
   ok(message instanceof MozSmsMessage,
      "message is instanceof " + message.constructor);
   if (id == null) {
     ok(message.id > 0, "message.id");
   } else {
     is(message.id, -1, "message.id");
   }
   is(message.delivery, "received", "message.delivery");
   is(message.deliveryStatus, "success", "message.deliveryStatus");
   is(message.sender, "+1", "message.sender");
   is(message.body, "A", "message.body");
+  is(message.messageClass, messageClass, "message.messageClass");
   ok(message.timestamp instanceof Date,
      "message.timestamp is instanceof " + message.timestamp.constructor);
   is(message.timestamp.getTime(), TIMESTAMP, "message.timestamp");
   is(message.read, false, "message.read");
 }
 
 function test_message_class_0() {
   let allDCSs = [
@@ -56,17 +57,17 @@ function test_message_class_0() {
     "F0"  // (no name) Group: 1111
   ];
 
   function do_test(dcsIndex) {
     sms.addEventListener("received", function onReceived(event) {
       sms.removeEventListener("received", onReceived);
 
       let message = event.message;
-      checkMessage(message, -1);
+      checkMessage(message, -1, "class-0");
 
       // Make sure the message is not stored.
       let request = sms.getMessages(null, false);
       request.onsuccess = function onsuccess() {
         let cursor = request.result;
         if (cursor.message) {
           // Here we check whether there is any message of the same sender.
           isnot(cursor.message.sender, message.sender, "cursor.message.sender");
@@ -95,23 +96,23 @@ function test_message_class_0() {
 
     sendSmsPduToEmulator(pdu);
   }
 
   log("Checking Message Class 0");
   do_test(0);
 }
 
-function doTestMessageClassGeneric(allDCSs, next) {
+function doTestMessageClassGeneric(allDCSs, messageClass, next) {
   function do_test(dcsIndex) {
     sms.addEventListener("received", function onReceived(event) {
       sms.removeEventListener("received", onReceived);
 
       // Make sure we can correctly receive the message
-      checkMessage(event.message);
+      checkMessage(event.message, null, messageClass);
 
       ++dcsIndex;
       if (dcsIndex >= allDCSs.length) {
         window.setTimeout(next, 0);
       } else {
         window.setTimeout(do_test.bind(null, dcsIndex), 0);
       }
     });
@@ -130,17 +131,17 @@ function doTestMessageClassGeneric(allDC
 function test_message_class_1() {
   let allDCSs = [
     "11", // General Group: 00xx
     "51", // Automatica Deletion Group: 01xx
     "F1"  // (no name) Group: 1111
   ];
 
   log("Checking Message Class 1");
-  doTestMessageClassGeneric(allDCSs, test_message_class_2);
+  doTestMessageClassGeneric(allDCSs, "class-1", test_message_class_2);
 }
 
 function test_message_class_2() {
   let allDCSs = [
     "12", // General Group: 00xx
     "52", // Automatica Deletion Group: 01xx
     "F2"  // (no name) Group: 1111
   ];
@@ -151,17 +152,17 @@ function test_message_class_2() {
     PDU_PID_USIM_DATA_DOWNLOAD
   ];
 
   function do_test_dcs(dcsIndex) {
     function do_test_pid(pidIndex) {
       function onReceived(event) {
         if (pidIndex == 0) {
           // Make sure we can correctly receive the message
-          checkMessage(event.message);
+          checkMessage(event.message, null, "class-2");
 
           next();
           return;
         }
 
         // TODO: Bug 792798 - B2G SMS: develop test cases for Message Class 2
         // Since we have "data download via SMS Point-to-Point" service enabled
         // but no working implementation in emulator SIM, all class 2 messages
@@ -215,17 +216,17 @@ function test_message_class_2() {
 function test_message_class_3() {
   let allDCSs = [
     "13", // General Group: 00xx
     "53", // Automatica Deletion Group: 01xx
     "F3"  // (no name) Group: 1111
   ];
 
   log("Checking Message Class 3");
-  doTestMessageClassGeneric(allDCSs, cleanUp);
+  doTestMessageClassGeneric(allDCSs, "class-3", cleanUp);
 }
 
 function cleanUp() {
   if (pendingEmulatorCmdCount) {
     window.setTimeout(cleanUp, 100);
     return;
   }
 
--- a/dom/sms/tests/marionette/test_outgoing.js
+++ b/dom/sms/tests/marionette/test_outgoing.js
@@ -32,16 +32,17 @@ function checkSentMessage(message, body,
      "message is instanceof " + message.constructor);
 
   ok(message.id, "message.id is valid");
   is(message.delivery, "sent", "message.delivery");
   is(message.deliveryStatus, "pending", "message.deliveryStatus");
   is(message.sender, null, "message.sender");
   is(message.receiver, receiver, "message.receiver");
   is(message.body, body, "message.body");
+  is(message.messageClass, "normal", "messageClass");
   ok(message.timestamp instanceof Date,
      "message.timestamp is instanceof " + message.timestamp.constructor);
   // SMSC timestamp is in seconds.
   ok(Math.floor(message.timestamp.getTime() / 1000) >= Math.floor(sentDate / 1000),
      "sent timestamp is valid");
   is(message.read, true, "message.read");
 }
 
--- a/dom/sms/tests/marionette/test_outgoing_delete.js
+++ b/dom/sms/tests/marionette/test_outgoing_delete.js
@@ -31,16 +31,17 @@ function sendSms() {
     smsId = sentSms.id;
     log("Sent SMS (id: " + smsId + ").");
     is(sentSms.body, msgText, "msg body");
     is(sentSms.delivery, "sent", "delivery");
     is(sentSms.deliveryStatus, "pending", "deliveryStatus");
     is(sentSms.read, true, "read");
     is(sentSms.receiver, destNumber, "receiver");
     is(sentSms.sender, null, "sender");
+    is(sentSms.messageClass, "normal", "messageClass");
     ok(sentSms.timestamp instanceof Date, "timestamp is istanceof date");
 
     if (gotSmsOnsent && gotReqOnsuccess) { verifySmsExists(smsId); }
   };
 
   let requestRet = sms.send(destNumber, msgText);
   ok(requestRet, "smsrequest obj returned");
 
--- a/dom/sms/tests/marionette/test_timestamp.js
+++ b/dom/sms/tests/marionette/test_timestamp.js
@@ -33,16 +33,17 @@ function simulateIncomingSms() {
     ok(incomingSms, "incoming sms");
     ok(incomingSms.id, "sms id");
     inSmsId = incomingSms.id;
     is(incomingSms.body, inText, "msg body");
     is(incomingSms.delivery, "received", "delivery");
     is(incomingSms.read, false, "read");
     is(incomingSms.receiver, null, "receiver");
     is(incomingSms.sender, remoteNumber, "sender");
+    is(incomingSms.messageClass, "normal", "messageClass");
     ok(incomingSms.timestamp instanceof Date, "timestamp is instanceof date");
     // The max resolution of the SCTS (SMS Centre TimeStamp) is one second
     // therefore we want to compare in seconds not milliseconds. No need to
     // round received sms timestamp, the value is in milliseconds but at
     // seconds resolution already (always ends with 000) so just convert
     inSmsTime = Math.floor(incomingSms.timestamp.getTime() / 1000);
     log("Received SMS (id: " + inSmsId + ") timestamp: " + inSmsTime + ".");
     if(outSmsTime) {
@@ -79,16 +80,17 @@ function sendSms() {
     ok(sentSms, "outgoing sms");
     ok(sentSms.id, "sms id");
     outSmsId = sentSms.id;
     is(sentSms.body, outText, "msg body");
     is(sentSms.delivery, "sent", "delivery");
     is(sentSms.read, true, "read");
     is(sentSms.receiver, remoteNumber, "receiver");
     is(sentSms.sender, null, "sender");
+    is(sentSms.messageClass, "normal", "messageClass");
     ok(sentSms.timestamp instanceof Date, "timestamp is instanceof date");
     // The max resolution of the SCTS (SMS Centre TimeStamp) is one second
     // therefore we want to compare in seconds not milliseconds. Round the
     // sent sms timestamp to nearest second.
     outSmsTime = Math.round(sentSms.timestamp.getTime() / 1000);
     log("Sent SMS (id: " + outSmsId + ") timestamp: " + outSmsTime + ".");
 
     if (gotSmsOnsent && gotReqOnsuccess) { verifyTimeStamps(); }
--- a/dom/sms/tests/test_smsservice_createsmsmessage.js
+++ b/dom/sms/tests/test_smsservice_createsmsmessage.js
@@ -27,36 +27,37 @@ function newMessage() {
 function run_test() {
   run_next_test();
 }
 
 /**
  * Ensure an SmsMessage object created has sensible initial values.
  */
 add_test(function test_interface() {
-  let sms = newMessage(null, "sent", "pending", null, null, null, new Date(),
-                       true);
+  let sms = newMessage(null, "sent", "pending", null, null, null, "normal",
+                       new Date(), true);
   do_check_true(sms instanceof Ci.nsIDOMMozSmsMessage);
   do_check_eq(sms.id, 0);
   do_check_eq(sms.delivery, "sent");
   do_check_eq(sms.deliveryStatus, "pending");
   do_check_eq(sms.receiver, null);
   do_check_eq(sms.sender, null);
   do_check_eq(sms.body, null);
+  do_check_eq(sms.messageClass, "normal");
   do_check_true(sms.timestamp instanceof Date);
   do_check_true(sms.read);
   run_next_test();
 });
 
 /**
  * Verify that attributes are read-only.
  */
 add_test(function test_readonly_attributes() {
   let sms = newMessage(null, "received", "success", null, null, null,
-                       new Date(), true);
+                       "normal", new Date(), true);
 
   sms.id = 1;
   do_check_eq(sms.id, 0);
 
   sms.delivery = "sent";
   do_check_eq(sms.delivery, "received");
 
   sms.deliveryStatus = "pending";
@@ -66,143 +67,170 @@ add_test(function test_readonly_attribut
   do_check_eq(sms.receiver, null);
 
   sms.sender = "a sender";
   do_check_eq(sms.sender, null);
 
   sms.body = "a body";
   do_check_eq(sms.body, null);
 
+  sms.messageClass = "class-0";
+  do_check_eq(sms.messageClass, "normal");
+
   let oldTimestamp = sms.timestamp.getTime();
   sms.timestamp = new Date();
   do_check_eq(sms.timestamp.getTime(), oldTimestamp);
 
   sms.read = false;
   do_check_true(sms.read);
 
   run_next_test();
 });
 
 /**
  * Test supplying the timestamp as a number of milliseconds.
  */
 add_test(function test_timestamp_number() {
   let ts = Date.now();
   let sms = newMessage(42, "sent", "pending", "the sender", "the receiver",
-                       "the body", ts, true);
+                       "the body", "normal", ts, true);
   do_check_eq(sms.id, 42);
   do_check_eq(sms.delivery, "sent");
   do_check_eq(sms.deliveryStatus, "pending");
   do_check_eq(sms.sender, "the sender");
   do_check_eq(sms.receiver, "the receiver");
   do_check_eq(sms.body, "the body");
+  do_check_eq(sms.messageClass, "normal");
   do_check_true(sms.timestamp instanceof Date);
   do_check_eq(sms.timestamp.getTime(), ts);
   do_check_true(sms.read);
   run_next_test();
 });
 
 /**
  * Test supplying the timestamp as a Date object.
  */
 add_test(function test_timestamp_date() {
   let date = new Date();
   let sms = newMessage(42, "sent", "pending", "the sender", "the receiver",
-                       "the body", date, true);
+                       "the body", "normal", date, true);
   do_check_eq(sms.id, 42);
   do_check_eq(sms.delivery, "sent");
   do_check_eq(sms.deliveryStatus, "pending");
   do_check_eq(sms.sender, "the sender");
   do_check_eq(sms.receiver, "the receiver");
   do_check_eq(sms.body, "the body");
+  do_check_eq(sms.messageClass, "normal");
   do_check_true(sms.timestamp instanceof Date);
   do_check_eq(sms.timestamp.getTime(), date.getTime());
   do_check_true(sms.read);
   run_next_test();
 });
 
 /**
  * Test that a floating point number for the timestamp is not allowed.
  */
 add_test(function test_invalid_timestamp_float() {
   do_check_throws(function() {
     newMessage(42, "sent", "pending", "the sender", "the receiver", "the body",
-               3.1415, true);
+               "normal", 3.1415, true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
 
 /**
  * Test that a null value for the timestamp is not allowed.
  */
 add_test(function test_invalid_timestamp_null() {
   do_check_throws(function() {
     newMessage(42, "sent", "pending", "the sender", "the receiver", "the body",
-               null, true);
+               "normal", null, true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
 
 /**
  * Test that undefined for the timestamp is not allowed.
  */
 add_test(function test_invalid_timestamp_undefined() {
   do_check_throws(function() {
     newMessage(42, "sent", "pending", "the sender", "the receiver", "the body",
-               undefined, true);
+               "normal", undefined, true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
 
 /**
  * Test that a random object for the timestamp is not allowed.
  */
 add_test(function test_invalid_timestamp_object() {
   do_check_throws(function() {
     newMessage(42, "sent", "pending", "the sender", "the receiver", "the body",
-               {}, true);
+               "normal", {}, true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
 
 /**
  * Test that an invalid delivery string is not accepted.
  */
 add_test(function test_invalid_delivery_string() {
   do_check_throws(function() {
     newMessage(42, "this is invalid", "pending", "the sender", "the receiver",
-               "the body", new Date(), true);
+               "the body", "normal", new Date(), true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
 
 /**
  * Test that a number is not accepted for the 'delivery' argument.
  */
 add_test(function test_invalid_delivery_string() {
   do_check_throws(function() {
     newMessage(42, 1, "pending", "the sender", "the receiver", "the body",
-               new Date(), true);
+               "normal", new Date(), true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
 
 /**
  * Test that an invalid delivery status string is not accepted.
  */
 add_test(function test_invalid_delivery_status_string() {
   do_check_throws(function() {
     newMessage(42, "sent", "this is invalid", "the sender", "the receiver",
-               "the body", new Date(), true);
+               "the body", "normal", new Date(), true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
 
 /**
  * Test that a number is not accepted for the 'deliveryStatus' argument.
  */
 add_test(function test_invalid_delivery_status_string() {
   do_check_throws(function() {
     newMessage(42, "sent", 1, "the sender", "the receiver", "the body",
-               new Date(), true);
+               "normal", new Date(), true);
   }, Cr.NS_ERROR_INVALID_ARG);
   run_next_test();
 });
+
+/**
+ * Test that an invalid message class string is not accepted.
+ */
+add_test(function test_invalid_message_class_string() {
+  do_check_throws(function() {
+    newMessage(42, "sent", "pending", "the sender", "the receiver",
+               "the body", "this is invalid", new Date(), true);
+  }, Cr.NS_ERROR_INVALID_ARG);
+  run_next_test();
+});
+
+/**
+ * Test that a number is not accepted for the 'messageClass' argument.
+ */
+add_test(function test_invalid_message_class_string() {
+  do_check_throws(function() {
+    newMessage(42, "sent", "pending", "the sender", "the receiver", "the body",
+               1, new Date(), true);
+  }, Cr.NS_ERROR_INVALID_ARG);
+  run_next_test();
+});
--- a/dom/system/gonk/tests/test_ril_worker_sms.js
+++ b/dom/system/gonk/tests/test_ril_worker_sms.js
@@ -101,82 +101,116 @@ add_test(function test_GsmPDUHelper_read
       do_check_eq(msg.mwi.active, mwi.active);
       do_check_eq(msg.mwi.discard, mwi.discard);
       do_check_eq(msg.mwi.msgCount, mwi.msgCount);
     }
   }
 
   // Group 00xx
   //   Bit 3 and 2 indicate the character set being used.
-  test_dcs(0x00, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0x04, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0x08, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0x0C, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
+  test_dcs(0x00, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0x04, PDU_DCS_MSG_CODING_8BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0x08, PDU_DCS_MSG_CODING_16BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0x0C, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
   //   Bit 4, if set to 0, indicates that bits 1 to 0 are reserved and have no
   //   message class meaning.
-  test_dcs(0x01, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0x02, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0x03, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
+  test_dcs(0x01, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0x02, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0x03, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
   //   Bit 4, if set to 1, indicates that bits 1 to 0 have a message class meaning.
-  test_dcs(0x10, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
-  test_dcs(0x11, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_ME_SPECIFIC);
-  test_dcs(0x12, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_SIM_SPECIFIC);
-  test_dcs(0x13, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_TE_SPECIFIC);
+  test_dcs(0x10, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_0]);
+  test_dcs(0x11, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_1]);
+  test_dcs(0x12, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_2]);
+  test_dcs(0x13, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_3]);
 
   // Group 01xx
-  test_dcs(0x50, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
+  test_dcs(0x50, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_0]);
 
   // Group 1000..1011: reserved
-  test_dcs(0x8F, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0x9F, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0xAF, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
-  test_dcs(0xBF, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
+  test_dcs(0x8F, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0x9F, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0xAF, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
+  test_dcs(0xBF, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL]);
 
   // Group 1100: Message Waiting Indication Group: Discard Message
   //   Bit 3 indicates Indication Sense:
-  test_dcs(0xC0, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xC0, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: false, discard: true, msgCount: 0});
-  test_dcs(0xC8, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xC8, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: true, discard: true, msgCount: -1});
   //   Bit 2 is reserved, and set to 0:
-  test_dcs(0xCC, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xCC, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: true, discard: true, msgCount: -1});
 
   // Group 1101: Message Waiting Indication Group: Store Message
   //   Bit 3 indicates Indication Sense:
-  test_dcs(0xD0, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xD0, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: false, discard: false, msgCount: 0});
-  test_dcs(0xD8, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xD8, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: true, discard: false, msgCount: -1});
   //   Bit 2 is reserved, and set to 0:
-  test_dcs(0xDC, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xDC, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: true, discard: false, msgCount: -1});
 
   // Group 1110: Message Waiting Indication Group: Store Message, UCS2
   //   Bit 3 indicates Indication Sense:
-  test_dcs(0xE0, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xE0, PDU_DCS_MSG_CODING_16BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: false, discard: false, msgCount: 0});
-  test_dcs(0xE8, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xE8, PDU_DCS_MSG_CODING_16BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: true, discard: false, msgCount: -1});
   //   Bit 2 is reserved, and set to 0:
-  test_dcs(0xEC, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
+  test_dcs(0xEC, PDU_DCS_MSG_CODING_16BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_NORMAL],
            {active: true, discard: false, msgCount: -1});
 
   // Group 1111
-  test_dcs(0xF0, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
-  test_dcs(0xF1, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_ME_SPECIFIC);
-  test_dcs(0xF2, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_SIM_SPECIFIC);
-  test_dcs(0xF3, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_TE_SPECIFIC);
-  test_dcs(0xF4, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
-  test_dcs(0xF5, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_ME_SPECIFIC);
-  test_dcs(0xF6, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_SIM_SPECIFIC);
-  test_dcs(0xF7, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_TE_SPECIFIC);
+  test_dcs(0xF0, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_0]);
+  test_dcs(0xF1, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_1]);
+  test_dcs(0xF2, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_2]);
+  test_dcs(0xF3, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_3]);
+  test_dcs(0xF4, PDU_DCS_MSG_CODING_8BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_0]);
+  test_dcs(0xF5, PDU_DCS_MSG_CODING_8BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_1]);
+  test_dcs(0xF6, PDU_DCS_MSG_CODING_8BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_2]);
+  test_dcs(0xF7, PDU_DCS_MSG_CODING_8BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_3]);
   //   Bit 3 is reserved and should be set to 0, but if it doesn't we should
   //   ignore it.
-  test_dcs(0xF8, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
+  test_dcs(0xF8, PDU_DCS_MSG_CODING_7BITS_ALPHABET,
+           GECKO_SMS_MESSAGE_CLASSES[PDU_DCS_MSG_CLASS_0]);
 
   run_next_test();
 });
 
 /**
  * Verify RadioInterfaceLayer#_countGsm7BitSeptets() and
  * GsmPDUHelper#writeStringAsSeptets() algorithm match each other.
  */