OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script type="text/javascript"> | |
5 function log(message) | |
6 { | |
7 document.getElementById("result").innerHTML += message + "<br>"; | |
8 } | |
9 | |
10 function runTests() | |
11 { | |
12 if (window.testRunner) { | |
13 testRunner.grantWebNotificationPermission("file://"); | |
14 testRunner.dumpAsText(); | |
15 testRunner.waitUntilDone(); | |
16 testRunner.setCanOpenWindows(); | |
17 testRunner.setCloseRemainingWindowsWhenComplete(); | |
18 } | |
19 | |
20 if (!window.webkitNotifications) { | |
21 log("FAIL: No webkitNotifications interface!"); | |
22 } | |
23 | |
24 // Open a new window, so we don't have the focus. | |
25 var W = window.open("about:blank"); | |
26 W.focus(); | |
27 | |
28 window.onfocus = function() { log("PASS: focus event fired."); } | |
29 | |
30 var N = window.webkitNotifications.createNotification("", "New E-mai
l", "Meet me tonight at 8!"); | |
31 N.onclick = function() { log("PASS: click event fired."); window.foc
us(); N.cancel(); } | |
32 N.show(); | |
33 | |
34 if (window.testRunner) { | |
35 testRunner.simulateLegacyWebNotificationClick("New E-mail"); | |
36 testRunner.notifyDone(); | |
37 } | |
38 } | |
39 </script> | |
40 </head> | |
41 <body> | |
42 <p>Check that window.focus() is not restricted during notification click events.
</p> | |
43 | |
44 <p>To exercise manually, disable pop-up blocking, grant notification permissions
and load this page, then click on the notification. You should see two "PASS"
messages and this window should be focused.</p> | |
45 <div id="result"></div> | |
46 | |
47 <script type="text/javascript"> | |
48 runTests(); | |
49 </script> | |
50 </body> | |
51 </html> | |
OLD | NEW |