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.<
/title> | 4 <title>Notifications: Property reflection in the "notificationclick" event.<
/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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 assert_true(event.data.success, 'The notification must hav
e been displayed.'); | 61 assert_true(event.data.success, 'The notification must hav
e been displayed.'); |
62 testRunner.simulateWebNotificationClick(scope); | 62 testRunner.simulateWebNotificationClick(scope); |
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 // (3) Listen for confirmation from the Service Worker that th
e | 66 // (3) Listen for confirmation from the Service Worker that th
e |
67 // notification has been clicked on. Make sure that all proper
ties | 67 // notification has been clicked on. Make sure that all proper
ties |
68 // set on the Notification object are as expected. | 68 // set on the Notification object are as expected. |
69 assert_equals(event.data.command, 'click', 'The notification w
as expected to be clicked.'); | 69 assert_equals(event.data.command, 'click', 'The notification w
as expected to be clicked.'); |
70 | 70 |
| 71 options.actions = options.actions.slice(0, Notification.maxAct
ions); |
71 Object.keys(options).forEach(function(key) { | 72 Object.keys(options).forEach(function(key) { |
72 if (key == 'actions') | 73 if (typeof options[key] == 'object') |
73 assert_object_equals(event.data.notification.actions,
options.actions.slice(0, Notification.maxActions)); | 74 assert_object_equals(event.data.notification[key], opt
ions[key], 'The ' + key + ' field must be the same.'); |
74 else | 75 else |
75 assert_object_equals(event.data.notification[key], opt
ions[key], 'The ' + key + ' field must be the same.'); | 76 assert_equals(event.data.notification[key], options[ke
y], 'The ' + key + ' field must be the same.'); |
76 }); | 77 }); |
77 | 78 |
78 test.done(); | 79 test.done(); |
79 }); | 80 }); |
80 }).catch(unreached_rejection(test)); | 81 }).catch(unreached_rejection(test)); |
81 | 82 |
82 }, 'Clicking on a notification displayed by a Service Worker the notificat
ionclick event.'); | 83 }, 'Clicking on a notification displayed by a Service Worker the notificat
ionclick event.'); |
83 </script> | 84 </script> |
84 </body> | 85 </body> |
85 </html> | 86 </html> |
OLD | NEW |