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

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: Fix layout test failures. 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/notification-properties.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
14 function assertNotificationDataReflects(value) {
15 var notification = new Notification('Title', { data: value });
16
17 if (Array.isArray(value))
18 assert_object_equals(notification.data, value);
19 else if (typeof value === 'object')
20 assert_array_equals(notification.data, value);
21 else
22 assert_equals(notification.data, value);
23 }
24
25 test(function () {
26 // Set notification's data of several type to a structured clone of opti ons's data.
27 assertNotificationDataReflects(true); // Check Boolean type
28 assertNotificationDataReflects(1024); // Check Number type
29 assertNotificationDataReflects(Number.NaN); // Check Number.NaN type
30 assertNotificationDataReflects('any data'); // Check String type
31
32 var cars = new Array('Saab', 'Volvo', 'BMW');
33 assertNotificationDataReflects(cars); // Check Array type
34
35 var obj = { first: 'first', second: 'second'};
36 assertNotificationDataReflects(obj); // Check Object
37
38 // Verifying the exception throwing behavior of the method.
39 assert_throws('DataCloneError', function() {
40 var notification = new Notification('Title', { data: function() { re turn 1; } });
41 }, 'Set function in data');
42
43 }, 'Checks the data of several type property exposed on the Notification obj ect.');
44 </script>
45 </body>
46 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/notification-properties.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698