| OLD | NEW |
| 1 importScripts('../../serviceworker/resources/worker-testharness.js'); | 1 importScripts('../../serviceworker/resources/worker-testharness.js'); |
| 2 | 2 |
| 3 let messagePort = null; | 3 let messagePort = null; |
| 4 addEventListener('message', workerEvent => { | 4 addEventListener('message', workerEvent => { |
| 5 messagePort = workerEvent.data; | 5 messagePort = workerEvent.data; |
| 6 messagePort.postMessage('ready'); | 6 messagePort.postMessage('ready'); |
| 7 }); | 7 }); |
| 8 | 8 |
| 9 addEventListener('notificationclick', e => runTest(e.notification)); | 9 addEventListener('notificationclick', e => runTest(e.notification)); |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 const event = new NotificationEvent('NotificationEvent', { notification })
; | 24 const event = new NotificationEvent('NotificationEvent', { notification })
; |
| 25 | 25 |
| 26 assert_equals(event.type, 'NotificationEvent'); | 26 assert_equals(event.type, 'NotificationEvent'); |
| 27 assert_idl_attribute(event, 'notification'); | 27 assert_idl_attribute(event, 'notification'); |
| 28 assert_idl_attribute(event, 'action'); | 28 assert_idl_attribute(event, 'action'); |
| 29 assert_equals(event.cancelable, false); | 29 assert_equals(event.cancelable, false); |
| 30 assert_equals(event.bubbles, false); | 30 assert_equals(event.bubbles, false); |
| 31 assert_equals(event.notification, notification); | 31 assert_equals(event.notification, notification); |
| 32 assert_equals(event.action, ''); | 32 assert_equals(event.action, ''); |
| 33 assert_equals(event.reply, ''); |
| 33 assert_inherits(event, 'waitUntil'); | 34 assert_inherits(event, 'waitUntil'); |
| 34 | 35 |
| 35 const customEvent = new NotificationEvent('NotificationEvent', { | 36 const customEvent = new NotificationEvent('NotificationEvent', { |
| 36 notification: notification, | 37 notification: notification, |
| 38 reply: 'my reply', |
| 37 bubbles: true, | 39 bubbles: true, |
| 38 cancelable: true }); | 40 cancelable: true }); |
| 39 | 41 |
| 40 assert_equals(customEvent.type, 'NotificationEvent'); | 42 assert_equals(customEvent.type, 'NotificationEvent'); |
| 41 assert_equals(customEvent.cancelable, true); | 43 assert_equals(customEvent.cancelable, true); |
| 42 assert_equals(customEvent.bubbles, true); | 44 assert_equals(customEvent.bubbles, true); |
| 43 assert_equals(customEvent.notification, notification); | 45 assert_equals(customEvent.notification, notification); |
| 46 assert_equals(customEvent.reply, 'my reply'); |
| 44 } catch (e) { | 47 } catch (e) { |
| 45 result.success = false; | 48 result.success = false; |
| 46 result.message = e.message + '\n' + e.stack; | 49 result.message = e.message + '\n' + e.stack; |
| 47 } | 50 } |
| 48 // Signal to the document that the test has finished running. | 51 // Signal to the document that the test has finished running. |
| 49 messagePort.postMessage(result); | 52 messagePort.postMessage(result); |
| 50 } | 53 } |
| OLD | NEW |