mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 878533 - 2/3: fix test cases. r=gene, r=smaug
This commit is contained in:
parent
2e60f5d9ec
commit
c811304686
@ -243,18 +243,17 @@ function getMessage(aId) {
|
||||
* Reject params:
|
||||
* event -- a DOMEvent
|
||||
*
|
||||
* @param aFilter an optional MozSmsFilter instance.
|
||||
* @param aReverse a boolean value indicating whether the order of the messages
|
||||
* should be reversed.
|
||||
* @param aFilter [optional]
|
||||
* A MobileMessageFilter object.
|
||||
* @param aReverse [optional]
|
||||
* A boolean value indicating whether the order of the message should be
|
||||
* reversed. Default: false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function getMessages(aFilter, aReverse) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
if (!aFilter) {
|
||||
aFilter = new MozSmsFilter;
|
||||
}
|
||||
let messages = [];
|
||||
let cursor = manager.getMessages(aFilter, aReverse || false);
|
||||
cursor.onsuccess = function(aEvent) {
|
||||
|
@ -328,8 +328,21 @@ function createMmdbCursor(aMmdb, aMethodName) {
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function createMessageCursor(aMmdb, aFilter, aReverse) {
|
||||
return createMmdbCursor(aMmdb, "createMessageCursor", aFilter, aReverse);
|
||||
function createMessageCursor(aMmdb, aStartDate = null, aEndDate = null,
|
||||
aNumbers = null, aDelivery = null, aRead = null,
|
||||
aThreadId = null, aReverse = false) {
|
||||
return createMmdbCursor(aMmdb, "createMessageCursor",
|
||||
aStartDate !== null,
|
||||
aStartDate || 0,
|
||||
aEndDate !== null,
|
||||
aEndDate || 0,
|
||||
aNumbers || null,
|
||||
aNumbers && aNumbers.length || 0,
|
||||
aDelivery || null,
|
||||
aRead !== null,
|
||||
aRead || false,
|
||||
aThreadId || 0,
|
||||
aReverse || false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,11 +24,11 @@ function simulateIncomingSms() {
|
||||
}
|
||||
|
||||
function test(aStartDate, aEndDate, aExpectedMessages) {
|
||||
let filter = new MozSmsFilter();
|
||||
if (aStartDate) {
|
||||
let filter = {};
|
||||
if (aStartDate !== null) {
|
||||
filter.startDate = aStartDate;
|
||||
}
|
||||
if (aEndDate) {
|
||||
if (aEndDate !== null) {
|
||||
filter.endDate = aEndDate;
|
||||
}
|
||||
|
||||
@ -64,16 +64,16 @@ startTestCommon(function testCaseMain() {
|
||||
// Should return all messages.
|
||||
//
|
||||
.then(() => log("Testing [startTime, )"))
|
||||
.then(() => test(new Date(startTime), null, allMessages))
|
||||
.then(() => test(startTime, null, allMessages))
|
||||
.then(() => log("Testing (, endTime]"))
|
||||
.then(() => test(null, new Date(endTime), allMessages))
|
||||
.then(() => test(null, endTime, allMessages))
|
||||
.then(() => log("Testing [startTime, endTime]"))
|
||||
.then(() => test(new Date(startTime), new Date(endTime), allMessages))
|
||||
.then(() => test(startTime, endTime, allMessages))
|
||||
|
||||
// Should return only messages with timestamp <= startTime.
|
||||
//
|
||||
.then(() => log("Testing [, startTime)"))
|
||||
.then(() => test(null, new Date(startTime),
|
||||
.then(() => test(null, startTime,
|
||||
reduceMessages(allMessages,
|
||||
(function(a, b) {
|
||||
return b <= a;
|
||||
@ -82,7 +82,7 @@ startTestCommon(function testCaseMain() {
|
||||
// Should return only messages with timestamp <= startTime + 1.
|
||||
//
|
||||
.then(() => log("Testing [, startTime + 1)"))
|
||||
.then(() => test(null, new Date(startTime + 1),
|
||||
.then(() => test(null, startTime + 1,
|
||||
reduceMessages(allMessages,
|
||||
(function(a, b) {
|
||||
return b <= a;
|
||||
@ -91,7 +91,7 @@ startTestCommon(function testCaseMain() {
|
||||
// Should return only messages with timestamp >= endTime.
|
||||
//
|
||||
.then(() => log("Testing [endTime, )"))
|
||||
.then(() => test(new Date(endTime), null,
|
||||
.then(() => test(endTime, null,
|
||||
reduceMessages(allMessages,
|
||||
(function(a, b) {
|
||||
return b >= a;
|
||||
@ -100,7 +100,7 @@ startTestCommon(function testCaseMain() {
|
||||
// Should return only messages with timestamp >= endTime - 1.
|
||||
//
|
||||
.then(() => log("Testing [endTime - 1, )"))
|
||||
.then(() => test(new Date(endTime - 1), null,
|
||||
.then(() => test(endTime - 1, null,
|
||||
reduceMessages(allMessages,
|
||||
(function(a, b) {
|
||||
return b >= a;
|
||||
@ -109,11 +109,11 @@ startTestCommon(function testCaseMain() {
|
||||
// Should return none.
|
||||
//
|
||||
.then(() => log("Testing [endTime + 1, )"))
|
||||
.then(() => test(new Date(endTime + 1), null, []))
|
||||
.then(() => test(endTime + 1, null, []))
|
||||
.then(() => log("Testing [endTime + 1, endTime + 86400000]"))
|
||||
.then(() => test(new Date(endTime + 1), new Date(endTime + 86400000), []))
|
||||
.then(() => test(endTime + 1, endTime + 86400000, []))
|
||||
.then(() => log("Testing (, startTime - 1]"))
|
||||
.then(() => test(null, new Date(startTime - 1), []))
|
||||
.then(() => test(null, startTime - 1, []))
|
||||
.then(() => log("Testing [startTime - 86400000, startTime - 1]"))
|
||||
.then(() => test(new Date(startTime - 86400000), new Date(startTime - 1), []));
|
||||
.then(() => test(startTime - 86400000, startTime - 1, []));
|
||||
});
|
||||
|
@ -59,9 +59,6 @@ let tasks = {
|
||||
};
|
||||
|
||||
function getAllMessages(callback, filter, reverse) {
|
||||
if (!filter) {
|
||||
filter = new MozSmsFilter;
|
||||
}
|
||||
let messages = [];
|
||||
let request = manager.getMessages(filter, reverse || false);
|
||||
request.onsuccess = function(event) {
|
||||
@ -182,9 +179,10 @@ tasks.push(function assignInvalidThreadID() {
|
||||
|
||||
tasks.push(function testDeliveryAndNumber() {
|
||||
log("Checking delivery == sent && number == 5555315550");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.delivery = "sent";
|
||||
filter.numbers = ["5555315550"];
|
||||
let filter = {
|
||||
delivery: "sent",
|
||||
numbers: ["5555315550"],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// Only { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
is(messages.length, 1, "message count");
|
||||
@ -209,9 +207,10 @@ tasks.push(function testDeliveryAndNumber() {
|
||||
|
||||
tasks.push(function testDeliveryAndNumberNotFound() {
|
||||
log("Checking delivery == sent && number == INVALID_NUMBER");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.delivery = "sent";
|
||||
filter.numbers = [INVALID_NUMBER];
|
||||
let filter = {
|
||||
delivery: "sent",
|
||||
numbers: [INVALID_NUMBER],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, 0, "message count");
|
||||
|
||||
@ -221,9 +220,10 @@ tasks.push(function testDeliveryAndNumberNotFound() {
|
||||
|
||||
tasks.push(function testDeliveryAndRead() {
|
||||
log("Checking delivery == received && read == true");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.delivery = "received";
|
||||
filter.read = true;
|
||||
let filter = {
|
||||
delivery: "received",
|
||||
read: true,
|
||||
}
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "received", sender: "5555315550", read: true },
|
||||
// { delivery: "received", sender: "5555315552", read: true },
|
||||
@ -250,9 +250,10 @@ tasks.push(function testDeliveryAndRead() {
|
||||
|
||||
tasks.push(function testDeliveryAndReadNotFound() {
|
||||
log("Checking delivery == sent && read == false");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.delivery = "sent";
|
||||
filter.read = false;
|
||||
let filter = {
|
||||
delivery: "sent",
|
||||
read: false,
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, 0, "message count");
|
||||
|
||||
@ -262,9 +263,10 @@ tasks.push(function testDeliveryAndReadNotFound() {
|
||||
|
||||
tasks.push(function testDeliveryAndThreadId() {
|
||||
log("Checking delivery == received && threadId == " + threadIds[0]);
|
||||
let filter = new MozSmsFilter();
|
||||
filter.delivery = "sent";
|
||||
filter.threadId = threadIds[0];
|
||||
let filter = {
|
||||
delivery: "sent",
|
||||
threadId: threadIds[0],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", threadId: threadIds[0]}
|
||||
is(messages.length, 1, "message count");
|
||||
@ -287,9 +289,10 @@ tasks.push(function testDeliveryAndThreadId() {
|
||||
|
||||
tasks.push(function testDeliveryAndThreadIdNotFound() {
|
||||
log("Checking delivery == sent && threadId == INVALID_THREAD_ID");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.delivery = "sent";
|
||||
filter.threadId = INVALID_THREAD_ID;
|
||||
let filter = {
|
||||
delivery: "sent",
|
||||
threadId: INVALID_THREAD_ID,
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, 0, "message count");
|
||||
|
||||
@ -299,9 +302,10 @@ tasks.push(function testDeliveryAndThreadIdNotFound() {
|
||||
|
||||
tasks.push(function testNumberAndRead() {
|
||||
log("Checking number == 5555315550 && read == true");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = ["5555315550"];
|
||||
filter.read = true;
|
||||
let filter = {
|
||||
numbers: ["5555315550"],
|
||||
read: true,
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -327,9 +331,10 @@ tasks.push(function testNumberAndRead() {
|
||||
|
||||
tasks.push(function testNumberAndReadNotFound() {
|
||||
log("Checking number == INVALID_NUMBER && read == true");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = [INVALID_NUMBER];
|
||||
filter.read = true;
|
||||
let filter = {
|
||||
numbers: [INVALID_NUMBER],
|
||||
read: true,
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, 0, "message count");
|
||||
|
||||
@ -339,9 +344,10 @@ tasks.push(function testNumberAndReadNotFound() {
|
||||
|
||||
tasks.push(function testNumberAndThreadId() {
|
||||
log("Checking number == 5555315550 && threadId == " + threadIds[0]);
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = ["5555315550"];
|
||||
filter.threadId = threadIds[0];
|
||||
let filter = {
|
||||
numbers: ["5555315550"],
|
||||
threadId: threadIds[0],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -367,9 +373,10 @@ tasks.push(function testNumberAndThreadId() {
|
||||
|
||||
tasks.push(function testNumberAndThreadIdNotFound() {
|
||||
log("Checking number == INVALID_NUMBER && threadId == INVALID_THREAD_ID");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = [INVALID_NUMBER];
|
||||
filter.threadId = INVALID_THREAD_ID;
|
||||
let filter = {
|
||||
numbers: [INVALID_NUMBER],
|
||||
threadId: INVALID_THREAD_ID,
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, 0, "message count");
|
||||
|
||||
@ -379,8 +386,9 @@ tasks.push(function testNumberAndThreadIdNotFound() {
|
||||
|
||||
tasks.push(function testMultipleNumbers() {
|
||||
log("Checking number == 5555315550 || number == 5555315551");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = ["5555315550", "5555315551"];
|
||||
let filter = {
|
||||
numbers: ["5555315550", "5555315551"],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -401,8 +409,9 @@ tasks.push(function testMultipleNumbers() {
|
||||
|
||||
tasks.push(function testMultipleNumbersNotFound() {
|
||||
log("Checking number == INVALID_NUMBER || number == INVALID_NUMBER2");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = [INVALID_NUMBER, INVALID_NUMBER2];
|
||||
let filter = {
|
||||
numbers: [INVALID_NUMBER, INVALID_NUMBER2],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, 0, "message count");
|
||||
|
||||
@ -412,9 +421,10 @@ tasks.push(function testMultipleNumbersNotFound() {
|
||||
|
||||
tasks.push(function testDeliveryAndMultipleNumbers() {
|
||||
log("Checking delivery == sent && (number == 5555315550 || number == 5555315551)");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.delivery = "sent";
|
||||
filter.numbers = ["5555315550", "5555315551"];
|
||||
let filter = {
|
||||
delivery: "sent",
|
||||
numbers: ["5555315550", "5555315551"],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "sent", receiver: "+15555315551", read: true }
|
||||
@ -434,9 +444,10 @@ tasks.push(function testDeliveryAndMultipleNumbers() {
|
||||
|
||||
tasks.push(function testMultipleNumbersAndRead() {
|
||||
log("Checking (number == 5555315550 || number == 5555315551) && read == true");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = ["5555315550", "5555315551"];
|
||||
filter.read = true;
|
||||
let filter = {
|
||||
numbers: ["5555315550", "5555315551"],
|
||||
read: true,
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -457,9 +468,10 @@ tasks.push(function testMultipleNumbersAndRead() {
|
||||
|
||||
tasks.push(function testMultipleNumbersAndThreadId() {
|
||||
log("Checking (number == 5555315550 || number == 5555315551) && threadId == " + threadIds[0]);
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = ["5555315550", "5555315551"];
|
||||
filter.threadId = threadIds[0];
|
||||
let filter = {
|
||||
numbers: ["5555315550", "5555315551"],
|
||||
threadId: threadIds[0],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -479,8 +491,9 @@ tasks.push(function testMultipleNumbersAndThreadId() {
|
||||
|
||||
tasks.push(function testNationalNumber() {
|
||||
log("Checking number = 5555315550");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = ["5555315550"];
|
||||
let filter = {
|
||||
numbers: ["5555315550"],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -498,8 +511,9 @@ tasks.push(function testNationalNumber() {
|
||||
|
||||
tasks.push(function testInternationalNumber() {
|
||||
log("Checking number = +15555315550");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = ["+15555315550"];
|
||||
let filter = {
|
||||
numbers: ["+15555315550"],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -517,9 +531,10 @@ tasks.push(function testInternationalNumber() {
|
||||
|
||||
tasks.push(function testReadAndThreadId() {
|
||||
log("Checking read == true && threadId == " + threadIds[0]);
|
||||
let filter = new MozSmsFilter();
|
||||
filter.read = true;
|
||||
filter.threadId = threadIds[0];
|
||||
let filter = {
|
||||
read: true,
|
||||
threadId: threadIds[0],
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
// { delivery: "sent", receiver: "+15555315550", read: true }
|
||||
// { delivery: "received", sender: "5555315550", read: true }
|
||||
@ -543,9 +558,10 @@ tasks.push(function testReadAndThreadId() {
|
||||
|
||||
tasks.push(function testReadAndThreadIdNotFound() {
|
||||
log("Checking read == true && threadId == INVALID_THREAD_ID");
|
||||
let filter = new MozSmsFilter();
|
||||
filter.read = true;
|
||||
filter.threadId = INVALID_THREAD_ID;
|
||||
let filter = {
|
||||
read: true,
|
||||
threadId: INVALID_THREAD_ID,
|
||||
};
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, 0, "message count");
|
||||
|
||||
|
@ -28,8 +28,7 @@ function genFailingMms(aReceivers) {
|
||||
function checkMessage(aNeedle, aValidNumbers) {
|
||||
log(" Verifying " + aNeedle);
|
||||
|
||||
let filter = new MozSmsFilter();
|
||||
filter.numbers = [aNeedle];
|
||||
let filter = { numbers: [aNeedle] };
|
||||
return getMessages(filter)
|
||||
.then(function(messages) {
|
||||
// Check the messages are sent to/received from aValidNumbers.
|
||||
|
@ -20,9 +20,8 @@ function verifyInitialState() {
|
||||
|
||||
function deleteAllMsgs(nextFunction) {
|
||||
let msgList = new Array();
|
||||
let filter = new MozSmsFilter;
|
||||
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
let cursor = manager.getMessages();
|
||||
ok(cursor instanceof DOMCursor,
|
||||
"cursor is instanceof " + cursor.constructor);
|
||||
|
||||
@ -162,11 +161,10 @@ function markMsgRead(smsMsgs) {
|
||||
}
|
||||
|
||||
function getMsgs() {
|
||||
var filter = new MozSmsFilter();
|
||||
let foundSmsList = new Array();
|
||||
|
||||
// Set filter for read messages
|
||||
filter.read = true;
|
||||
let filter = { read: true };
|
||||
|
||||
log("Getting the read SMS messages.");
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
|
@ -20,9 +20,8 @@ function verifyInitialState() {
|
||||
|
||||
function deleteAllMsgs(nextFunction) {
|
||||
let msgList = new Array();
|
||||
let filter = new MozSmsFilter;
|
||||
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
let cursor = manager.getMessages();
|
||||
ok(cursor instanceof DOMCursor,
|
||||
"cursor is instanceof " + cursor.constructor);
|
||||
|
||||
@ -174,11 +173,10 @@ function sendSms() {
|
||||
}
|
||||
|
||||
function getMsgs() {
|
||||
var filter = new MozSmsFilter();
|
||||
let foundSmsList = new Array();
|
||||
|
||||
// Set filter for received messages
|
||||
filter.delivery = "received";
|
||||
let filter = { delivery: "received" };
|
||||
|
||||
log("Getting the received SMS messages.");
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
|
@ -20,9 +20,8 @@ function verifyInitialState() {
|
||||
|
||||
function deleteAllMsgs(nextFunction) {
|
||||
let msgList = new Array();
|
||||
let filter = new MozSmsFilter;
|
||||
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
let cursor = manager.getMessages();
|
||||
ok(cursor instanceof DOMCursor,
|
||||
"cursor is instanceof " + cursor.constructor);
|
||||
|
||||
@ -171,11 +170,10 @@ manager.onreceived = function onreceived(event) {
|
||||
};
|
||||
|
||||
function getMsgs() {
|
||||
var filter = new MozSmsFilter();
|
||||
let foundSmsList = new Array();
|
||||
|
||||
// Set filter for sent messages
|
||||
filter.delivery = "sent";
|
||||
let filter = { delivery: "sent" };
|
||||
|
||||
log("Getting the sent SMS messages.");
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
|
@ -20,9 +20,8 @@ function verifyInitialState() {
|
||||
|
||||
function deleteAllMsgs(nextFunction) {
|
||||
let msgList = new Array();
|
||||
let filter = new MozSmsFilter;
|
||||
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
let cursor = manager.getMessages();
|
||||
ok(cursor instanceof DOMCursor,
|
||||
"cursor is instanceof " + cursor.constructor);
|
||||
|
||||
@ -156,11 +155,10 @@ function markMsgRead() {
|
||||
}
|
||||
|
||||
function getMsgs() {
|
||||
var filter = new MozSmsFilter();
|
||||
let foundSmsList = new Array();
|
||||
|
||||
// Set filter for read messages
|
||||
filter.read = false;
|
||||
let filter = { read: false };
|
||||
|
||||
log("Getting the unread SMS messages.");
|
||||
let cursor = manager.getMessages(filter, false);
|
||||
|
@ -56,9 +56,6 @@ let tasks = {
|
||||
};
|
||||
|
||||
function getAllMessages(callback, filter, reverse) {
|
||||
if (!filter) {
|
||||
filter = new MozSmsFilter;
|
||||
}
|
||||
let messages = [];
|
||||
let request = manager.getMessages(filter, reverse || false);
|
||||
request.onsuccess = function(event) {
|
||||
@ -154,8 +151,7 @@ function checkThread(bodies, lastBody, unreadCount, participants,
|
||||
}
|
||||
|
||||
// Check whether the thread does contain all the messages it supposed to have.
|
||||
let filter = new MozSmsFilter;
|
||||
filter.threadId = thread.id;
|
||||
let filter = { threadId: thread.id };
|
||||
getAllMessages(function(messages) {
|
||||
is(messages.length, bodies.length, "messages.length and bodies.length");
|
||||
|
||||
|
@ -44,9 +44,6 @@ let tasks = {
|
||||
let manager;
|
||||
|
||||
function getAllMessages(callback, filter, reverse) {
|
||||
if (!filter) {
|
||||
filter = new MozSmsFilter;
|
||||
}
|
||||
let messages = [];
|
||||
let request = manager.getMessages(filter, reverse || false);
|
||||
request.onsuccess = function(event) {
|
||||
|
@ -76,7 +76,7 @@ function test_message_class_0() {
|
||||
"Message's sentTimestamp should be equal to SENT_TIMESTAMP");
|
||||
|
||||
// Make sure the message is not stored.
|
||||
let cursor = manager.getMessages(null, false);
|
||||
let cursor = manager.getMessages();
|
||||
cursor.onsuccess = function onsuccess() {
|
||||
if (cursor.result) {
|
||||
// Here we check whether there is any message of the same sender.
|
||||
|
@ -165,7 +165,7 @@ function testCreateMessageCursor(aMmdb) {
|
||||
log("testCreateMessageCursor()");
|
||||
|
||||
setStorageFull(true);
|
||||
return createMessageCursor(aMmdb, {}, false)
|
||||
return createMessageCursor(aMmdb)
|
||||
.then(() => setStorageFull(false));
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ function doVerifyDatabase(aMmdb, aExpected) {
|
||||
is(aExpected.length, 0, "remaining unmatched threads");
|
||||
|
||||
// 5) retrieve all messages.
|
||||
return createMessageCursor(aMmdb, {})
|
||||
return createMessageCursor(aMmdb)
|
||||
.then(function(aValues) {
|
||||
let [errorCode, domMessages] = aValues;
|
||||
is(errorCode, 0, "errorCode");
|
||||
|
@ -44,9 +44,6 @@ let tasks = {
|
||||
let manager;
|
||||
|
||||
function getAllMessages(callback, filter, reverse) {
|
||||
if (!filter) {
|
||||
filter = new MozSmsFilter;
|
||||
}
|
||||
let messages = [];
|
||||
let request = manager.getMessages(filter, reverse || false);
|
||||
request.onsuccess = function(event) {
|
||||
|
@ -52,9 +52,6 @@ let tasks = {
|
||||
};
|
||||
|
||||
function getAllMessages(callback, filter, reverse) {
|
||||
if (!filter) {
|
||||
filter = new MozSmsFilter;
|
||||
}
|
||||
let messages = [];
|
||||
let request = manager.getMessages(filter, reverse || false);
|
||||
request.onsuccess = function(event) {
|
||||
|
@ -60,9 +60,6 @@ let tasks = {
|
||||
};
|
||||
|
||||
function getAllMessages(callback, filter, reverse) {
|
||||
if (!filter) {
|
||||
filter = new MozSmsFilter;
|
||||
}
|
||||
let messages = [];
|
||||
let cursor = manager.getMessages(filter, reverse || false);
|
||||
cursor.onsuccess = function(event) {
|
||||
|
@ -3,4 +3,3 @@ skip-if = e10s
|
||||
|
||||
[test_sms_basics.html]
|
||||
skip-if = toolkit == 'android' #Bug 909036
|
||||
[test_smsfilter.html]
|
||||
|
@ -50,7 +50,6 @@ function checkInterface(aInterface) {
|
||||
function test() {
|
||||
checkInterface("SmsMessage");
|
||||
checkInterface("SmsEvent");
|
||||
checkInterface("SmsFilter");
|
||||
|
||||
// If sms is disabled and permission is removed, sms is disabled.
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.sms.enabled", false]]}, function() {
|
||||
|
@ -1,90 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test SmsFilter</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test SmsFilter **/
|
||||
|
||||
function throwingCheck(aFilter, aProperty, disallowedValue)
|
||||
{
|
||||
disallowedValue.forEach(function(v) {
|
||||
var exception = false;
|
||||
try {
|
||||
aFilter[aProperty] = v;
|
||||
} catch (e) {
|
||||
exception = true;
|
||||
}
|
||||
ok(exception, "An exception should have been thrown");
|
||||
});
|
||||
}
|
||||
|
||||
var filter = new MozSmsFilter();
|
||||
|
||||
isnot(filter, null, "filter should be set");
|
||||
|
||||
is(filter.startDate, null, "Parameters shouldn't be initialized");
|
||||
is(filter.endDate, null, "Parameters shouldn't be initialized");
|
||||
is(filter.numbers, null, "Parameters shouldn't be initialized");
|
||||
is(filter.delivery, null, "Parameters shouldn't be initialized");
|
||||
is(filter.read, null, "Parameters shouldn't be initialized");
|
||||
is(filter.threadId, null, "Parameters shouldn't be initialized");
|
||||
|
||||
var date = new Date();
|
||||
filter.startDate = date;
|
||||
is(filter.startDate, "" + date, "Setters and getters should work!");
|
||||
filter.startDate = null;
|
||||
is(filter.startDate, null, "null should revert the value to default");
|
||||
throwingCheck(filter, 'startDate', [ "foo", 42, [1, 2], function () {}, undefined ]);
|
||||
|
||||
filter.endDate = date;
|
||||
is(filter.endDate, "" + date, "Setters and getters should work!");
|
||||
filter.endDate = null;
|
||||
is(filter.endDate, null, "null should revert the value to default");
|
||||
throwingCheck(filter, 'endDate', [ "foo", 42, [1, 2], function () {}, undefined ]);
|
||||
|
||||
var numbers = [ "foo", "bar" ];
|
||||
filter.numbers = numbers;
|
||||
is(filter.numbers, "" + numbers, "Setters and getters should work!");
|
||||
filter.numbers = null;
|
||||
is(filter.numbers, null, "null should revert the value to default");
|
||||
throwingCheck(filter, 'numbers', [ "foo", 42, function () {}, new Date(), undefined ]);
|
||||
|
||||
filter.delivery = "sent";
|
||||
is(filter.delivery, "sent", "Setters and getters should work!");
|
||||
filter.delivery = "received";
|
||||
is(filter.delivery, "received", "Setters and getters should work!");
|
||||
filter.delivery = "";
|
||||
is(filter.delivery, null, "The empty string should revert the value to default.");
|
||||
filter.delivery = null;
|
||||
is(filter.delivery, null, "'null' should revert the value to default.");
|
||||
throwingCheck(filter, 'delivery', [ "foo", 42, [1, 2], function () {}, new Date(), undefined ]);
|
||||
|
||||
filter.read = true;
|
||||
is(filter.read, true, "Setters and getters should work!");
|
||||
filter.read = false;
|
||||
is(filter.read, false, "Setters and getters should work!");
|
||||
filter.read = null;
|
||||
is(filter.read, null, "'null' should revert the value to default");
|
||||
throwingCheck(filter, 'read', [ "foo", 0, [1, 2], function () {}, new Date(), undefined ]);
|
||||
|
||||
filter.threadId = 1;
|
||||
is(filter.threadId, 1, "Setters and getters should work!");
|
||||
filter.threadId = null;
|
||||
is(filter.threadId, null, "'null' should revert the value to default");
|
||||
throwingCheck(filter, 'threadId', [ "foo", 0, 1.5, [1, 2], function () {}, new Date(), undefined ]);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -702,8 +702,6 @@ var interfaceNamesInGlobalScope =
|
||||
"MozSettingsEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"MozSmsEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"MozSmsFilter",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"MozSmsMessage",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
Loading…
Reference in New Issue
Block a user