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

Side by Side Diff: LayoutTests/http/tests/notifications/notification-data-property.html

Issue 993893002: Add the data attribute to the Notification object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Notifications: The Notification object exposes the expected data prop erty.</title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10 // Tests that the Notification object exposes the data property per the
11 // semantics defined by the specification. When the test is being ran
12 // manually, grant Notification permission first.
13 if (window.testRunner)
Peter Beverloo 2015/03/13 12:12:07 nit: this isn't really necessary. The test would w
Sanghyun Park 2015/03/13 17:47:31 I'll remove this.
14 testRunner.clearWebNotificationPermissions();
15
16 function assertNotificationDataReflects(value) {
17 var notification = new Notification('Title', { data: value });
18
19 if (Array.isArray(value))
20 assert_object_equals(notification.data, value);
21 else if (typeof value === 'object')
22 assert_array_equals(notification.data, value);
23 else
24 assert_equals(notification.data, value);
25 }
26
27 test(function () {
28 // Set notification's data of several type to a structured clone of opti ons's data.
29 assertNotificationDataReflects(true); // Check Boolean type
30 assertNotificationDataReflects(1024); // Check Number type
31 assertNotificationDataReflects(Number.NaN); // Check Number.NaN type
32 assertNotificationDataReflects('any data'); // Check String type
33
34 var cars = new Array('Saab', 'Volvo', 'BMW');
35 assertNotificationDataReflects(cars); // Check Array type
36
37 var obj = { first: 'first', second: 'second'};
38 assertNotificationDataReflects(obj); // Check Object
39
40 // Verifying the exception throwing behavior of the method.
41 assert_throws('DataCloneError', function() {
42 var notification = new Notification('Title', { data: function() { re turn 1; } });
43 }, 'Set function in data');
44
45 }, 'Checks the data of several type property exposed on the Notification obj ect.');
46 </script>
47 </body>
48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698