forked from mirrors/gecko-dev
Bug 1423843 - Enabled ESLint for dom/notification/test/unit r=Standard8,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D8026 --HG-- rename : dom/notification/test/unit/common_test_notificationdb.js => dom/notification/test/unit/head_notificationdb.js extra : moz-landing-system : lando
This commit is contained in:
parent
5ac9f0bc48
commit
913897bf8b
5 changed files with 21 additions and 22 deletions
|
|
@ -212,7 +212,6 @@ dom/midi/**
|
||||||
dom/network/**
|
dom/network/**
|
||||||
dom/notification/Notification*.*
|
dom/notification/Notification*.*
|
||||||
dom/notification/test/browser/**
|
dom/notification/test/browser/**
|
||||||
dom/notification/test/unit/**
|
|
||||||
dom/notification/test/mochitest/**
|
dom/notification/test/mochitest/**
|
||||||
dom/offline/**
|
dom/offline/**
|
||||||
dom/payments/**
|
dom/payments/**
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
function getNotificationObject(app, id, tag) {
|
function getNotificationObject(app, id, tag) {
|
||||||
return {
|
return {
|
||||||
origin: "https://" + app + ".gaiamobile.org/",
|
origin: "https://" + app + ".gaiamobile.org/",
|
||||||
id: id,
|
id,
|
||||||
title: app + "Notification:" + Date.now(),
|
title: app + "Notification:" + Date.now(),
|
||||||
dir: "auto",
|
dir: "auto",
|
||||||
lang: "",
|
lang: "",
|
||||||
|
|
@ -30,7 +30,7 @@ function startNotificationDB() {
|
||||||
// Helper function to add a listener, send message and treat the reply
|
// Helper function to add a listener, send message and treat the reply
|
||||||
function addAndSend(msg, reply, callback, payload, runNext = true) {
|
function addAndSend(msg, reply, callback, payload, runNext = true) {
|
||||||
let handler = {
|
let handler = {
|
||||||
receiveMessage: function(message) {
|
receiveMessage(message) {
|
||||||
if (message.name === reply) {
|
if (message.name === reply) {
|
||||||
Services.cpmm.removeMessageListener(reply, handler);
|
Services.cpmm.removeMessageListener(reply, handler);
|
||||||
callback(message);
|
callback(message);
|
||||||
|
|
@ -17,7 +17,7 @@ add_test(function test_get_none() {
|
||||||
|
|
||||||
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ add_test(function test_send_one() {
|
||||||
addAndSend("Notification:Save", msgReply, msgHandler, {
|
addAndSend("Notification:Save", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
notification: systemNotification,
|
notification: systemNotification,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ add_test(function test_get_one() {
|
||||||
|
|
||||||
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ add_test(function test_delete_one() {
|
||||||
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
id: systemNotification.id,
|
id: systemNotification.id,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ add_test(function test_get_none_again() {
|
||||||
|
|
||||||
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ add_test(function test_delete_one_nonexistent() {
|
||||||
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
id: systemNotification.id,
|
id: systemNotification.id,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ add_test(function test_send_two_get_one() {
|
||||||
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
notification: systemNotification,
|
notification: systemNotification,
|
||||||
requestID: requestID
|
requestID
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
||||||
|
|
@ -146,7 +146,7 @@ add_test(function test_delete_previous() {
|
||||||
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
id: systemNotification.id,
|
id: systemNotification.id,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -162,7 +162,7 @@ add_test(function test_send_two_get_one() {
|
||||||
|
|
||||||
let msgGetReply = "Notification:GetAll:Return:OK";
|
let msgGetReply = "Notification:GetAll:Return:OK";
|
||||||
let msgGetNotifHandler = {
|
let msgGetNotifHandler = {
|
||||||
receiveMessage: function(message) {
|
receiveMessage(message) {
|
||||||
if (message.name === msgGetReply) {
|
if (message.name === msgGetReply) {
|
||||||
Services.cpmm.removeMessageListener(msgGetReply, msgGetNotifHandler);
|
Services.cpmm.removeMessageListener(msgGetReply, msgGetNotifHandler);
|
||||||
let notifications = message.data.notifications;
|
let notifications = message.data.notifications;
|
||||||
|
|
@ -193,7 +193,7 @@ add_test(function test_send_two_get_one() {
|
||||||
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
||||||
origin: systemNotification1.origin,
|
origin: systemNotification1.origin,
|
||||||
notification: systemNotification1,
|
notification: systemNotification1,
|
||||||
requestID: requestID // 10
|
requestID // 10
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
addAndSend("Notification:Save", msgSaveReply, msgSaveHandler, {
|
||||||
|
|
@ -214,7 +214,7 @@ add_test(function test_delete_previous() {
|
||||||
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
id: "{8ef9a628-f0f4-44b4-820d-c117573c33e3}",
|
id: "{8ef9a628-f0f4-44b4-820d-c117573c33e3}",
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -232,7 +232,7 @@ add_test(function test_send_two_get_two() {
|
||||||
let msgGetReply = "Notification:GetAll:Return:OK";
|
let msgGetReply = "Notification:GetAll:Return:OK";
|
||||||
let msgGetCalls = 0;
|
let msgGetCalls = 0;
|
||||||
let msgGetHandler = {
|
let msgGetHandler = {
|
||||||
receiveMessage: function(message) {
|
receiveMessage(message) {
|
||||||
if (message.name === msgGetReply) {
|
if (message.name === msgGetReply) {
|
||||||
msgGetCalls++;
|
msgGetCalls++;
|
||||||
let notifications = message.data.notifications;
|
let notifications = message.data.notifications;
|
||||||
|
|
@ -259,7 +259,7 @@ add_test(function test_send_two_get_two() {
|
||||||
let msgSaveReply = "Notification:Save:Return:OK";
|
let msgSaveReply = "Notification:Save:Return:OK";
|
||||||
let msgSaveCalls = 0;
|
let msgSaveCalls = 0;
|
||||||
let msgSaveHandler = {
|
let msgSaveHandler = {
|
||||||
receiveMessage: function(message) {
|
receiveMessage(message) {
|
||||||
if (message.name === msgSaveReply) {
|
if (message.name === msgSaveReply) {
|
||||||
msgSaveCalls++;
|
msgSaveCalls++;
|
||||||
if (msgSaveCalls === 2) {
|
if (msgSaveCalls === 2) {
|
||||||
|
|
@ -284,7 +284,7 @@ add_test(function test_send_two_get_two() {
|
||||||
Services.cpmm.sendAsyncMessage("Notification:Save", {
|
Services.cpmm.sendAsyncMessage("Notification:Save", {
|
||||||
origin: systemNotification1.origin,
|
origin: systemNotification1.origin,
|
||||||
notification: systemNotification1,
|
notification: systemNotification1,
|
||||||
requestID: requestID // 20
|
requestID // 20
|
||||||
});
|
});
|
||||||
|
|
||||||
Services.cpmm.sendAsyncMessage("Notification:Save", {
|
Services.cpmm.sendAsyncMessage("Notification:Save", {
|
||||||
|
|
@ -305,6 +305,6 @@ add_test(function test_delete_previous() {
|
||||||
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
addAndSend("Notification:Delete", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
id: "{2bc883bf-2809-4432-b0f4-f54e10372764}",
|
id: "{2bc883bf-2809-4432-b0f4-f54e10372764}",
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ function run_test() {
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For bug 1024090: test edge case of notificationstore.json
|
// For bug 1024090: test edge case of notificationstore.json
|
||||||
add_test(function test_bug1024090_purge() {
|
add_test(function test_bug1024090_purge() {
|
||||||
ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||||
const NOTIFICATION_STORE_PATH =
|
const NOTIFICATION_STORE_PATH =
|
||||||
|
|
@ -36,7 +36,7 @@ add_test(function test_bug1024090_send_one() {
|
||||||
addAndSend("Notification:Save", msgReply, msgHandler, {
|
addAndSend("Notification:Save", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
notification: systemNotification,
|
notification: systemNotification,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -51,6 +51,6 @@ add_test(function test_bug1024090_get_one() {
|
||||||
|
|
||||||
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
addAndSend("Notification:GetAll", msgReply, msgHandler, {
|
||||||
origin: systemNotification.origin,
|
origin: systemNotification.origin,
|
||||||
requestID: requestID
|
requestID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
head = common_test_notificationdb.js
|
head = head_notificationdb.js
|
||||||
skip-if = toolkit == 'android'
|
skip-if = toolkit == 'android'
|
||||||
|
|
||||||
[test_notificationdb.js]
|
[test_notificationdb.js]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue