| 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 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // Icon URLs should be returned in serialized form. | 60 // Icon URLs should be returned in serialized form. |
| 61 assert_equals(serializedUrlNotification.icon, "http://example.com/")
; | 61 assert_equals(serializedUrlNotification.icon, "http://example.com/")
; |
| 62 | 62 |
| 63 var noTagNotification = new Notification("My Notification"), | 63 var noTagNotification = new Notification("My Notification"), |
| 64 emptyTagNotification = new Notification("My Notification", { tag
: "" }); | 64 emptyTagNotification = new Notification("My Notification", { tag
: "" }); |
| 65 | 65 |
| 66 // Setting an empty string as the tag should be equal to not setting
the tag at all. | 66 // Setting an empty string as the tag should be equal to not setting
the tag at all. |
| 67 assert_equals(noTagNotification.tag, emptyTagNotification.tag); | 67 assert_equals(noTagNotification.tag, emptyTagNotification.tag); |
| 68 | 68 |
| 69 var vibrateNotification = new Notification("My Notification", { |
| 70 vibrate: 1000 |
| 71 }); |
| 72 |
| 73 // vibrate pattern should be returned in serialized form. |
| 74 assert_equals(1000, vibrateNotification.vibrate); |
| 75 |
| 76 // Tests that it must be a valid vibration sequence. |
| 77 var pattern = new Array(100, 200, 300); |
| 78 var sequenceVibrateNotification = new Notification("My Notification"
, { |
| 79 vibrate: pattern |
| 80 }); |
| 81 assert_array_equals(pattern, sequenceVibrateNotification.vibrate); |
| 82 |
| 83 // Invalid vibrate pattern should be reset to 0. |
| 84 var invalidVibrateNotification = new Notification("My Notification",
{ |
| 85 vibrate: [100, 200, "invalid"] |
| 86 }); |
| 87 assert_array_equals([100, 200, 0], invalidVibrateNotification.vibrat
e); |
| 88 |
| 89 // Verifying the exception throwing behavior, when slient set true a
nd vibrate is presented. |
| 90 assert_throws(new TypeError(), function() { |
| 91 var notification = new Notification("My Notification", { |
| 92 silent: true, |
| 93 vibrate: 1000 |
| 94 }); |
| 95 }, 'Set vibrate, when slient is true.'); |
| 96 |
| 69 }, 'Checks the properties exposed on the Notification object.'); | 97 }, 'Checks the properties exposed on the Notification object.'); |
| 70 </script> | 98 </script> |
| 71 </body> | 99 </body> |
| 72 </html> | 100 </html> |
| OLD | NEW |