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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 vibrate: pattern | 77 vibrate: pattern |
78 }); | 78 }); |
79 assert_array_equals(sequenceVibrateNotification.vibrate, pattern); | 79 assert_array_equals(sequenceVibrateNotification.vibrate, pattern); |
80 | 80 |
81 // Invalid vibrate pattern should be reset to 0. | 81 // Invalid vibrate pattern should be reset to 0. |
82 var invalidVibrateNotification = new Notification("My Notification",
{ | 82 var invalidVibrateNotification = new Notification("My Notification",
{ |
83 vibrate: [100, 200, "invalid"] | 83 vibrate: [100, 200, "invalid"] |
84 }); | 84 }); |
85 assert_array_equals(invalidVibrateNotification.vibrate, [100, 200, 0
]); | 85 assert_array_equals(invalidVibrateNotification.vibrate, [100, 200, 0
]); |
86 | 86 |
| 87 // Invalid vibrate pattern should be sanitized. |
| 88 // 1. If the vibration pattern is longer than 100 then truncate it. |
| 89 // 2. If the last item in the vibration pattern is a pause then disc
ard it. |
| 90 // 3. If any pattern entry is longer than 10000 then truncate it. |
| 91 var sanitizedVibrateNotification = new Notification("My Notification
", { |
| 92 vibrate: Array.apply(null, new Array(101)).map(Number.prototype.
valueOf, 20000) |
| 93 }); |
| 94 assert_array_equals(sanitizedVibrateNotification.vibrate, |
| 95 Array.apply(null, new Array(99)).map(Number.prototype.valueO
f, 10000)); |
| 96 |
87 // Verifying the exception throwing behavior, when silent set true a
nd vibrate is presented. | 97 // Verifying the exception throwing behavior, when silent set true a
nd vibrate is presented. |
88 assert_throws(new TypeError(), function() { | 98 assert_throws(new TypeError(), function() { |
89 var notification = new Notification("My Notification", { | 99 var notification = new Notification("My Notification", { |
90 silent: true, | 100 silent: true, |
91 vibrate: 1000 | 101 vibrate: 1000 |
92 }); | 102 }); |
93 }, 'Set vibrate, when silent is true.'); | 103 }, 'Set vibrate, when silent is true.'); |
94 | 104 |
95 }, 'Checks the properties exposed on the Notification object.'); | 105 }, 'Checks the properties exposed on the Notification object.'); |
96 </script> | 106 </script> |
97 </body> | 107 </body> |
98 </html> | 108 </html> |
OLD | NEW |