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

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

Issue 1263043003: Add NotificationAction.action member (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@actions
Patch Set: Created 5 years, 4 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 test(function () { 13 test(function () {
14 var options = { 14 var options = {
15 dir: "rtl", 15 dir: "rtl",
16 lang: "nl-NL", 16 lang: "nl-NL",
17 body: "Hallo, wereld!", 17 body: "Hallo, wereld!",
18 tag: "notification", 18 tag: "notification",
19 icon: "http://localhost/my_icon.png", 19 icon: "http://localhost/my_icon.png",
20 silent: true, 20 silent: true,
21 data: "my data", 21 data: "my data",
22 actions: [{title: "Action 1"}, {title: "Action 2"}, {title: "Act ion 3"}] 22 actions: [{action: "one", title: "Action 1"},
23 {action: "two", title: "Action 2"},
24 {action: "three", title: "Action 3"}]
23 }; 25 };
24 26
25 var notification = new Notification("My Notification", options); 27 var notification = new Notification("My Notification", options);
26 28
27 assert_equals(notification.title, "My Notification"); 29 assert_equals(notification.title, "My Notification");
28 assert_equals(notification.dir, options.dir); 30 assert_equals(notification.dir, options.dir);
29 assert_equals(notification.lang, options.lang); 31 assert_equals(notification.lang, options.lang);
30 assert_equals(notification.body, options.body); 32 assert_equals(notification.body, options.body);
31 assert_equals(notification.tag, options.tag); 33 assert_equals(notification.tag, options.tag);
32 assert_equals(notification.icon, options.icon); 34 assert_equals(notification.icon, options.icon);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 Array.apply(null, new Array(99)).map(Number.prototype.valueO f, 10000)); 101 Array.apply(null, new Array(99)).map(Number.prototype.valueO f, 10000));
100 102
101 // Verifying the exception throwing behavior, when silent set true a nd vibrate is presented. 103 // Verifying the exception throwing behavior, when silent set true a nd vibrate is presented.
102 assert_throws(new TypeError(), function() { 104 assert_throws(new TypeError(), function() {
103 var notification = new Notification("My Notification", { 105 var notification = new Notification("My Notification", {
104 silent: true, 106 silent: true,
105 vibrate: 1000 107 vibrate: 1000
106 }); 108 });
107 }, 'Set vibrate, when silent is true.'); 109 }, 'Set vibrate, when silent is true.');
108 110
109 // Check exception is thrown when an action doesn't contain title, 111 // Check exception is thrown when an action doesn't contain
110 // or title is an empty string. 112 // action/title, or when action/title is an empty string.
111 assert_throws(new TypeError(), function() { 113 assert_throws(new TypeError(), function() {
112 var notification = new Notification("My Notification", { 114 var notification = new Notification("My Notification", {
113 actions: [{}] 115 actions: [{title: "Foo"}]
114 }); 116 });
115 }, 'Provide action without title.'); 117 }, 'NotificationAction without action.');
116 assert_throws(new TypeError(), function() { 118 assert_throws(new TypeError(), function() {
117 var notification = new Notification("My Notification", { 119 var notification = new Notification("My Notification", {
118 actions: [{title: ""}] 120 actions: [{action: "foo"}]
119 }); 121 });
120 }, 'Provide action with empty title.'); 122 }, 'NotificationAction without title.');
123 assert_throws(new TypeError(), function() {
124 var notification = new Notification("My Notification", {
125 actions: [{action: "", title: "Foo"}]
126 });
127 }, 'NotificationAction with empty action.');
128 assert_throws(new TypeError(), function() {
129 var notification = new Notification("My Notification", {
130 actions: [{action: "foo", title: ""}]
131 });
132 }, 'NotificationAction with empty title.');
121 133
122 }, 'Checks the properties exposed on the Notification object.'); 134 }, 'Checks the properties exposed on the Notification object.');
123 </script> 135 </script>
124 </body> 136 </body>
125 </html> 137 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698