Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <meta charset="utf-8"> |
| 3 | <title>Notification.onclose (basic)</title> |
| 4 | <link rel="author" title="Apple Inc." href="http://www.apple.com/"> |
| 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| 7 | <script> |
| 8 | test(function() { |
| 9 | if (Notification.permission != "granted") { |
| 10 | this.force_timeout() |
| 11 | this.set_status(this.NOTRUN, "You must allow notifications for this" |
| 12 | + "origin before running this test.") |
| 13 | } else { |
| 14 | var t = async_test("Invoked the onclose event handler.") |
| 15 | var notification = new Notification("New Email Received") |
| 16 | notification.onshow = t.step_func(function() { |
| 17 | notification.close() |
| 18 | }) |
| 19 | notification.onclose = t.step_func(function(e) { |
| 20 | assert_equals(Object.prototype.toString.call(e), "[object Event]") |
| 21 | assert_equals(e.type, "close", "Checked the event type.") |
| 22 | t.done() |
| 23 | }) |
| 24 | } |
| 25 | }, "Checked test prerequisites.") |
| 26 | </script> |