| OLD | NEW |
| 1 var _port = self; | 1 var _port = self; |
| 2 | 2 |
| 3 // Returns whether the test is being ran in a dedicated or a shared worker. The | 3 // Returns whether the test is being ran in a dedicated or a shared worker. The |
| 4 // testharness.js framework requires done() to be called when this is the case. | 4 // testharness.js framework requires done() to be called when this is the case. |
| 5 function isDedicatedOrSharedWorker() | 5 function isDedicatedOrSharedWorker() |
| 6 { | 6 { |
| 7 return self.importScripts && !self.scope; | 7 return self.importScripts && !self.scope; |
| 8 } | 8 } |
| 9 | 9 |
| 10 // Shared Workers will receive their message port once the first page connects t
o it. | 10 // Shared Workers will receive their message port once the first page connects t
o it. |
| 11 self.addEventListener('connect', function(event) { | 11 self.addEventListener('connect', function(event) { |
| 12 _port = event.ports[0]; | 12 _port = event.ports[0]; |
| 13 }); | 13 }); |
| 14 | 14 |
| 15 var testRunner = { | 15 var testRunner = { |
| 16 simulateWebNotificationClick: function(title) | 16 simulateWebNotificationClick: function(title, action_index) |
| 17 { | 17 { |
| 18 if (_port) | 18 if (_port) |
| 19 _port.postMessage({ type: 'simulateWebNotificationClick', title: tit
le }); | 19 _port.postMessage({ type: 'simulateWebNotificationClick', title: tit
le, action_index: action_index }); |
| 20 } | 20 } |
| 21 }; | 21 }; |
| OLD | NEW |