4 <title>Notifications: The close event should be dispatched asynchronously.
</title>
5 <script src=
"../resources/testharness.js"></script>
6 <script src=
"../resources/testharnessreport.js"></script>
7 <script src=
"resources/test-helpers.js"></script>
11 // Tests that the "close" event on a Notification object will be fired asynchronously
12 // when it's being closed programmatically by the developer.
13 if (window
.testRunner
)
14 testRunner
.setPermission('notifications', 'granted', location
.origin
, location
.origin
);
16 async_test(function(test
) {
17 var eventOrderCounter
= 0;
18 var notification
= new Notification('My Notification', {
19 body
: 'Hello, world!',
23 notification
.addEventListener('show', function() {
24 assert_equals(++eventOrderCounter
, 2);
27 assert_equals(++eventOrderCounter
, 3);
30 notification
.addEventListener('close', function() {
31 assert_equals(++eventOrderCounter
, 4);
36 assert_equals(++eventOrderCounter
, 1);
38 }, 'The close event should be dispatched asynchronously.');