| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Notifications: Verifying the exception throwing behavior, when data s
et invalid value such as a method.</title> | 4 <title>Notifications: Verifying the exception throwing behavior, when data s
et invalid value such as a method.</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> |
| 11 <script> | 11 <script> |
| 12 // Tests that the showNotification() function rejects the returned promise
with a | 12 // Tests that the showNotification() function rejects the returned promise
with a |
| 13 // DataCloneError when data set invalid data such as a method. | 13 // DataCloneError when data set invalid data such as a method. |
| 14 async_test(function(test) { | 14 async_test(function(test) { |
| 15 var scope = 'resources/scope/' + location.pathname, | 15 var scope = 'resources/scope/' + location.pathname, |
| 16 script = 'resources/instrumentation-service-worker.js'; | 16 script = 'instrumentation-service-worker.js'; |
| 17 | 17 |
| 18 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); | 18 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); |
| 19 | 19 |
| 20 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi
on(workerInfo) { | 20 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi
on(workerInfo) { |
| 21 assert_inherits(workerInfo.registration, 'showNotification', 'show
Notification() must be exposed.'); | 21 assert_inherits(workerInfo.registration, 'showNotification', 'show
Notification() must be exposed.'); |
| 22 workerInfo.registration.showNotification(scope, { | 22 workerInfo.registration.showNotification(scope, { |
| 23 data: function() { return 1; } | 23 data: function() { return 1; } |
| 24 }).then(unreached_fulfillment(test)) | 24 }).then(unreached_fulfillment(test)) |
| 25 .catch(function(error) { | 25 .catch(function(error) { |
| 26 assert_equals(error.name, 'DataCloneError'); | 26 assert_equals(error.name, 'DataCloneError'); |
| 27 test.done(); | 27 test.done(); |
| 28 }); | 28 }); |
| 29 }).catch(unreached_rejection(test)); | 29 }).catch(unreached_rejection(test)); |
| 30 | 30 |
| 31 }, 'showNotification() must reject if data is invalid value.'); | 31 }, 'showNotification() must reject if data is invalid value.'); |
| 32 </script> | 32 </script> |
| 33 </body> | 33 </body> |
| 34 </html> | 34 </html> |
| OLD | NEW |