dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:739f579375e3
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=573588
5 -->
6 <head>
7 <title>Basic functional test</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="text/javascript" src="notification_common.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=573588">Basic property tests</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 </pre>
19 <script type="text/javascript">
20 if (is_feature_enabled()) {
21 SimpleTest.waitForExplicitFinish();
22
23 function showNotifications() {
24 ok(navigator.mozNotification, "test for notification.");
25
26 var notification = navigator.mozNotification.createNotification("test", "test");
27 ok(notification, "test to ensure we can create a notification");
28
29 notification.onclose = function() {
30 ok(true, "notification was display and is now closing");
31 reset_notifications();
32 SimpleTest.finish();
33 };
34
35 notification.onclick = function() {
36 ok(false, "Click should not have been called.");
37 reset_notifications();
38 SimpleTest.finish();
39 };
40
41 notification.show();
42 }
43
44 setup_notifications(true, false, showNotifications);
45 } else {
46 ok(true, "Desktop notifications not enabled.");
47 }
48 </script>
49 </body>
50 </html>

mercurial