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

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: 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/serviceworkerregistration-document-vibrate-throw.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..62fdc3808b8561bc7952b9ae6a29e55125a5d432 100644
--- a/LayoutTests/http/tests/notifications/notification-properties.html
+++ b/LayoutTests/http/tests/notifications/notification-properties.html
@@ -43,6 +43,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 +67,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(vibrateNotification.vibrate, [1000]);
+
+ // 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(sequenceVibrateNotification.vibrate, pattern);
+
+ // Invalid vibrate pattern should be reset to 0.
+ var invalidVibrateNotification = new Notification("My Notification", {
+ vibrate: [100, 200, "invalid"]
+ });
+ assert_array_equals(invalidVibrateNotification.vibrate, [100, 200, 0]);
+
+ // Verifying the exception throwing behavior, when silent set true and vibrate is presented.
+ assert_throws(new TypeError(), function() {
+ var notification = new Notification("My Notification", {
+ silent: true,
+ vibrate: 1000
+ });
+ }, 'Set vibrate, when silent is true.');
+
}, 'Checks the properties exposed on the Notification object.');
</script>
</body>
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/serviceworkerregistration-document-vibrate-throw.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698