blob: 71232e712496bdea233696d24d4c408551c47594 [file] [log] [blame]
Kazuki KANAMORI24042ae2013-09-14 07:39:201<!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>
Michael[tm] Smith48db9752014-03-12 14:58:157<script src=/resources/WebIDLParser.js></script>
Kazuki KANAMORI24042ae2013-09-14 07:39:208<script src=/resources/idlharness.js></script>
9<script type=text/plain class=untested>
10interface 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]
16callback EventHandlerNonNull = any (Event event);
17typedef EventHandlerNonNull? EventHandler;
18</script>
19<script type=text/plain>
20[Constructor(DOMString title, optional NotificationOptions options)]
21interface 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
40dictionary NotificationOptions {
41 NotificationDirection dir = "auto";
42 DOMString lang = "";
43 DOMString body;
44 DOMString tag;
45 DOMString icon;
46};
47
48dictionary GetNotificationsOptions {
49 DOMString tag;
50};
51
52enum NotificationPermission {
53 "default",
54 "denied",
55 "granted"
56};
57
58callback NotificationPermissionCallback = void (NotificationPermission permission);
59
60enum NotificationDirection {
61 "auto",
62 "ltr",
63 "rtl"
64};
65</script>
66<script>
67"use strict";
68var 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});
76idlArray.add_objects({
77 Notification: ['new Notification("foo")'],
78});
79idlArray.test();
80</script>