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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/notification/desktop-notification/test_basic_notification.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=573588
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Basic functional test</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="notification_common.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=573588">Basic property tests</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +</pre>
    1.22 +<script type="text/javascript">
    1.23 +  if (is_feature_enabled()) {
    1.24 +    SimpleTest.waitForExplicitFinish();
    1.25 +
    1.26 +    function showNotifications() {
    1.27 +      ok(navigator.mozNotification, "test for notification.");
    1.28 +
    1.29 +      var notification = navigator.mozNotification.createNotification("test", "test");
    1.30 +      ok(notification, "test to ensure we can create a notification");
    1.31 +
    1.32 +      notification.onclose = function() {
    1.33 +        ok(true, "notification was display and is now closing");
    1.34 +        reset_notifications();
    1.35 +        SimpleTest.finish();
    1.36 +      };
    1.37 +
    1.38 +      notification.onclick = function() {
    1.39 +        ok(false, "Click should not have been called.");
    1.40 +        reset_notifications();
    1.41 +        SimpleTest.finish();
    1.42 +      };
    1.43 +
    1.44 +      notification.show();
    1.45 +    }
    1.46 +
    1.47 +    setup_notifications(true, false, showNotifications);
    1.48 +  } else {
    1.49 +    ok(true, "Desktop notifications not enabled.");
    1.50 +  }
    1.51 +</script>
    1.52 +</body>
    1.53 +</html>

mercurial