2012-05-30 04:41:44 +04:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
2013-04-09 19:48:36 +04:00
|
|
|
MARIONETTE_TIMEOUT = 60000;
|
2014-06-25 07:57:21 +04:00
|
|
|
MARIONETTE_HEAD_JS = 'head.js';
|
2012-05-30 04:41:44 +04:00
|
|
|
|
2013-03-07 20:12:56 +04:00
|
|
|
const SENDER = "5555552368"; // the remote number
|
|
|
|
const RECEIVER = "15555215554"; // the emulator's number
|
2013-01-23 13:40:48 +04:00
|
|
|
|
2014-06-25 07:57:21 +04:00
|
|
|
const SHORT_BODY = "Hello SMS world!";
|
|
|
|
const LONG_BODY = new Array(17).join(SHORT_BODY);
|
|
|
|
ok(LONG_BODY.length > 160, "LONG_BODY.length");
|
|
|
|
|
|
|
|
function checkMessage(aMessage, aBody) {
|
2015-10-19 14:59:15 +03:00
|
|
|
ok(aMessage instanceof SmsMessage, "Message is instanceof SmsMessage");
|
2014-06-25 07:57:21 +04:00
|
|
|
|
|
|
|
is(aMessage.type, "sms", "message.type");
|
|
|
|
ok(aMessage.id, "message.id");
|
|
|
|
ok(aMessage.threadId, "message.threadId");
|
|
|
|
ok(aMessage.iccId, "message.iccId");
|
|
|
|
is(aMessage.delivery, "received", "message.delivery");
|
|
|
|
is(aMessage.deliveryStatus, "success", "message.deliveryStatus");
|
|
|
|
is(aMessage.sender, SENDER, "message.sender");
|
|
|
|
is(aMessage.receiver, RECEIVER, "message.receiver");
|
|
|
|
is(aMessage.body, aBody, "message.body");
|
|
|
|
is(aMessage.messageClass, "normal", "message.messageClass");
|
|
|
|
ok(aMessage.timestamp, "message.timestamp");
|
|
|
|
is(aMessage.deliveryTimestamp, 0, "message.deliveryTimestamp");
|
|
|
|
ok(aMessage.sentTimestamp, "message.sentTimestamp");
|
|
|
|
is(aMessage.read, false, "message.read");
|
2012-05-30 04:41:44 +04:00
|
|
|
};
|
|
|
|
|
2014-06-25 07:57:21 +04:00
|
|
|
function test(aBody) {
|
|
|
|
return sendTextSmsToEmulatorAndWait(SENDER, aBody)
|
|
|
|
.then((aMessage) => checkMessage(aMessage, aBody));
|
2012-05-30 04:41:44 +04:00
|
|
|
}
|
2014-06-25 07:57:21 +04:00
|
|
|
|
|
|
|
startTestBase(function testCaseMain() {
|
|
|
|
return ensureMobileMessage()
|
|
|
|
.then(() => test(SHORT_BODY))
|
|
|
|
.then(() => test(LONG_BODY));
|
|
|
|
});
|