OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Notifications: Simulating a click should call the onclick event.</tit
le> | 4 <title>Notifications: Simulating a click should call the onclick event.</tit
le> |
5 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
6 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <script> | 9 <script> |
10 // Tests that Document-bound notifications are able to focus a window in | 10 // Tests that Document-bound notifications are able to focus a window in |
11 // their onclick event. When the test is being ran manually, grant | 11 // their onclick event. When the test is being ran manually, grant |
12 // Notification permission and click on the notification. | 12 // Notification permission and click on the notification. |
13 if (window.testRunner) { | 13 if (window.testRunner) { |
14 testRunner.setCanOpenWindows(); | 14 testRunner.setCanOpenWindows(); |
15 testRunner.setCloseRemainingWindowsWhenComplete(); | 15 testRunner.setCloseRemainingWindowsWhenComplete(); |
16 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); | 16 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); |
17 testRunner.grantWebNotificationPermission(location.origin, true); | |
18 } | 17 } |
19 | 18 |
20 async_test(function(test) { | 19 async_test(function(test) { |
21 if (Notification.permission != 'granted') { | 20 if (Notification.permission != 'granted') { |
22 assert_unreached('No permission has been granted for displaying no
tifications.'); | 21 assert_unreached('No permission has been granted for displaying no
tifications.'); |
23 return; | 22 return; |
24 } | 23 } |
25 | 24 |
26 window.addEventListener('focus', function() { | 25 window.addEventListener('focus', function() { |
27 test.done(); | 26 test.done(); |
(...skipping 14 matching lines...) Expand all Loading... |
42 | 41 |
43 notification.addEventListener('error', function() { | 42 notification.addEventListener('error', function() { |
44 assert_unreached('The error event should not be thrown.'); | 43 assert_unreached('The error event should not be thrown.'); |
45 }); | 44 }); |
46 | 45 |
47 }, 'Clicking on a notification enables it to focus the window it was creat
ed from.'); | 46 }, 'Clicking on a notification enables it to focus the window it was creat
ed from.'); |
48 </script> | 47 </script> |
49 <script src="resources/click-focus-test.js"></script> | 48 <script src="resources/click-focus-test.js"></script> |
50 </body> | 49 </body> |
51 </html> | 50 </html> |
OLD | NEW |