instance-sw.js (1116B)
1 importScripts("/resources/testharness.js"); 2 importScripts("resources/helpers.js"); 3 importScripts("resources/custom-data.js"); 4 importScripts("instance-checks.js"); 5 6 promise_setup(async () => { 7 await untilActivate(); 8 }); 9 10 notification_instance_test(async t => { 11 t.add_cleanup(closeAllNotifications); 12 13 await registration.showNotification(...notification_args); 14 15 let notifications = await registration.getNotifications(); 16 assert_equals(notifications.length, 1, "The list should include one notification"); 17 18 return notifications[0]; 19 }, "getNotifications()"); 20 21 // Doing this separately because this times out on Blink and GeckoView 22 notification_instance_test(async t => { 23 t.add_cleanup(closeAllNotifications); 24 25 await registration.showNotification(...notification_args); 26 27 let notifications = await registration.getNotifications(); 28 assert_equals(notifications.length, 1, "The list should include one notification"); 29 30 notifications[0].close(); 31 const ev = await new Promise(resolve => addEventListener("notificationclose", resolve, { once: true })); 32 33 return ev.notification; 34 }, "notificationclose");