|
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 var click_was_called = false; |
|
24 |
|
25 function showNotifications() { |
|
26 ok(navigator.mozNotification, "test for notification."); |
|
27 |
|
28 var notification = navigator.mozNotification.createNotification("test", "test"); |
|
29 ok(notification, "test to ensure we can create a notification"); |
|
30 |
|
31 notification.onclose = function() { |
|
32 ok(true, "notification was display and is now closing"); |
|
33 ok(click_was_called, "was notification clicked?"); |
|
34 |
|
35 reset_notifications(); |
|
36 SimpleTest.finish(); |
|
37 }; |
|
38 |
|
39 notification.onclick = function() { |
|
40 ok(true, "Click was called. Good."); |
|
41 click_was_called = true; |
|
42 }; |
|
43 |
|
44 notification.show(); |
|
45 } |
|
46 |
|
47 setup_notifications(true, true, showNotifications); |
|
48 } else { |
|
49 ok(true, "Desktop notifications not enabled."); |
|
50 } |
|
51 </script> |
|
52 </body> |
|
53 </html> |