| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <p> |
| 8 Tests that it is possible to return focus to the |window| object when a |
| 9 notification has been clicked on when another window is in the foreground. |
| 10 </p> |
| 11 <p> |
| 12 When running this test manually, disable pop-up blocking, grant permission
for |
| 13 the notification and reload this page. Click the notification which will b
e |
| 14 shown. You should see two PASS messages and this window should be focused. |
| 15 </p> |
| 16 <div id="console"></div> |
| 17 <script> |
| 18 if (window.testRunner) { |
| 19 testRunner.setCanOpenWindows(); |
| 20 testRunner.setCloseRemainingWindowsWhenComplete(); |
| 21 testRunner.grantWebNotificationPermission("file://", true); |
| 22 testRunner.waitUntilDone(); |
| 23 } |
| 24 |
| 25 window.addEventListener("focus", function() { |
| 26 testPassed("Focus has been returned to the opening window."); |
| 27 if (window.testRunner) |
| 28 testRunner.notifyDone(); |
| 29 }); |
| 30 |
| 31 var childWindow = window.open("about:blank"); |
| 32 childWindow.focus(); |
| 33 |
| 34 var notification = new Notification("Notification"); |
| 35 notification.addEventListener("show", function() { |
| 36 testPassed("notification.onshow() has been called."); |
| 37 if (window.testRunner) |
| 38 testRunner.simulateWebNotificationClick("Notification"); |
| 39 }); |
| 40 |
| 41 notification.addEventListener("click", function() { |
| 42 testPassed("notification.onclick() has been called."); |
| 43 notification.close(); |
| 44 |
| 45 window.focus(); |
| 46 }); |
| 47 </script> |
| 48 </body> |
| 49 </body> |
| OLD | NEW |