| Kazuki KANAMORI | 24042ae | 2013-09-14 07:39:20 | [diff] [blame^] | 1 | <!doctype html> |
| 2 | <meta charset=utf-8> |
| 3 | <title>Web Notifications IDL tests</title> |
| 4 | <div id=log></div> |
| 5 | <script src=/resources/testharness.js></script> |
| 6 | <script src=/resources/testharnessreport.js></script> |
| 7 | <script src=/resources/webidl2/lib/webidl2.js></script> |
| 8 | <script src=/resources/idlharness.js></script> |
| 9 | <script type=text/plain class=untested> |
| 10 | interface EventTarget { |
| 11 | void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */); |
| 12 | void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */); |
| 13 | boolean dispatchEvent(Event event); |
| 14 | }; |
| 15 | [TreatNonCallableAsNull] |
| 16 | callback EventHandlerNonNull = any (Event event); |
| 17 | typedef EventHandlerNonNull? EventHandler; |
| 18 | </script> |
| 19 | <script type=text/plain> |
| 20 | [Constructor(DOMString title, optional NotificationOptions options)] |
| 21 | interface Notification : EventTarget { |
| 22 | static readonly attribute NotificationPermission permission; |
| 23 | static void requestPermission(optional NotificationPermissionCallback callback); |
| 24 | |
| 25 | attribute EventHandler onclick; |
| 26 | attribute EventHandler onshow; |
| 27 | attribute EventHandler onerror; |
| 28 | attribute EventHandler onclose; |
| 29 | |
| 30 | readonly attribute DOMString title; |
| 31 | readonly attribute NotificationDirection dir; |
| 32 | readonly attribute DOMString lang; |
| 33 | readonly attribute DOMString body; |
| 34 | readonly attribute DOMString tag; |
| 35 | readonly attribute DOMString icon; |
| 36 | |
| 37 | void close(); |
| 38 | }; |
| 39 | |
| 40 | dictionary NotificationOptions { |
| 41 | NotificationDirection dir = "auto"; |
| 42 | DOMString lang = ""; |
| 43 | DOMString body; |
| 44 | DOMString tag; |
| 45 | DOMString icon; |
| 46 | }; |
| 47 | |
| 48 | dictionary GetNotificationsOptions { |
| 49 | DOMString tag; |
| 50 | }; |
| 51 | |
| 52 | enum NotificationPermission { |
| 53 | "default", |
| 54 | "denied", |
| 55 | "granted" |
| 56 | }; |
| 57 | |
| 58 | callback NotificationPermissionCallback = void (NotificationPermission permission); |
| 59 | |
| 60 | enum NotificationDirection { |
| 61 | "auto", |
| 62 | "ltr", |
| 63 | "rtl" |
| 64 | }; |
| 65 | </script> |
| 66 | <script> |
| 67 | "use strict"; |
| 68 | var idlArray = new IdlArray(); |
| 69 | [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) { |
| 70 | if (node.className == "untested") { |
| 71 | idlArray.add_untested_idls(node.textContent); |
| 72 | } else { |
| 73 | idlArray.add_idls(node.textContent); |
| 74 | } |
| 75 | }); |
| 76 | idlArray.add_objects({ |
| 77 | Notification: ['new Notification("foo")'], |
| 78 | }); |
| 79 | idlArray.test(); |
| 80 | </script> |