1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/notification/desktop-notification/test_basic_notification_click.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 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 + var click_was_called = false; 1.27 + 1.28 + function showNotifications() { 1.29 + ok(navigator.mozNotification, "test for notification."); 1.30 + 1.31 + var notification = navigator.mozNotification.createNotification("test", "test"); 1.32 + ok(notification, "test to ensure we can create a notification"); 1.33 + 1.34 + notification.onclose = function() { 1.35 + ok(true, "notification was display and is now closing"); 1.36 + ok(click_was_called, "was notification clicked?"); 1.37 + 1.38 + reset_notifications(); 1.39 + SimpleTest.finish(); 1.40 + }; 1.41 + 1.42 + notification.onclick = function() { 1.43 + ok(true, "Click was called. Good."); 1.44 + click_was_called = true; 1.45 + }; 1.46 + 1.47 + notification.show(); 1.48 + } 1.49 + 1.50 + setup_notifications(true, true, showNotifications); 1.51 + } else { 1.52 + ok(true, "Desktop notifications not enabled."); 1.53 + } 1.54 +</script> 1.55 +</body> 1.56 +</html>