OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Notifications: Action reflection in the "notificationclick" event.</t
itle> | 4 <title>Notifications: Action reflection in the "notificationclick" event.</t
itle> |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 assert_unreached('Invalid message from the Service Worker.
'); | 44 assert_unreached('Invalid message from the Service Worker.
'); |
45 return; | 45 return; |
46 } | 46 } |
47 | 47 |
48 // (2) Listen for confirmation from the Service Worker that th
e | 48 // (2) Listen for confirmation from the Service Worker that th
e |
49 // notification's display promise has been resolved. | 49 // notification's display promise has been resolved. |
50 if (event.data.command == 'show') { | 50 if (event.data.command == 'show') { |
51 assert_true(event.data.success, 'The notification must hav
e been displayed.'); | 51 assert_true(event.data.success, 'The notification must hav
e been displayed.'); |
52 for (var i = 0; i < options.actions.length; ++i) | 52 for (var i = 0; i < options.actions.length; ++i) |
53 testRunner.simulateWebNotificationClick(scope, i); | 53 testRunner.simulateWebNotificationClick(scope, i); |
54 testRunner.simulateWebNotificationClick(scope); | 54 testRunner.simulateWebNotificationClick(scope, -1 /* actio
n_index */); |
55 return; | 55 return; |
56 } | 56 } |
57 | 57 |
58 // (3) Listen for confirmation from the Service Worker that th
e | 58 // (3) Listen for confirmation from the Service Worker that th
e |
59 // notification has been clicked on. Make sure that the action | 59 // notification has been clicked on. Make sure that the action |
60 // property set on the NotificationEvent object is as expected
. | 60 // property set on the NotificationEvent object is as expected
. |
61 assert_equals(event.data.command, 'click', 'The notification w
as expected to be clicked.'); | 61 assert_equals(event.data.command, 'click', 'The notification w
as expected to be clicked.'); |
62 | 62 |
63 assert_equals(event.data.action, expectedActions.shift()); | 63 assert_equals(event.data.action, expectedActions.shift()); |
64 | 64 |
65 if (expectedActions.length === 0) | 65 if (expectedActions.length === 0) |
66 test.done(); | 66 test.done(); |
67 }); | 67 }); |
68 }).catch(unreached_rejection(test)); | 68 }).catch(unreached_rejection(test)); |
69 | 69 |
70 }, 'NotificationEvent action property should be reflect which action was c
licked.'); | 70 }, 'NotificationEvent action property should be reflect which action was c
licked.'); |
71 </script> | 71 </script> |
72 </body> | 72 </body> |
73 </html> | 73 </html> |
OLD | NEW |