OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Notifications: Property reflection in the "notificationclick" event a
nd SWR.getNotifications().</title> | 4 <title>Notifications: Property reflection in the "notificationclick" event a
nd SWR.getNotifications().</title> |
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="../serviceworker/resources/test-helpers.js"></script> | 7 <script src="../serviceworker/resources/test-helpers.js"></script> |
8 <script src="resources/test-helpers.js"></script> | 8 <script src="resources/test-helpers.js"></script> |
9 </head> | 9 </head> |
10 <body> | 10 <body> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // (3) Confirm that all properties set on the cloned Notification
object are as expected. | 89 // (3) Confirm that all properties set on the cloned Notification
object are as expected. |
90 assert_object_is_superset(data.notification, options, 'The Notific
ation object properties must be the same in notificationclick events.'); | 90 assert_object_is_superset(data.notification, options, 'The Notific
ation object properties must be the same in notificationclick events.'); |
91 return registration.getNotifications(); | 91 return registration.getNotifications(); |
92 }).then(function(notifications) { | 92 }).then(function(notifications) { |
93 // (4) Check that the properties are also set correctly on the non
-cloned Notification | 93 // (4) Check that the properties are also set correctly on the non
-cloned Notification |
94 // object from getNotifications. | 94 // object from getNotifications. |
95 assert_equals(notifications.length, 1); | 95 assert_equals(notifications.length, 1); |
96 assert_object_is_superset(notifications[0], options, 'The Notifica
tion object properties must be the same in getNotifications.'); | 96 assert_object_is_superset(notifications[0], options, 'The Notifica
tion object properties must be the same in getNotifications.'); |
97 | 97 |
98 notifications[0].actions.foo = 'bar'; | 98 notifications[0].actions.foo = 'bar'; |
99 notifications[0].actions.push({ title: 'Foo' }); | 99 assert_throws(null, () => notifications[0].actions.push({ title: '
Foo' })); |
| 100 |
100 if (notifications[0].actions.length) { | 101 if (notifications[0].actions.length) { |
101 notifications[0].actions[0].title = 'Changed'; | 102 notifications[0].actions[0].title = 'Changed'; |
102 notifications[0].actions[0].foo = 'bar'; | 103 notifications[0].actions[0].foo = 'bar'; |
103 } | 104 } |
| 105 |
104 assert_object_equals(notifications[0].actions, options.actions, 'T
he actions field should be immutable.'); | 106 assert_object_equals(notifications[0].actions, options.actions, 'T
he actions field should be immutable.'); |
105 | 107 |
106 // TODO(johnme): This should pass before shipping Notification.act
ions; this is blocked on https://crbug.com/515920. | 108 assert_equals(notifications[0].actions, notifications[0].actions,
'`actions` attribute equality'); |
107 //assert_equals(notifications[0].actions, notifications[0].actions
, 'The actions field should === itself.'); | 109 assert_equals(notifications[0].data, notifications[0].data, '`data
` attribute equality'); |
| 110 assert_equals(notifications[0].vibrate, notifications[0].vibrate,
'`vibrate` attribute equality'); |
108 | 111 |
109 test.done(); | 112 test.done(); |
110 }).catch(unreached_rejection(test)); | 113 }).catch(unreached_rejection(test)); |
111 | 114 |
112 }, 'Clicking on a notification displayed by a Service Worker the notificat
ionclick event.'); | 115 }, 'Clicking on a notification displayed by a Service Worker the notificat
ionclick event.'); |
113 </script> | 116 </script> |
114 </body> | 117 </body> |
115 </html> | 118 </html> |
OLD | NEW |