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

Side by Side Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-document-actions-throw.html

Issue 1260793007: Generalize validation of developer input for Web Notifications (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix actions 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 | Annotate | Revision Log
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Notifications: Check that showNotifications rejects if actions is set incorrectly.</title> 4 <title>Notifications: Check that showNotifications rejects if actions is set incorrectly.</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 <script src="../serviceworker/resources/test-helpers.js"></script> 7 <script src="../serviceworker/resources/test-helpers.js"></script>
8 <script src="resources/test-helpers.js"></script> 8 <script src="resources/test-helpers.js"></script>
9 </head> 9 </head>
10 <body> 10 <body>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 async_test(function(test) { 52 async_test(function(test) {
53 var scope = 'resources/scope/' + location.pathname + "/emptyaction"; 53 var scope = 'resources/scope/' + location.pathname + "/emptyaction";
54 54
55 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) { 55 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) {
56 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.'); 56 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.');
57 57
58 workerInfo.registration.showNotification('Title', { 58 workerInfo.registration.showNotification('Title', {
59 actions: [{ action: "", title: "Foo" }] 59 actions: [{ action: "", title: "Foo" }]
60 }).then(unreached_fulfillment(test)).catch(function(error) { 60 }).then(unreached_fulfillment(test)).catch(function(error) {
61 assert_equals(error.name, 'TypeError'); 61 assert_equals(error.name, 'TypeError');
62 assert_equals(error.message, 'NotificationAction action must n ot be empty.'); 62 assert_equals(error.message, "Failed to execute 'showNotificat ion' on 'ServiceWorkerRegistration': NotificationAction `action` must not be emp ty.");
63 test.done(); 63 test.done();
64 }); 64 });
65 }).catch(unreached_rejection(test)); 65 }).catch(unreached_rejection(test));
66 66
67 }, 'showNotification() must reject if a NotificationAction has an empty ac tion.'); 67 }, 'showNotification() must reject if a NotificationAction has an empty ac tion.');
68 68
69 async_test(function(test) { 69 async_test(function(test) {
70 var scope = 'resources/scope/' + location.pathname + "/emptytitle"; 70 var scope = 'resources/scope/' + location.pathname + "/emptytitle";
71 71
72 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) { 72 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) {
73 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.'); 73 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.');
74 74
75 workerInfo.registration.showNotification('Title', { 75 workerInfo.registration.showNotification('Title', {
76 actions: [{ action: "foo", title: "" }] 76 actions: [{ action: "foo", title: "" }]
77 }).then(unreached_fulfillment(test)).catch(function(error) { 77 }).then(unreached_fulfillment(test)).catch(function(error) {
78 assert_equals(error.name, 'TypeError'); 78 assert_equals(error.name, 'TypeError');
79 assert_equals(error.message, 'NotificationAction title must no t be empty.'); 79 assert_equals(error.message, "Failed to execute 'showNotificat ion' on 'ServiceWorkerRegistration': NotificationAction `title` must not be empt y.");
80 test.done(); 80 test.done();
81 }); 81 });
82 }).catch(unreached_rejection(test)); 82 }).catch(unreached_rejection(test));
83 83
84 }, 'showNotification() must reject if a NotificationAction has an empty ti tle.'); 84 }, 'showNotification() must reject if a NotificationAction has an empty ti tle.');
85 </script> 85 </script>
86 </body> 86 </body>
87 </html> 87 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698