Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: LayoutTests/http/tests/notifications/notification-properties.html

Issue 1042513002: Add the vibrate attribute to the Notification object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a70e818510478fc4a550c742f9e47697a210b247..f4e1aebdd0275ef3bbc19826ad1b5e60ce59ab99 100644
--- a/LayoutTests/http/tests/notifications/notification-properties.html
+++ b/LayoutTests/http/tests/notifications/notification-properties.html
@@ -32,6 +32,7 @@
assert_equals(notification.body, options.body);
assert_equals(notification.tag, options.tag);
assert_equals(notification.icon, options.icon);
+ assert_equals(notification.vibrate, null);
Peter Beverloo 2015/04/09 13:03:17 nit: Please add a value to |options| for this asse
Sanghyun Park 2015/04/09 13:48:05 Currently options.silent set true in this. If vib
Peter Beverloo 2015/04/09 13:53:07 That seems good to me!
assert_true(notification.silent);
assert_equals(notification.data, options.data);
@@ -43,6 +44,7 @@
assert_equals(emptyNotification.body, "");
assert_equals(emptyNotification.tag, "");
assert_equals(emptyNotification.icon, "");
+ assert_equals(notification.vibrate, null);
assert_false(emptyNotification.silent);
assert_equals(emptyNotification.data, null);
@@ -66,6 +68,34 @@
// Setting an empty string as the tag should be equal to not setting the tag at all.
assert_equals(noTagNotification.tag, emptyTagNotification.tag);
+ var vibrateNotification = new Notification("My Notification", {
+ vibrate: 1000
+ });
+
+ // vibrate pattern should be returned in serialized form.
+ assert_array_equals([1000], vibrateNotification.vibrate);
Peter Beverloo 2015/04/09 13:03:17 nit: In testharness, the argument order for assert
Sanghyun Park 2015/04/09 13:48:05 Done.
+
+ // Tests that it must be a valid vibration sequence.
+ var pattern = new Array(100, 200, 300);
+ var sequenceVibrateNotification = new Notification("My Notification", {
+ vibrate: pattern
+ });
+ assert_array_equals(pattern, sequenceVibrateNotification.vibrate);
+
+ // Invalid vibrate pattern should be reset to 0.
+ var invalidVibrateNotification = new Notification("My Notification", {
+ vibrate: [100, 200, "invalid"]
+ });
+ assert_array_equals([100, 200, 0], invalidVibrateNotification.vibrate);
+
+ // Verifying the exception throwing behavior, when slient set true and vibrate is presented.
+ assert_throws(new TypeError(), function() {
+ var notification = new Notification("My Notification", {
+ silent: true,
+ vibrate: 1000
+ });
+ }, 'Set vibrate, when slient is true.');
+
}, 'Checks the properties exposed on the Notification object.');
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698