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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial