| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Notifications: The Notification object exposes the expected propertie
s.</title> | 4 <title>Notifications: The Notification object exposes the expected propertie
s.</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 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <script> | 9 <script> |
| 10 // Tests that the Notification object exposes the properties per the | 10 // Tests that the Notification object exposes the properties per the |
| 11 // semantics defined by the specification. When the test is being ran | 11 // semantics defined by the specification. When the test is being ran |
| 12 // manually, grant Notification permission first. | 12 // manually, grant Notification permission first. |
| 13 test(function () { | 13 test(function () { |
| 14 assert_greater_than_equal(Notification.maxActions, 0); | 14 assert_greater_than_equal(Notification.maxActions, 0); |
| 15 | 15 |
| 16 var options = { | 16 var options = { |
| 17 dir: "rtl", | 17 dir: "rtl", |
| 18 lang: "nl-NL", | 18 lang: "nl-NL", |
| 19 body: "Hallo, wereld!", | 19 body: "Hallo, wereld!", |
| 20 tag: "notification", | 20 tag: "notification", |
| 21 icon: "http://localhost/my_icon.png", | 21 icon: "http://localhost/my_icon.png", |
| 22 silent: true, | 22 silent: true, |
| 23 data: "my data", | 23 data: "my data", |
| 24 actions: [] | 24 actions: [] |
| 25 }; | 25 }; |
| 26 // Deliberately add more actions than are supported. | 26 // Deliberately add more actions than are supported. |
| 27 for (var i = 0; i < 2 * Notification.maxActions; i++) { | 27 for (var i = 0; i < 2 * Notification.maxActions; i++) { |
| 28 options.actions.push({ | 28 options.actions.push({ |
| 29 action: i, | 29 action: "" + i, |
| 30 title: "Action " + i | 30 title: "Action " + i |
| 31 }); | 31 }); |
| 32 } | 32 } |
| 33 | 33 |
| 34 var notification = new Notification("My Notification", options); | 34 var notification = new Notification("My Notification", options); |
| 35 | 35 |
| 36 assert_equals(notification.title, "My Notification"); | 36 assert_equals(notification.title, "My Notification"); |
| 37 assert_equals(notification.dir, options.dir); | 37 assert_equals(notification.dir, options.dir); |
| 38 assert_equals(notification.lang, options.lang); | 38 assert_equals(notification.lang, options.lang); |
| 39 assert_equals(notification.body, options.body); | 39 assert_equals(notification.body, options.body); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 assert_throws(new TypeError(), function() { | 144 assert_throws(new TypeError(), function() { |
| 145 var notification = new Notification("My Notification", { | 145 var notification = new Notification("My Notification", { |
| 146 actions: [{action: "foo", title: ""}] | 146 actions: [{action: "foo", title: ""}] |
| 147 }); | 147 }); |
| 148 }, 'NotificationAction with empty title.'); | 148 }, 'NotificationAction with empty title.'); |
| 149 | 149 |
| 150 }, 'Checks the properties exposed on the Notification object.'); | 150 }, 'Checks the properties exposed on the Notification object.'); |
| 151 </script> | 151 </script> |
| 152 </body> | 152 </body> |
| 153 </html> | 153 </html> |
| OLD | NEW |