Bug 859764 - Part 5: Changes in Test Cases. r=echen

This commit is contained in:
Bevis Tseng 2015-10-19 19:59:15 +08:00
Родитель 2e3d3848e7
Коммит bf6ef36a26
7 изменённых файлов: 14 добавлений и 22 удалений

Просмотреть файл

@ -236,7 +236,7 @@ function sendMmsWithFailure(aMmsParameters, aSendParameters) {
/**
* Retrieve message by message id.
*
* Fulfill params: MozSmsMessage
* Fulfill params: SmsMessage
* Reject params:
* event -- a DOMEvent
*
@ -481,7 +481,7 @@ function sendTextSmsToEmulator(aFrom, aText) {
/**
* Send simple text SMS to emulator and wait for a received event.
*
* Fulfill params: MozSmsMessage
* Fulfill params: SmsMessage
* Reject params: (none)
*
* @param aFrom

Просмотреть файл

@ -53,7 +53,7 @@ function saveMmsNotification() {
.saveReceivedMessage(notification, function(aRv, aDomMessage) {
log("saveReceivedMessage(): " + aRv);
if (Components.isSuccessCode(aRv)) {
deferred.resolve(aDomMessage);
deferred.resolve(aDomMessage.QueryInterface(Ci.nsIMmsMessage));
} else {
deferred.reject();
}

Просмотреть файл

@ -12,7 +12,7 @@ const LONG_BODY = new Array(17).join(SHORT_BODY);
ok(LONG_BODY.length > 160, "LONG_BODY.length");
function checkMessage(aMessage, aBody) {
ok(aMessage instanceof MozSmsMessage, "Message is instanceof MozSmsMessage");
ok(aMessage instanceof SmsMessage, "Message is instanceof SmsMessage");
is(aMessage.type, "sms", "message.type");
ok(aMessage.id, "message.id");

Просмотреть файл

@ -34,7 +34,7 @@ function sendSmsPduToEmulator(pdu) {
}
function checkMessage(message, id, threadId, messageClass) {
ok(message instanceof MozSmsMessage,
ok(message instanceof SmsMessage,
"message is instanceof " + message.constructor);
if (id == null) {
ok(message.id > 0, "message.id");

Просмотреть файл

@ -24,7 +24,7 @@ const LONG_BODY = "Let me not to the marriage of true minds\n"
function checkMessage(message, delivery, body) {
ok(message, "message is valid");
ok(message instanceof MozSmsMessage,
ok(message instanceof SmsMessage,
"message is instanceof " + message.constructor);
is(message.type, "sms", "message.type");

Просмотреть файл

@ -15,13 +15,14 @@
/** Test for WebSMS **/
// idl interfaces exposed to every page.
// TODO Bug 859764
const IDL_IFACE_WITH_PREFIX = ["SmsMessage", "MmsMessage", "MobileMessageThread"];
// webidl interfaces guarded by [AvailableIn=CertifiedApps].
const WEBIDL_IFACE_WITH_PREFIX = ["SmsEvent", "MmsEvent", "MessageDeletedEvent"];
const WEBIDL_IFACE = ["DOMMobileMessageError"];
const WEBIDL_IFACE = [
"DOMMobileMessageError",
"MmsMessage",
"MobileMessageThread",
"SmsMessage",
];
function checkSmsDisabled() {
ok(!('mozMobileMessage' in frames[0].navigator), "navigator.mozMobileMessage should not exist");
@ -42,14 +43,6 @@ function checkSmsEnabled() {
"navigator.mozMobileMessage is an MobileMessageManager object");
}
function checkIdlInterfaceInWindow() {
for (let i = 0; i < IDL_IFACE_WITH_PREFIX.length; i++) {
let iface = IDL_IFACE_WITH_PREFIX[i];
ok(!(iface in window), iface + " should be prefixed");
ok(("Moz" + iface) in window, iface + " should be prefixed");
}
}
function checkWebidlInterfaceInWindow() {
for (let i = 0; i < WEBIDL_IFACE_WITH_PREFIX.length; i++) {
let iface = WEBIDL_IFACE_WITH_PREFIX[i];
@ -77,7 +70,6 @@ function checkWebidlInterfaceNotInWindow() {
}
function test() {
checkIdlInterfaceInWindow();
checkWebidlInterfaceNotInWindow();
// If sms is disabled and permission is removed, sms is disabled.

Просмотреть файл

@ -34,7 +34,7 @@ function run_test() {
add_test(function test_interface() {
let sms = newMessage(null, null, ICC_ID, "sent", "success", null, null, null,
"normal", Date.now(), Date.now(), Date.now(), true);
do_check_true(sms instanceof Ci.nsIDOMMozSmsMessage);
do_check_true(sms instanceof Ci.nsISmsMessage);
do_check_eq(sms.id, 0);
do_check_eq(sms.threadId, 0);
do_check_eq(sms.iccId, ICC_ID);
@ -54,7 +54,7 @@ add_test(function test_interface() {
add_test(function test_icc_id_not_available() {
let sms = newMessage(null, null, null, "sent", "success", null, null, null,
"normal", Date.now(), Date.now(), Date.now(), true);
do_check_true(sms instanceof Ci.nsIDOMMozSmsMessage);
do_check_true(sms instanceof Ci.nsISmsMessage);
do_check_eq(sms.id, 0);
do_check_eq(sms.threadId, 0);
do_check_eq(sms.iccId, null);