OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>Notifications: Check that showNotifications rejects if actions is set incorrectly.</title> | |
5 <script src="../resources/testharness.js"></script> | |
6 <script src="../resources/testharnessreport.js"></script> | |
7 <script src="../serviceworker/resources/test-helpers.js"></script> | |
8 <script src="resources/test-helpers.js"></script> | |
9 </head> | |
10 <body> | |
11 <script> | |
12 var scope = 'resources/scope/' + location.pathname, | |
Peter Beverloo
2015/07/30 16:24:07
Could you add a description, and scope |scope|/|sc
johnme
2015/07/31 16:08:51
Done.
| |
13 script = 'resources/instrumentation-service-worker.js'; | |
14 | |
15 testRunner.setPermission('notifications', 'granted', location.origin, loca tion.origin); | |
16 | |
17 async_test(function(test) { | |
18 | |
19 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) { | |
20 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.'); | |
21 | |
22 workerInfo.registration.showNotification('Title', { | |
23 actions: [{}] | |
24 }).then(unreached_fulfillment(test)).catch(function(error) { | |
25 assert_equals(error.name, 'TypeError'); | |
26 assert_equals(error.message, "Failed to execute 'showNotificat ion' on 'ServiceWorkerRegistration': required member title is undefined."); | |
27 test.done(); | |
28 }); | |
29 }).catch(unreached_rejection(test)); | |
30 | |
31 }, 'showNotification() must reject if an action has no title.'); | |
32 | |
33 async_test(function(test) { | |
34 | |
35 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) { | |
36 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.'); | |
37 | |
38 workerInfo.registration.showNotification('Title', { | |
39 actions: [{title: ""}] | |
40 }).then(unreached_fulfillment(test)).catch(function(error) { | |
41 assert_equals(error.name, 'TypeError'); | |
42 assert_equals(error.message, 'Notification action titles must not be empty.'); | |
43 test.done(); | |
44 }); | |
45 }).catch(unreached_rejection(test)); | |
46 | |
47 }, 'showNotification() must reject if an action has an empty title.'); | |
48 </script> | |
49 </body> | |
50 </html> | |
OLD | NEW |