OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: clients.openWindow() tests (using testRunner)</title> | 2 <title>Service Worker: clients.openWindow() 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 if (isMac) | 56 if (isMac) |
57 expected[10] = ' focused: false'; | 57 expected[10] = ' focused: false'; |
58 | 58 |
59 function onMessage(e) { | 59 function onMessage(e) { |
60 var message = e.data; | 60 var message = e.data; |
61 | 61 |
62 if (typeof(message) === 'object') { | 62 if (typeof(message) === 'object') { |
63 if (message.type !== 'click') | 63 if (message.type !== 'click') |
64 return; | 64 return; |
65 if (window.testRunner) | 65 if (window.testRunner) |
66 testRunner.simulateWebNotificationClick(message.title); | 66 testRunner.simulateWebNotificationClick(message.title, -1 /* action_in
dex */); |
67 return; | 67 return; |
68 } | 68 } |
69 | 69 |
70 if (message === 'quit') { | 70 if (message === 'quit') { |
71 assert_array_equals(result, expected, | 71 assert_array_equals(result, expected, |
72 'Worker should post back expected messages.'); | 72 'Worker should post back expected messages.'); |
73 service_worker_unregister_and_done(t, scope); | 73 service_worker_unregister_and_done(t, scope); |
74 } else { | 74 } else { |
75 result.push(message); | 75 result.push(message); |
76 } | 76 } |
77 } | 77 } |
78 }); | 78 }); |
79 </script> | 79 </script> |
OLD | NEW |