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

mercurial