| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Notifications: NotificationEvent exposure in a Service Worker.</title
> | 4 <title>Notifications: NotificationEvent exposure in a Service Worker.</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> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 workerInfo = info; | 26 workerInfo = info; |
| 27 | 27 |
| 28 // (1) Display a Web Notification from the document. | 28 // (1) Display a Web Notification from the document. |
| 29 assert_inherits(workerInfo.registration, 'showNotification', 'show
Notification() must be exposed.'); | 29 assert_inherits(workerInfo.registration, 'showNotification', 'show
Notification() must be exposed.'); |
| 30 return workerInfo.registration.showNotification(scope, { | 30 return workerInfo.registration.showNotification(scope, { |
| 31 body: 'Hello, world!', | 31 body: 'Hello, world!', |
| 32 icon: '/icon.png' | 32 icon: '/icon.png' |
| 33 }); | 33 }); |
| 34 }).then(function() { | 34 }).then(function() { |
| 35 // (2) Simulate a click on the notification that has been displaye
d. | 35 // (2) Simulate a click on the notification that has been displaye
d. |
| 36 testRunner.simulateWebNotificationClick(scope); | 36 testRunner.simulateWebNotificationClick(scope, -1 /* action_index
*/); |
| 37 | 37 |
| 38 workerInfo.port.addEventListener('message', function(event) { | 38 workerInfo.port.addEventListener('message', function(event) { |
| 39 if (typeof event.data != 'boolean') { | 39 if (typeof event.data != 'boolean') { |
| 40 assert_unreached('Received an invalid message from the Ser
vice Worker.'); | 40 assert_unreached('Received an invalid message from the Ser
vice Worker.'); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // (3) Verify that the tests were successful in the Service Wo
rker. | 44 // (3) Verify that the tests were successful in the Service Wo
rker. |
| 45 assert_true(event.data); | 45 assert_true(event.data); |
| 46 | 46 |
| 47 test.done(); | 47 test.done(); |
| 48 }); | 48 }); |
| 49 }).catch(unreached_rejection(test)); | 49 }).catch(unreached_rejection(test)); |
| 50 | 50 |
| 51 }, 'The NotificationEvent exposes the expected semantics in a Service Work
er.'); | 51 }, 'The NotificationEvent exposes the expected semantics in a Service Work
er.'); |
| 52 </script> | 52 </script> |
| 53 </body> | 53 </body> |
| 54 </html> | 54 </html> |
| OLD | NEW |