OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Notifications: ServiceWorkerRegistration.showNotification().</title> | 4 <title>Notifications: ServiceWorkerRegistration.showNotification().</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 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
(...skipping 29 matching lines...) Expand all Loading... |
40 }); | 40 }); |
41 }).then(function () { | 41 }).then(function () { |
42 assert_inherits(registration, 'showNotification', 'showNotificatio
n() must be exposed.'); | 42 assert_inherits(registration, 'showNotification', 'showNotificatio
n() must be exposed.'); |
43 | 43 |
44 return registration.showNotification(scope, { | 44 return registration.showNotification(scope, { |
45 body: 'Hello, world!', | 45 body: 'Hello, world!', |
46 icon: '/icon.png' | 46 icon: '/icon.png' |
47 }); | 47 }); |
48 }).then(function () { | 48 }).then(function () { |
49 messagePort.addEventListener('message', function(event) { | 49 messagePort.addEventListener('message', function(event) { |
50 assert_equals(event.data, 'The notification has been clicked o
n.'); | 50 assert_equals(event.data, 'Clicked on Notification: ' + scope)
; |
51 test.done(); | 51 test.done(); |
52 }); | 52 }); |
53 | 53 |
54 testRunner.simulateWebNotificationClick(scope); | 54 testRunner.simulateWebNotificationClick(scope); |
55 | 55 |
56 }).catch(unreached_rejection(test)); | 56 }).catch(unreached_rejection(test)); |
57 | 57 |
58 }, 'Clicking on a notification displayed through showNotification() fires
a Service Worker event.'); | 58 }, 'Clicking on a notification displayed through showNotification() fires
a Service Worker event.'); |
59 </script> | 59 </script> |
60 </body> | 60 </body> |
61 </html> | 61 </html> |
OLD | NEW |