2012-07-18 20:27:35 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
const MARIONETTE_TIMEOUT = 60000;
|
|
|
|
const MARIONETTE_HEAD_JS = 'head.js';
|
2012-07-18 20:27:35 -07:00
|
|
|
|
|
|
|
// TODO: Add tests for store/discard once they are implemented
|
|
|
|
// See RadioInterfaceLayer.js / Bug #768441
|
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
function checkEventStatus(aEvent, aServiceId, aHasMessages, aMessageCount,
|
|
|
|
aReturnNumber, aReturnMessage) {
|
|
|
|
let status = aEvent.status;
|
|
|
|
ok(true, "status = " + JSON.stringify(status));
|
|
|
|
ok(status instanceof MozVoicemailStatus);
|
2012-07-18 20:27:35 -07:00
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
checkVoicemailStatus(status, 0, aHasMessages, aMessageCount, aReturnNumber,
|
|
|
|
aReturnMessage);
|
2012-07-18 20:27:35 -07:00
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
compareVoicemailStatus(voicemail.getStatus(0), status);
|
|
|
|
compareVoicemailStatus(voicemail.getStatus(), status);
|
2012-07-18 20:27:35 -07:00
|
|
|
}
|
|
|
|
|
2014-10-21 02:25:32 -07:00
|
|
|
function testLevel2Discard(aActive) {
|
2014-09-25 22:00:25 -07:00
|
|
|
log(" Active: " + aActive);
|
2012-07-18 20:27:35 -07:00
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
let sender = "+15125551235";
|
|
|
|
let body = "1 new voicemail";
|
|
|
|
let pdu = PDUBuilder.buildLevel2DiscardMwi(aActive, sender, body);
|
|
|
|
return sendIndicatorPDUAndWait(pdu)
|
|
|
|
.then((aResults) => checkEventStatus(aResults[0], 0, aActive,
|
|
|
|
(aActive ? -1 : 0), sender, body));
|
2012-07-18 20:27:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Tests for Level 3 MWI with a message count in the User Data Header
|
2014-10-21 02:25:32 -07:00
|
|
|
function testLevel3Discard(aMessageCount, aBody) {
|
|
|
|
log(" Message Count: " + aMessageCount + ", Body: " + aBody);
|
2014-09-25 22:00:25 -07:00
|
|
|
|
|
|
|
let sender = "+15125551236";
|
2014-10-21 02:25:32 -07:00
|
|
|
let pdu = PDUBuilder.buildLevel3DiscardMwi(aMessageCount, sender, aBody);
|
2014-09-25 22:00:25 -07:00
|
|
|
return sendIndicatorPDUAndWait(pdu)
|
|
|
|
.then((aResults) => checkEventStatus(aResults[0], 0, !!aMessageCount,
|
2014-10-21 02:25:32 -07:00
|
|
|
aMessageCount, sender, aBody));
|
2012-07-18 20:27:35 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
startTestCommon(function() {
|
|
|
|
return Promise.resolve()
|
2012-07-18 20:27:35 -07:00
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
.then(() => log("Testing Message Waiting Indication Group"))
|
|
|
|
// Level 2 discarded active/inactive MWI.
|
|
|
|
.then(() => log(" Discard Message"))
|
2014-10-21 02:25:32 -07:00
|
|
|
.then(() => testLevel2Discard(true))
|
|
|
|
.then(() => testLevel2Discard(false))
|
2012-07-18 20:27:35 -07:00
|
|
|
|
2014-09-25 22:00:25 -07:00
|
|
|
.then(() => log("Testing Special SMS Message Indication"))
|
|
|
|
.then(() => log(" Discard Message"))
|
|
|
|
// Level 3 discarded active/inactive MWI.
|
2014-10-21 02:25:32 -07:00
|
|
|
.then(() => testLevel3Discard(3, "3 voicemails"))
|
|
|
|
.then(() => testLevel3Discard(0, "0 voicemail"))
|
|
|
|
.then(() => testLevel3Discard(3, null))
|
|
|
|
.then(() => testLevel3Discard(0, null));
|
2014-09-25 22:00:25 -07:00
|
|
|
});
|