Index: LayoutTests/http/tests/notifications/notification-properties.html |
diff --git a/LayoutTests/http/tests/notifications/notification-properties.html b/LayoutTests/http/tests/notifications/notification-properties.html |
index f54a903dc501b4142c5e42c88db5ef32ee43ea90..f57edca70c52dcd8439b8a31b1230db63f81955b 100644 |
--- a/LayoutTests/http/tests/notifications/notification-properties.html |
+++ b/LayoutTests/http/tests/notifications/notification-properties.html |
@@ -18,7 +18,8 @@ |
tag: "notification", |
icon: "http://localhost/my_icon.png", |
silent: true, |
- data: "my data" |
+ data: "my data", |
+ actions: [{title: "Action 1"}, {title: "Action 2"}, {title: "Action 3"}] |
}; |
var notification = new Notification("My Notification", options); |
@@ -31,6 +32,8 @@ |
assert_equals(notification.icon, options.icon); |
assert_true(notification.silent); |
assert_equals(notification.data, options.data); |
+ // We only support 2 actions; the rest should be skipped. |
+ assert_object_equals(notification.actions, options.actions.slice(0, 2)); |
Peter Beverloo
2015/07/30 16:24:07
Could you add a line testing that we can modify no
Peter Beverloo
2015/07/30 16:24:07
Please do not assume "2", and actually check Notif
johnme
2015/07/31 15:10:10
Done.
johnme
2015/07/31 15:10:10
Actually, no, we can't modify notification.actions
|
var emptyNotification = new Notification("My Notification"); |
@@ -43,6 +46,7 @@ |
assert_equals(notification.vibrate, null); |
assert_false(emptyNotification.silent); |
assert_equals(emptyNotification.data, null); |
+ assert_array_equals(emptyNotification.actions, []); |
var invalidIconNotification = new Notification("My Notification", { |
icon: "http://test:test/" |
@@ -102,6 +106,19 @@ |
}); |
}, 'Set vibrate, when silent is true.'); |
+ // Check exception is thrown when an action doesn't contain title, |
+ // or title is an empty string. |
+ assert_throws(new TypeError(), function() { |
+ var notification = new Notification("My Notification", { |
+ actions: [{}] |
+ }); |
+ }, 'Provide action without title.'); |
+ assert_throws(new TypeError(), function() { |
+ var notification = new Notification("My Notification", { |
+ actions: [{title: ""}] |
+ }); |
+ }, 'Provide action with empty title.'); |
+ |
}, 'Checks the properties exposed on the Notification object.'); |
</script> |
</body> |