Bug 939302 - Test. r=vicamo
authorGene Lian <clian@mozilla.com>
Mon, 02 Dec 2013 14:31:57 +0800
changeset 160509 1660fc1537efa9a4287442f806c9bc141f8e84db
parent 160508 6cc9232b753d5ce12957b8b28c7c9fccff8f3ffa
child 160510 1b91cf5c8407a54de0959136b9fc3ee156a9fcc6
push id25834
push userphilringnalda@gmail.com
push dateSun, 15 Dec 2013 02:20:53 +0000
treeherdermozilla-central@9fcc6330dc69 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs939302
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 939302 - Test. r=vicamo
dom/mobilemessage/tests/marionette/test_filter_date.js
dom/mobilemessage/tests/marionette/test_getmessage.js
dom/mobilemessage/tests/marionette/test_getmessages.js
dom/mobilemessage/tests/marionette/test_getthreads.js
dom/mobilemessage/tests/marionette/test_incoming.js
dom/mobilemessage/tests/marionette/test_incoming_delete.js
dom/mobilemessage/tests/marionette/test_incoming_max_segments.js
dom/mobilemessage/tests/marionette/test_incoming_multipart.js
dom/mobilemessage/tests/marionette/test_massive_incoming_delete.js
dom/mobilemessage/tests/marionette/test_message_classes.js
dom/mobilemessage/tests/marionette/test_outgoing.js
dom/mobilemessage/tests/marionette/test_outgoing_delete.js
dom/mobilemessage/tests/marionette/test_update_thread_record_in_delete.js
dom/mobilemessage/tests/test_smsservice_createsmsmessage.js
--- a/dom/mobilemessage/tests/marionette/test_filter_date.js
+++ b/dom/mobilemessage/tests/marionette/test_filter_date.js
@@ -173,18 +173,17 @@ function getMsgs() {
     ok(false,"Could not get SMS messages");
     cleanUp();
   };
 }
 
 function verifyFoundMsgs(foundSmsList) {
   for (var x = 0; x < foundSmsList.length; x++) {
     is(foundSmsList[x].id, smsList[x].id, "id");
-    is(foundSmsList[x].timestamp.getTime(), smsList[x].timestamp.getTime(),
-        "timestmap");
+    is(foundSmsList[x].timestamp, smsList[x].timestamp, "timestmap");
   }
   deleteAllMsgs(cleanUp);
 }
 
 function cleanUp() {
   manager.onreceived = null;
   SpecialPowers.removePermission("sms", document);
   SpecialPowers.clearUserPref("dom.sms.enabled");
--- a/dom/mobilemessage/tests/marionette/test_getmessage.js
+++ b/dom/mobilemessage/tests/marionette/test_getmessage.js
@@ -43,17 +43,16 @@ function simulateIncomingSms() {
     inThreadId = incomingSms.threadId;
     is(incomingSms.body, inText, "msg body");
     is(incomingSms.delivery, "received", "delivery");
     is(incomingSms.deliveryStatus, "success", "deliveryStatus");
     is(incomingSms.read, false, "read");
     is(incomingSms.receiver, EMULATOR, "receiver");
     is(incomingSms.sender, REMOTE, "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 " + REMOTE + " " + inText, function(result) {
     is(result[0], "OK", "emulator output");
   });
 }
@@ -72,19 +71,18 @@ function sendSms() {
     outThreadId = sentSms.threadId;
     is(sentSms.body, outText, "msg body");
     is(sentSms.delivery, "sent", "delivery");
     is(sentSms.deliveryStatus, "pending", "deliveryStatus");
     is(sentSms.read, true, "read");
     is(sentSms.receiver, REMOTE, "receiver");
     is(sentSms.sender, EMULATOR, "sender");
     is(sentSms.messageClass, "normal", "messageClass");
-    ok(sentSms.timestamp instanceof Date, "timestamp is instanceof date");  
     outSmsTimeStamp = sentSms.timestamp;
-    ok(sentSms.deliveryTimestamp === null, "deliveryTimestamp is null");
+    is(sentSms.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
     if (gotSmsOnsent && gotReqOnsuccess) { getReceivedSms(); }
   };
 
   let requestRet = manager.send(REMOTE, outText);
   ok(requestRet, "smsrequest obj returned");
 
   requestRet.onsuccess = function(event) {
@@ -123,18 +121,17 @@ function getReceivedSms() {
     is(foundSms.threadId, inThreadId, "thread id matches");
     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, EMULATOR, "receiver");
     is(foundSms.sender, REMOTE, "sender");
     is(foundSms.messageClass, "normal", "messageClass");
-    ok(foundSms.timestamp instanceof Date, "timestamp is instanceof date");
-    is(foundSms.timestamp.getTime(), inSmsTimeStamp.getTime(), "timestamp matches");
+    is(foundSms.timestamp, inSmsTimeStamp, "timestamp matches");
     getSentSms();
   };
 
   requestRet.onerror = function(event) {
     log("Received 'onerror' smsrequest event.");
     ok(event.target.error, "domerror obj");
     is(event.target.error.name, "NotFoundError", "error returned");
     log("Could not get SMS (id: " + inSmsId + ") but should have.");
@@ -157,18 +154,17 @@ function getSentSms() {
     is(foundSms.threadId, outThreadId, "thread id matches");
     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, REMOTE, "receiver");
     is(foundSms.sender, EMULATOR, "sender");
     is(foundSms.messageClass, "normal", "messageClass");
-    ok(foundSms.timestamp instanceof Date, "timestamp is instanceof date");
-    is(foundSms.timestamp.getTime(), outSmsTimeStamp.getTime(), "timestamp matches");
+    is(foundSms.timestamp, outSmsTimeStamp, "timestamp matches");
     deleteMsgs();
   };
 
   requestRet.onerror = function(event) {
     log("Received 'onerror' smsrequest event.");
     ok(event.target.error, "domerror obj");
     is(event.target.error.name, "NotFoundError", "error returned");
     log("Could not get SMS (id: " + outSmsId + ") but should have.");
--- a/dom/mobilemessage/tests/marionette/test_getmessages.js
+++ b/dom/mobilemessage/tests/marionette/test_getmessages.js
@@ -196,18 +196,17 @@ function verifyFoundMsgs(foundSmsList, r
     // getMessage. Default emulator (receiver) phone number is 15555215554
     if (!smsList[x].receiver) {
       isIn(foundSmsList[x].receiver, ["15555215554", "+15555215554"], "receiver");
     } else {
       isIn(foundSmsList[x].receiver, [smsList[x].receiver, "+15555215554"], "receiver");
     }
 
     isIn(foundSmsList[x].sender, [smsList[x].sender, "+15552229797"], "sender");
-    is(foundSmsList[x].timestamp.getTime(), smsList[x].timestamp.getTime(),
-        "timestamp");
+    is(foundSmsList[x].timestamp, smsList[x].timestamp, "timestamp");
   }
 
   log("Content in all of the returned SMS messages is correct.");
 
   if (!reverse) {
     // Now get messages in reverse
     getMsgs(true);
   } else {
--- a/dom/mobilemessage/tests/marionette/test_getthreads.js
+++ b/dom/mobilemessage/tests/marionette/test_getthreads.js
@@ -148,18 +148,16 @@ function checkThread(bodies, lastBody, u
   ok(Array.isArray(thread.participants), "thread.participants is array");
   is(thread.participants.length, participants.length,
      "thread.participants.length");
   for (let i = 0; i < participants.length; i++) {
     is(thread.participants[i], participants[i],
        "thread.participants[" + i + "]");
   }
 
-  ok(thread.timestamp instanceof Date, "thread.timestamp");
-
   // Check whether the thread does contain all the messages it supposed to have.
   let filter = new MozSmsFilter;
   filter.threadId = thread.id;
   getAllMessages(function (messages) {
     is(messages.length, bodies.length, "messages.length and bodies.length");
 
     for (let message of messages) {
       let index = bodies.indexOf(message.body);
--- a/dom/mobilemessage/tests/marionette/test_incoming.js
+++ b/dom/mobilemessage/tests/marionette/test_incoming.js
@@ -30,18 +30,17 @@ manager.onreceived = function onreceived
 
   ok(message.threadId, "thread id");
   is(message.delivery, "received", "Message delivery");
   is(message.deliveryStatus, "success", "Delivery status");
   is(message.sender, SENDER, "Message sender");
   is(message.receiver, RECEIVER, "Message receiver");
   is(message.body, body, "Message body");
   is(message.messageClass, "normal", "Message class");
-  ok(message.timestamp instanceof Date, "Message timestamp is a date");
-  ok(message.deliveryTimestamp === null, "Message deliveryTimestamp is null");
+  is(message.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
   cleanUp();
 };
 
 function cleanUp() {
   if (!completed) {
     window.setTimeout(cleanUp, 100);
     return;
--- a/dom/mobilemessage/tests/marionette/test_incoming_delete.js
+++ b/dom/mobilemessage/tests/marionette/test_incoming_delete.js
@@ -31,18 +31,17 @@ function simulateIncomingSms() {
     ok(incomingSms.threadId, "thread 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, RECEIVER, "receiver");
     is(incomingSms.sender, SENDER, "sender");
     is(incomingSms.messageClass, "normal", "messageClass");
-    ok(incomingSms.timestamp instanceof Date, "timestamp is istanceof date");
-    ok(incomingSms.deliveryTimestamp === null, "deliveryTimestamp is null");
+    is(incomingSms.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
     verifySmsExists(incomingSms);
   };
   runEmulatorCmd("sms send " + SENDER + " " + msgText, function(result) {
     is(result[0], "OK", "emulator output");
   });
 }
 
--- a/dom/mobilemessage/tests/marionette/test_incoming_max_segments.js
+++ b/dom/mobilemessage/tests/marionette/test_incoming_max_segments.js
@@ -39,18 +39,17 @@ function simulateIncomingSms() {
     log("Received SMS (id: " + incomingSms.id + ").");
     ok(incomingSms.threadId, "thread id");
     is(incomingSms.body.length, msgText.length, "msg body length");
     is(incomingSms.body, msgText, "msg body");
     is(incomingSms.delivery, "received", "delivery");
     is(incomingSms.read, false, "read");
     is(incomingSms.receiver, EMULATOR, "receiver");
     is(incomingSms.sender, REMOTE, "sender");
-    ok(incomingSms.timestamp instanceof Date, "timestamp is instanceof date");
-    ok(incomingSms.deliveryTimestamp === null, "deliveryTimestamp is null");
+    is(incomingSms.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
     verifySmsExists(incomingSms);
   };
   runEmulatorCmd("sms send " + REMOTE + " " + msgText, function(result) {
     is(result[0], "OK", "emulator output");
   });
 }
 
--- a/dom/mobilemessage/tests/marionette/test_incoming_multipart.js
+++ b/dom/mobilemessage/tests/marionette/test_incoming_multipart.js
@@ -35,18 +35,17 @@ function simulateIncomingSms() {
     ok(incomingSms.id, "sms id");
     log("Received SMS (id: " + incomingSms.id + ").");
     ok(incomingSms.threadId, "thread id");
     is(incomingSms.body, msgText, "msg body");
     is(incomingSms.delivery, "received", "delivery");
     is(incomingSms.read, false, "read");
     is(incomingSms.receiver, RECEIVER, "receiver");
     is(incomingSms.sender, SENDER, "sender");
-    ok(incomingSms.timestamp instanceof Date, "timestamp is istanceof date");
-    ok(incomingSms.deliveryTimestamp === null, "deliveryTimestamp is null");
+    is(incomingSms.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
     verifySmsExists(incomingSms);
   };
   runEmulatorCmd("sms send " + SENDER + " " + msgText, function(result) {
     is(result[0], "OK", "emulator output");
   });
 }
 
--- a/dom/mobilemessage/tests/marionette/test_massive_incoming_delete.js
+++ b/dom/mobilemessage/tests/marionette/test_massive_incoming_delete.js
@@ -140,18 +140,17 @@ tasks.push(function init() {
     ok(incomingSms.threadId, "thread id");
     is(incomingSms.body, MSG_TEXT, "msg body");
     is(incomingSms.delivery, "received", "delivery");
     is(incomingSms.deliveryStatus, "success", "deliveryStatus");
     is(incomingSms.read, false, "read");
     is(incomingSms.receiver, RECEIVER, "receiver");
     is(incomingSms.sender, SENDER, "sender");
     is(incomingSms.messageClass, "normal", "messageClass");
-    ok(incomingSms.timestamp instanceof Date, "timestamp is istanceof date");
-    ok(incomingSms.deliveryTimestamp === null, "deliveryTimestamp is null");
+    is(incomingSms.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
     verifySmsExists(incomingSms);
   };
 
   tasks.next();
 });
 
 tasks.push(function sendAllSms() {
--- a/dom/mobilemessage/tests/marionette/test_message_classes.js
+++ b/dom/mobilemessage/tests/marionette/test_message_classes.js
@@ -44,37 +44,36 @@ function checkMessage(message, id, threa
   } else {
     is(message.threadId, threadId, "message.threadId");
   }
   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, "timestamp is instanceof Date");
-  ok(message.deliveryTimestamp === null, "deliveryTimestamp is null");
+  is(message.deliveryTimestamp, 0, "deliveryTimestamp is 0");
   is(message.read, false, "message.read");
 }
 
 function test_message_class_0() {
   let allDCSs = [
     "10", // General Group: 00xx
     "50", // Automatica Deletion Group: 01xx
     "F0"  // (no name) Group: 1111
   ];
 
   function do_test(dcsIndex) {
     manager.addEventListener("received", function onReceived(event) {
       manager.removeEventListener("received", onReceived);
 
       let message = event.message;
       checkMessage(message, -1, 0, "class-0");
-      ok(event.message.timestamp.getTime() >= timeBeforeSend,
+      ok(event.message.timestamp >= timeBeforeSend,
          "Message's timestamp should be greater then the timetamp of sending");
-      ok(event.message.timestamp.getTime() <= Date.now(),
+      ok(event.message.timestamp <= Date.now(),
          "Message's timestamp should be lesser than the timestamp of now");
 
       // Make sure the message is not stored.
       let cursor = manager.getMessages(null, false);
       cursor.onsuccess = function onsuccess() {
         if (cursor.result) {
           // Here we check whether there is any message of the same sender.
           isnot(cursor.result.sender, message.sender, "cursor.result.sender");
@@ -110,19 +109,19 @@ function test_message_class_0() {
 
 function doTestMessageClassGeneric(allDCSs, messageClass, next) {
   function do_test(dcsIndex) {
     manager.addEventListener("received", function onReceived(event) {
       manager.removeEventListener("received", onReceived);
 
       // Make sure we can correctly receive the message
       checkMessage(event.message, null, null, messageClass);
-      ok(event.message.timestamp.getTime() >= timeBeforeSend,
+      ok(event.message.timestamp >= timeBeforeSend,
          "Message's timestamp should be greater then the timetamp of sending");
-      ok(event.message.timestamp.getTime() <= Date.now(),
+      ok(event.message.timestamp <= Date.now(),
          "Message's timestamp should be lesser than the timestamp of now");
 
       ++dcsIndex;
       if (dcsIndex >= allDCSs.length) {
         window.setTimeout(next, 0);
       } else {
         window.setTimeout(do_test.bind(null, dcsIndex), 0);
       }
@@ -165,19 +164,19 @@ function test_message_class_2() {
   ];
 
   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, null, null, "class-2");
-          ok(event.message.timestamp.getTime() >= timeBeforeSend,
+          ok(event.message.timestamp >= timeBeforeSend,
              "Message's timestamp should be greater then the timetamp of sending");
-          ok(event.message.timestamp.getTime() <= Date.now(),
+          ok(event.message.timestamp <= Date.now(),
              "Message's timestamp should be lesser than the timestamp of now");
 
           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
--- a/dom/mobilemessage/tests/marionette/test_outgoing.js
+++ b/dom/mobilemessage/tests/marionette/test_outgoing.js
@@ -38,20 +38,19 @@ function checkMessage(message, delivery,
   ok(message.id, "message.id");
   ok(message.threadId, "message.threadId");
   is(message.delivery, delivery, "message.delivery");
   is(message.deliveryStatus, "pending", "message.deliveryStatus");
   is(message.sender, SENDER, "message.sender");
   ok(message.receiver, "message.receiver");
   is(message.body, body, "message.body");
   is(message.messageClass, "normal", "message.messageClass");
-  ok(message.timestamp instanceof Date, "timestamp is instanceof Date");
 
   // TODO: bug 788928 - add test cases for deliverysuccess event.
-  ok(message.deliveryTimestamp === null, "deliveryTimestamp is null");
+  is(message.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
   is(message.read, true, "message.read");
 }
 
 function doSendMessageAndCheckSuccess(receivers, body, callback) {
   let options = {};
   let now = Date.now();
 
@@ -86,17 +85,17 @@ function doSendMessageAndCheckSuccess(re
       ok(false, "onsent should be called after onsending.");
       return;
     }
 
     let saved = opt.saved;
     is(message.id, saved.id, "message.id");
     is(message.receiver, saved.receiver, "message.receiver");
     is(message.body, saved.body, "message.body");
-    is(message.timestamp.getTime(), saved.timestamp.getTime(),
+    is(message.timestamp, saved.timestamp,
        "the messages got from onsent event and request result must be the same");
 
     opt[mark] = true;
 
     done();
   }
 
   function onRequestSuccess(event) {
@@ -115,17 +114,17 @@ function doSendMessageAndCheckSuccess(re
     // Bug 838542: following check throws an exception and fails this case.
     // ok(event instanceof MozSmsEvent,
     //    "event is instanceof " + event.constructor)
     ok(event, "event is valid");
 
     let message = event.message;
     checkMessage(message, "sending", body);
     // timestamp is in seconds.
-    ok(Math.floor(message.timestamp.getTime() / 1000) >= Math.floor(now / 1000),
+    ok(Math.floor(message.timestamp / 1000) >= Math.floor(now / 1000),
        "sent timestamp is valid");
 
     let receiver = message.receiver;
     if (!receiver) {
       return;
     }
 
     if (options[receiver]) {
--- a/dom/mobilemessage/tests/marionette/test_outgoing_delete.js
+++ b/dom/mobilemessage/tests/marionette/test_outgoing_delete.js
@@ -37,18 +37,17 @@ function sendSms() {
     ok(sentSms.threadId, "thread id");
     is(sentSms.body, msgText, "msg body");
     is(sentSms.delivery, "sent", "delivery");
     is(sentSms.deliveryStatus, "pending", "deliveryStatus");
     is(sentSms.read, true, "read");
     is(sentSms.receiver, RECEIVER, "receiver");
     is(sentSms.sender, SENDER, "sender");
     is(sentSms.messageClass, "normal", "messageClass");
-    ok(sentSms.timestamp instanceof Date, "timestamp is istanceof date");
-    ok(sentSms.deliveryTimestamp === null, "deliveryTimestamp is null");
+    is(sentSms.deliveryTimestamp, 0, "deliveryTimestamp is 0");
 
     if (gotSmsOnsent && gotReqOnsuccess) { verifySmsExists(smsId); }
   };
 
   let requestRet = manager.send(RECEIVER, msgText);
   ok(requestRet, "smsrequest obj returned");
 
   requestRet.onsuccess = function(event) {
--- a/dom/mobilemessage/tests/marionette/test_update_thread_record_in_delete.js
+++ b/dom/mobilemessage/tests/marionette/test_update_thread_record_in_delete.js
@@ -109,17 +109,17 @@ function deleteAllMessages() {
 }
 
 function checkThread(thread, id, body, unreadCount, timestamp)
 {
   is(thread.id, id, "Thread ID is set");
   is(thread.body, body, "Thread subject is set to last message body");
   is(thread.unreadCount, unreadCount, "Thread unread count");
   is(JSON.stringify(thread.participants), JSON.stringify([FROM]), "Thread participants");
-  is(thread.timestamp.getTime(), timestamp.getTime(), "Thread timestamp is set");
+  is(thread.timestamp, timestamp, "Thread timestamp is set");
 }
 
 tasks.push(deleteAllMessages);
 
 tasks.push(getAllThreads.bind(null, function (threads) {
   is(threads.length, 0, "Threads are cleared");
   tasks.next();
 }));
--- a/dom/mobilemessage/tests/test_smsservice_createsmsmessage.js
+++ b/dom/mobilemessage/tests/test_smsservice_createsmsmessage.js
@@ -39,18 +39,17 @@ add_test(function test_interface() {
   do_check_eq(sms.threadId, 0);
   do_check_eq(sms.iccId, ICC_ID);
   do_check_eq(sms.delivery, "sent");
   do_check_eq(sms.deliveryStatus, "success");
   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.deliveryTimestamp === null);
+  do_check_eq(sms.deliveryTimestamp, 0);
   do_check_true(sms.read);
   run_next_test();
 });
 
 /**
  * Test if ICC ID is null when it's not available.
  */
 add_test(function test_icc_id_not_available() {
@@ -61,18 +60,17 @@ add_test(function test_icc_id_not_availa
   do_check_eq(sms.threadId, 0);
   do_check_eq(sms.iccId, null);
   do_check_eq(sms.delivery, "sent");
   do_check_eq(sms.deliveryStatus, "success");
   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.deliveryTimestamp === null);
+  do_check_eq(sms.deliveryTimestamp, 0);
   do_check_true(sms.read);
   run_next_test();
 });
 
 /**
  * Verify that attributes are read-only.
  */
 add_test(function test_readonly_attributes() {
@@ -102,21 +100,21 @@ add_test(function test_readonly_attribut
 
   sms.body = "a body";
   do_check_eq(sms.body, null);
 
   sms.messageClass = "class-0";
   do_check_eq(sms.messageClass, "normal");
 
   let oldTimestamp = sms.timestamp;
-  sms.timestamp = new Date();
-  do_check_eq(sms.timestamp.getTime(), oldTimestamp.getTime());
+  sms.timestamp = Date.now();
+  do_check_eq(sms.timestamp, oldTimestamp);
 
   let oldDeliveryTimestamp = sms.deliveryTimestamp;
-  sms.deliveryTimestamp = new Date();
+  sms.deliveryTimestamp = Date.now();
   do_check_eq(sms.deliveryTimestamp, oldDeliveryTimestamp);
 
   sms.read = false;
   do_check_true(sms.read);
 
   run_next_test();
 });
 
@@ -131,19 +129,18 @@ add_test(function test_timestamp_number(
   do_check_eq(sms.threadId, 1);
   do_check_eq(sms.iccId, ICC_ID);
   do_check_eq(sms.delivery, "sent");
   do_check_eq(sms.deliveryStatus, "success");
   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.deliveryTimestamp === null);
+  do_check_eq(sms.timestamp, ts);
+  do_check_eq(sms.deliveryTimestamp, 0);
   do_check_true(sms.read);
   run_next_test();
 });
 
 /**
  * Test supplying the timestamp as a Date object.
  */
 add_test(function test_timestamp_date() {
@@ -154,19 +151,18 @@ add_test(function test_timestamp_date() 
   do_check_eq(sms.threadId, 1);
   do_check_eq(sms.iccId, ICC_ID);
   do_check_eq(sms.delivery, "sent");
   do_check_eq(sms.deliveryStatus, "success");
   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.deliveryTimestamp === null);
+  do_check_eq(sms.timestamp, date.getTime());
+  do_check_eq(sms.deliveryTimestamp, 0);
   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() {