head_notificationdb.js (1002B)
1 "use strict"; 2 3 var { XPCOMUtils } = ChromeUtils.importESModule( 4 "resource://gre/modules/XPCOMUtils.sys.mjs" 5 ); 6 7 function getNotificationObject(app, id, tag, includeScope) { 8 const origin = `https://${app}.gaiamobile.org/`; 9 return { 10 origin, 11 id, 12 title: app + "Notification:" + Date.now(), 13 dir: "auto", 14 lang: "", 15 body: app + " notification body", 16 tag: tag || "", 17 icon: "icon.png", 18 serviceWorkerRegistrationScope: includeScope ? origin : undefined, 19 }; 20 } 21 22 var systemNotification = getNotificationObject( 23 "system", 24 "{2bc883bf-2809-4432-b0f4-f54e10372764}" 25 ); 26 27 var calendarNotification = getNotificationObject( 28 "calendar", 29 "{d8d11299-a58e-429b-9a9a-57c562982fbf}" 30 ); 31 32 // helper function, comparing two notifications 33 function compareNotification(notif1, notif2) { 34 // retrieved notification should be the second one sent 35 for (let prop in notif1) { 36 // compare each property 37 Assert.equal(notif1[prop], notif2[prop], `${prop} should be equal`); 38 } 39 }