mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 939302 - Test. r=vicamo
This commit is contained in:
parent
4429c0e19f
commit
b2029e5f18
@ -178,8 +178,7 @@ function getMsgs() {
|
||||
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);
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ function simulateIncomingSms() {
|
||||
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();
|
||||
};
|
||||
@ -77,9 +76,8 @@ function sendSms() {
|
||||
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(); }
|
||||
};
|
||||
@ -128,8 +126,7 @@ function getReceivedSms() {
|
||||
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();
|
||||
};
|
||||
|
||||
@ -162,8 +159,7 @@ function getSentSms() {
|
||||
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();
|
||||
};
|
||||
|
||||
|
@ -201,8 +201,7 @@ function verifyFoundMsgs(foundSmsList, reverse) {
|
||||
}
|
||||
|
||||
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.");
|
||||
|
@ -153,8 +153,6 @@ function checkThread(bodies, lastBody, unreadCount, participants,
|
||||
"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;
|
||||
|
@ -35,8 +35,7 @@ manager.onreceived = function onreceived(event) {
|
||||
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();
|
||||
};
|
||||
|
@ -36,8 +36,7 @@ function simulateIncomingSms() {
|
||||
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);
|
||||
};
|
||||
|
@ -44,8 +44,7 @@ function simulateIncomingSms() {
|
||||
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);
|
||||
};
|
||||
|
@ -40,8 +40,7 @@ function simulateIncomingSms() {
|
||||
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);
|
||||
};
|
||||
|
@ -145,8 +145,7 @@ tasks.push(function init() {
|
||||
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);
|
||||
};
|
||||
|
@ -49,8 +49,7 @@ function checkMessage(message, id, threadId, messageClass) {
|
||||
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");
|
||||
}
|
||||
|
||||
@ -67,9 +66,9 @@ function test_message_class_0() {
|
||||
|
||||
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.
|
||||
@ -115,9 +114,9 @@ function doTestMessageClassGeneric(allDCSs, messageClass, next) {
|
||||
|
||||
// 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;
|
||||
@ -170,9 +169,9 @@ function test_message_class_2() {
|
||||
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();
|
||||
|
@ -43,10 +43,9 @@ function checkMessage(message, delivery, body) {
|
||||
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");
|
||||
}
|
||||
@ -91,7 +90,7 @@ function doSendMessageAndCheckSuccess(receivers, body, callback) {
|
||||
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;
|
||||
@ -120,7 +119,7 @@ function doSendMessageAndCheckSuccess(receivers, body, callback) {
|
||||
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;
|
||||
|
@ -42,8 +42,7 @@ function sendSms() {
|
||||
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); }
|
||||
};
|
||||
|
@ -114,7 +114,7 @@ function checkThread(thread, id, body, unreadCount, timestamp)
|
||||
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);
|
||||
|
@ -44,8 +44,7 @@ add_test(function test_interface() {
|
||||
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();
|
||||
});
|
||||
@ -66,8 +65,7 @@ add_test(function test_icc_id_not_available() {
|
||||
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();
|
||||
});
|
||||
@ -107,11 +105,11 @@ add_test(function test_readonly_attributes() {
|
||||
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;
|
||||
@ -136,9 +134,8 @@ add_test(function test_timestamp_number() {
|
||||
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();
|
||||
});
|
||||
@ -159,9 +156,8 @@ add_test(function test_timestamp_date() {
|
||||
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();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user