OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Notifications: Showing a notification with an image that 404s.</title
> | 4 <title>Notifications: Showing a notification with an image that 404s.</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 showing a notification with an image that creates a 404 resp
onse | 12 // Tests that showing a notification with an image that creates a 404 resp
onse |
13 // works properly, and does not block the actual display of it. | 13 // works properly, and does not block the actual display of it. |
14 | 14 |
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 = 'resources/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 testRunner.grantWebNotificationPermission(location.origin, true); | |
21 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi
on(info) { | 20 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi
on(info) { |
22 // (1) Display a Web Notification through the Service Worker with | 21 // (1) Display a Web Notification through the Service Worker with |
23 // an image that will trigger a 404 response immediately. | 22 // an image that will trigger a 404 response immediately. |
24 info.port.postMessage({ | 23 info.port.postMessage({ |
25 command: 'show', | 24 command: 'show', |
26 | 25 |
27 title: 'My Notification', | 26 title: 'My Notification', |
28 options: { body: 'Hello, world!', | 27 options: { body: 'Hello, world!', |
29 icon: '/resources/404image.php' } | 28 icon: '/resources/404image.php' } |
30 }); | 29 }); |
(...skipping 10 matching lines...) Expand all Loading... |
41 assert_true(event.data.success); | 40 assert_true(event.data.success); |
42 | 41 |
43 test.done(); | 42 test.done(); |
44 }); | 43 }); |
45 }).catch(unreached_rejection(test)); | 44 }).catch(unreached_rejection(test)); |
46 | 45 |
47 }, 'Displaying a notification with an image that 404s still resolves the p
romise.'); | 46 }, 'Displaying a notification with an image that 404s still resolves the p
romise.'); |
48 </script> | 47 </script> |
49 </body> | 48 </body> |
50 </html> | 49 </html> |
OLD | NEW |