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 10 matching lines...) Expand all Loading... |
21 title: scope, | 21 title: scope, |
22 dir: 'rtl', | 22 dir: 'rtl', |
23 lang: 'nl-NL', | 23 lang: 'nl-NL', |
24 body: 'Hello, world!', | 24 body: 'Hello, world!', |
25 tag: 'tag', | 25 tag: 'tag', |
26 // FIXME: Relative URLs for the icon attribute currently get refle
cted as | 26 // FIXME: Relative URLs for the icon attribute currently get refle
cted as |
27 // an absolute URL, which should probably be the given relative UR
L. | 27 // an absolute URL, which should probably be the given relative UR
L. |
28 icon: 'https://example/icon.png', | 28 icon: 'https://example/icon.png', |
29 vibrate: [100, 200, 300], | 29 vibrate: [100, 200, 300], |
30 silent: false, | 30 silent: false, |
| 31 requireInteraction: true, |
31 data: [ | 32 data: [ |
32 { property: 'foobar', | 33 { property: 'foobar', |
33 string: '\uDFFF\u0000\uDBFF', | 34 string: '\uDFFF\u0000\uDBFF', |
34 scalar: true }, | 35 scalar: true }, |
35 12.15 | 36 12.15 |
36 ], | 37 ], |
37 actions: [{ action: 'one', title: 'Action 1' }, | 38 actions: [{ action: 'one', title: 'Action 1' }, |
38 { action: 'two', title: 'Action 2' }, | 39 { action: 'two', title: 'Action 2' }, |
39 { action: 'three', title: 'Action 3' }] | 40 { action: 'three', title: 'Action 3' }] |
40 }; | 41 }; |
(...skipping 22 matching lines...) Expand all Loading... |
63 return; | 64 return; |
64 } | 65 } |
65 | 66 |
66 // (3) Listen for confirmation from the Service Worker that th
e | 67 // (3) Listen for confirmation from the Service Worker that th
e |
67 // notification has been clicked on. Make sure that all proper
ties | 68 // notification has been clicked on. Make sure that all proper
ties |
68 // set on the Notification object are as expected. | 69 // set on the Notification object are as expected. |
69 assert_equals(event.data.command, 'click', 'The notification w
as expected to be clicked.'); | 70 assert_equals(event.data.command, 'click', 'The notification w
as expected to be clicked.'); |
70 | 71 |
71 options.actions = options.actions.slice(0, Notification.maxAct
ions); | 72 options.actions = options.actions.slice(0, Notification.maxAct
ions); |
72 Object.keys(options).forEach(function(key) { | 73 Object.keys(options).forEach(function(key) { |
| 74 if (key == 'requireInteraction') { |
| 75 // TODO(johnme): requireInteraction is not yet seriali
zed properly. |
| 76 return; |
| 77 } |
73 if (typeof options[key] == 'object') | 78 if (typeof options[key] == 'object') |
74 assert_object_equals(event.data.notification[key], opt
ions[key], 'The ' + key + ' field must be the same.'); | 79 assert_object_equals(event.data.notification[key], opt
ions[key], 'The ' + key + ' field must be the same.'); |
75 else | 80 else |
76 assert_equals(event.data.notification[key], options[ke
y], 'The ' + key + ' field must be the same.'); | 81 assert_equals(event.data.notification[key], options[ke
y], 'The ' + key + ' field must be the same.'); |
77 }); | 82 }); |
78 | 83 |
79 test.done(); | 84 test.done(); |
80 }); | 85 }); |
81 }).catch(unreached_rejection(test)); | 86 }).catch(unreached_rejection(test)); |
82 | 87 |
83 }, 'Clicking on a notification displayed by a Service Worker the notificat
ionclick event.'); | 88 }, 'Clicking on a notification displayed by a Service Worker the notificat
ionclick event.'); |
84 </script> | 89 </script> |
85 </body> | 90 </body> |
86 </html> | 91 </html> |
OLD | NEW |