Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / notifications / request-permission-denied.html
blobb66d4d333fed9ac3442a0fe27a745a1ea54cee13
1 <!doctype html>
2 <html>
3 <head>
4 <title>Notifications: Creating notifications should fail when no permission has been granted.</title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10 // Tests that Notification.requestPermission() returns "denied" when no
11 // permission has been granted, causing creation of notifications to fail
12 // because of that. When running this test manually, deny permission
13 // for displaying notifications prior to running the test.
14 async_test(function (test) {
15 Notification.requestPermission(function (status) {
16 assert_equals(status, 'denied');
18 var notification = new Notification('My Notification');
19 notification.addEventListener('show', function() {
20 assert_unreached('The notification is not expected to be shown.');
21 });
23 notification.addEventListener('error', function() {
24 test.done();
25 });
26 });
28 }, 'Notification creation fails when no permission has been granted.');
29 </script>
30 </body>
31 </html>