OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Notifications: Should be able to focus window in onclick event.</titl
e> | 4 <title>Notifications: Should be able to focus window in onclick event.</titl
e> |
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 <script src="../resources/permissions-helper.js"></script> | 7 <script src="../resources/permissions-helper.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
(...skipping 15 matching lines...) Expand all Loading... |
26 window.addEventListener('focus', test.step_func(function() { | 26 window.addEventListener('focus', test.step_func(function() { |
27 test.done(); | 27 test.done(); |
28 })); | 28 })); |
29 | 29 |
30 var childWindow = window.open('about:blank'); | 30 var childWindow = window.open('about:blank'); |
31 childWindow.focus(); | 31 childWindow.focus(); |
32 | 32 |
33 var notification = new Notification('My Notification'); | 33 var notification = new Notification('My Notification'); |
34 notification.addEventListener('show', test.step_func(function() { | 34 notification.addEventListener('show', test.step_func(function() { |
35 if (window.testRunner) | 35 if (window.testRunner) |
36 testRunner.simulateWebNotificationClick('My Notification')
; | 36 testRunner.simulateWebNotificationClick('My Notification',
-1 /* action_index */); |
37 })); | 37 })); |
38 | 38 |
39 notification.addEventListener('click', test.step_func(function() { | 39 notification.addEventListener('click', test.step_func(function() { |
40 window.focus(); | 40 window.focus(); |
41 })); | 41 })); |
42 | 42 |
43 notification.addEventListener('error', test.step_func(function() { | 43 notification.addEventListener('error', test.step_func(function() { |
44 assert_unreached('The error event should not be thrown.'); | 44 assert_unreached('The error event should not be thrown.'); |
45 })); | 45 })); |
46 })); | 46 })); |
47 }, 'Clicking on a notification enables it to focus the window it was creat
ed from.'); | 47 }, 'Clicking on a notification enables it to focus the window it was creat
ed from.'); |
48 </script> | 48 </script> |
49 <script src="resources/click-focus-test.js"></script> | 49 <script src="resources/click-focus-test.js"></script> |
50 </body> | 50 </body> |
51 </html> | 51 </html> |
OLD | NEW |