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

Side by Side Diff: LayoutTests/http/tests/notifications/notification-properties.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
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Notifications: The Notification object exposes the expected propertie s.</title> 4 <title>Notifications: The Notification object exposes the expected propertie s.</title>
5 <script src="../resources/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="../resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 // Tests that the Notification object exposes the properties per the 10 // Tests that the Notification object exposes the properties per the
11 // semantics defined by the specification. When the test is being ran 11 // semantics defined by the specification. When the test is being ran
12 // manually, grant Notification permission first. 12 // manually, grant Notification permission first.
13 if (window.testRunner) 13 if (window.testRunner)
14 testRunner.clearWebNotificationPermissions(); 14 testRunner.clearWebNotificationPermissions();
15 15
16 test(function () { 16 test(function () {
17 var options = { 17 var options = {
18 dir: "rtl", 18 dir: "rtl",
19 lang: "nl-NL", 19 lang: "nl-NL",
20 body: "Hallo, wereld!", 20 body: "Hallo, wereld!",
21 tag: "notification", 21 tag: "notification",
22 icon: "http://localhost/my_icon.png", 22 icon: "http://localhost/my_icon.png",
23 silent: true 23 silent: true,
24 data: "my data"
24 }; 25 };
25 26
26 var notification = new Notification("My Notification", options); 27 var notification = new Notification("My Notification", options);
27 28
28 assert_equals(notification.title, "My Notification"); 29 assert_equals(notification.title, "My Notification");
29 assert_equals(notification.dir, options.dir); 30 assert_equals(notification.dir, options.dir);
30 assert_equals(notification.lang, options.lang); 31 assert_equals(notification.lang, options.lang);
31 assert_equals(notification.body, options.body); 32 assert_equals(notification.body, options.body);
32 assert_equals(notification.tag, options.tag); 33 assert_equals(notification.tag, options.tag);
33 assert_equals(notification.icon, options.icon); 34 assert_equals(notification.icon, options.icon);
34 assert_true(notification.silent); 35 assert_true(notification.silent);
36 assert_equals(notification.data, options.data);
35 37
36 var emptyNotification = new Notification("My Notification"); 38 var emptyNotification = new Notification("My Notification");
37 39
38 assert_equals(emptyNotification.title, "My Notification"); 40 assert_equals(emptyNotification.title, "My Notification");
39 assert_equals(emptyNotification.dir, "auto"); 41 assert_equals(emptyNotification.dir, "auto");
40 assert_equals(emptyNotification.lang, ""); 42 assert_equals(emptyNotification.lang, "");
41 assert_equals(emptyNotification.body, ""); 43 assert_equals(emptyNotification.body, "");
42 assert_equals(emptyNotification.tag, ""); 44 assert_equals(emptyNotification.tag, "");
43 assert_equals(emptyNotification.icon, ""); 45 assert_equals(emptyNotification.icon, "");
44 assert_false(emptyNotification.silent); 46 assert_false(emptyNotification.silent);
47 assert_equals(emptyNotification.data, null);
45 48
46 var invalidIconNotification = new Notification("My Notification", { 49 var invalidIconNotification = new Notification("My Notification", {
47 icon: "http://test:test/" 50 icon: "http://test:test/"
48 }); 51 });
49 52
50 // Invalid icon URLs should be reset to an empty string. 53 // Invalid icon URLs should be reset to an empty string.
51 assert_equals(invalidIconNotification.icon, ""); 54 assert_equals(invalidIconNotification.icon, "");
52 55
53 var serializedUrlNotification = new Notification("My Notification", { 56 var serializedUrlNotification = new Notification("My Notification", {
54 icon: "http://example.com" 57 icon: "http://example.com"
55 }); 58 });
56 59
57 // Icon URLs should be returned in serialized form. 60 // Icon URLs should be returned in serialized form.
58 assert_equals(serializedUrlNotification.icon, "http://example.com/") ; 61 assert_equals(serializedUrlNotification.icon, "http://example.com/") ;
59 62
60 var noTagNotification = new Notification("My Notification"), 63 var noTagNotification = new Notification("My Notification"),
61 emptyTagNotification = new Notification("My Notification", { tag : "" }); 64 emptyTagNotification = new Notification("My Notification", { tag : "" });
62 65
63 // Setting an empty string as the tag should be equal to not setting the tag at all. 66 // Setting an empty string as the tag should be equal to not setting the tag at all.
64 assert_equals(noTagNotification.tag, emptyTagNotification.tag); 67 assert_equals(noTagNotification.tag, emptyTagNotification.tag);
65 68
66 }, 'Checks the properties exposed on the Notification object.'); 69 }, 'Checks the properties exposed on the Notification object.');
67 </script> 70 </script>
68 </body> 71 </body>
69 </html> 72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698