| <!doctype html> |
| <html> |
| <head> |
| <title>Notifications: Creating notifications should fail when no permission has been granted.</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script> |
| // Tests that Notification.requestPermission() returns "denied" when no |
| // permission has been granted, causing creation of notifications to fail |
| // because of that. When running this test manually, deny permission |
| // for displaying notifications prior to running the test. |
| async_test(function (test) { |
| Notification.requestPermission(function (status) { |
| assert_equals(status, 'denied'); |
| |
| var notification = new Notification('My Notification'); |
| notification.addEventListener('show', function() { |
| assert_unreached('The notification is not expected to be shown.'); |
| }); |
| |
| notification.addEventListener('error', function() { |
| test.done(); |
| }); |
| }); |
| |
| }, 'Notification creation fails when no permission has been granted.'); |
| </script> |
| </body> |
| </html> |