4 <title>Notifications: Creating notifications should succeed when permission has been granted.
</title>
5 <script src=
"../resources/testharness.js"></script>
6 <script src=
"../resources/testharnessreport.js"></script>
10 // Tests that Notification.requestPermission() returns "granted" when
11 // permission has been granted, causing creation of notifications to
12 // succeed. When running this test manually, accept permission
13 // for displaying notifications prior to running the test.
14 async_test(function (test
) {
15 testRunner
.setPermission('notifications', 'granted', location
.origin
, location
.origin
);
16 Notification
.requestPermission(function (status
) {
17 assert_equals(status
, 'granted');
19 var notification
= new Notification('My Notification');
20 notification
.addEventListener('show', function() {
24 notification
.addEventListener('error', function() {
25 assert_unreached('The notification is expected to be shown.');
29 }, 'Notification creation succeeds when permission has been granted.');