| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Notifications: ServiceWorkerRegistration.getNotifications().</title> | 4 <title>Notifications: ServiceWorkerRegistration.getNotifications().</title> |
| 5 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
| 7 <script src="../serviceworker/resources/test-helpers.js"></script> | 7 <script src="../serviceworker/resources/test-helpers.js"></script> |
| 8 <script src="resources/test-helpers.js"></script> | 8 <script src="resources/test-helpers.js"></script> |
| 9 </head> | 9 </head> |
| 10 <body> | 10 <body> |
| 11 <script> | 11 <script> |
| 12 // Tests that the getNotifications() function when used in a document retu
rns | 12 // Tests that the getNotifications() function when used in a document retu
rns |
| 13 // an array of the notifications which were previously displayed using the | 13 // an array of the notifications which were previously displayed using the |
| 14 // same Service Worker registration id. | 14 // same Service Worker registration id. |
| 15 async_test(function(test) { | 15 async_test(function(test) { |
| 16 var scope = 'resources/scope/' + location.pathname, | 16 var scope = 'resources/scope/' + location.pathname, |
| 17 script = 'resources/instrumentation-service-worker.js'; | 17 script = 'instrumentation-service-worker.js'; |
| 18 | 18 |
| 19 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); | 19 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); |
| 20 | 20 |
| 21 var registration = null; | 21 var registration = null; |
| 22 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi
on(workerInfo) { | 22 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi
on(workerInfo) { |
| 23 registration = workerInfo.registration; | 23 registration = workerInfo.registration; |
| 24 | 24 |
| 25 return registration.showNotification('Hello, world!', { | 25 return registration.showNotification('Hello, world!', { |
| 26 body: 'First notification' | 26 body: 'First notification' |
| 27 }); | 27 }); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 45 assert_equals(notifications[secondIndex].title, 'Hello again, worl
d!'); | 45 assert_equals(notifications[secondIndex].title, 'Hello again, worl
d!'); |
| 46 assert_equals(notifications[secondIndex].body, 'Second notificatio
n'); | 46 assert_equals(notifications[secondIndex].body, 'Second notificatio
n'); |
| 47 | 47 |
| 48 test.done(); | 48 test.done(); |
| 49 }).catch(unreached_rejection(test)); | 49 }).catch(unreached_rejection(test)); |
| 50 | 50 |
| 51 }, 'ServiceWorkerRegistration.getNotifications() returns the opened notifi
cations.'); | 51 }, 'ServiceWorkerRegistration.getNotifications() returns the opened notifi
cations.'); |
| 52 </script> | 52 </script> |
| 53 </body> | 53 </body> |
| 54 </html> | 54 </html> |
| OLD | NEW |