OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: WindowClient.focus() tests (using testRunner)</title> | 2 <title>Service Worker: WindowClient.focus() tests (using testRunner)</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script src="../resources/test-helpers.js"></script> | 5 <script src="../resources/test-helpers.js"></script> |
6 <script> | 6 <script> |
7 // This test is using testRunner to grant itself the notification permission and | 7 // This test is using testRunner to grant itself the notification permission and |
8 // to simulate a click on a notification. A couple of changes would allow it to | 8 // to simulate a click on a notification. A couple of changes would allow it to |
9 // be run as a manual test by other browser vendors. | 9 // be run as a manual test by other browser vendors. |
10 if (window.testRunner) | 10 if (window.testRunner) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 expected[29] = 'focused clients: 3'; | 67 expected[29] = 'focused clients: 3'; |
68 } | 68 } |
69 | 69 |
70 function onMessage(e) { | 70 function onMessage(e) { |
71 var message = e.data; | 71 var message = e.data; |
72 | 72 |
73 if (typeof(message) === 'object') { | 73 if (typeof(message) === 'object') { |
74 if (message.type !== 'click') | 74 if (message.type !== 'click') |
75 return; | 75 return; |
76 if (window.testRunner) | 76 if (window.testRunner) |
77 testRunner.simulateWebNotificationClick(message.title); | 77 testRunner.simulateWebNotificationClick(message.title, -1 /* act
ion_index */); |
78 return; | 78 return; |
79 } | 79 } |
80 | 80 |
81 if (message === 'quit') { | 81 if (message === 'quit') { |
82 assert_array_equals(result, expected, | 82 assert_array_equals(result, expected, |
83 'Worker should post back expected messages.'); | 83 'Worker should post back expected messages.'); |
84 service_worker_unregister_and_done(t, scope); | 84 service_worker_unregister_and_done(t, scope); |
85 } else { | 85 } else { |
86 result.push(message); | 86 result.push(message); |
87 } | 87 } |
88 } | 88 } |
89 }); | 89 }); |
90 </script> | 90 </script> |
OLD | NEW |