blob: b66d4d333fed9ac3442a0fe27a745a1ea54cee13 [file] [log] [blame]
<!doctype html>
<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>
// 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() {
}, 'Notification creation fails when no permission has been granted.');