Index: LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html |
diff --git a/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8721583682051930fee9fa95fad1ae02b6424836 |
--- /dev/null |
+++ b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html |
@@ -0,0 +1,34 @@ |
+<!doctype html> |
+<html> |
+ <head> |
+ <title>Notifications: Verifying the exception throwing behavior, when data set invalid value such as a method.</title> |
+ <script src="../resources/testharness.js"></script> |
+ <script src="../resources/testharnessreport.js"></script> |
+ <script src="../serviceworker/resources/test-helpers.js"></script> |
+ <script src="resources/test-helpers.js"></script> |
+ </head> |
+ <body> |
+ <script> |
+ // Tests that the showNotification() function rejects the returned promise with a |
+ // DataCloneError when data set invalid data such as a method. |
+ async_test(function(test) { |
+ var scope = 'resources/scope/' + location.pathname, |
+ script = 'resources/instrumentation-service-worker.js'; |
+ |
+ testRunner.setPermission('notifications', 'granted', location.origin, location.origin); |
+ |
+ getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(workerInfo) { |
+ assert_inherits(workerInfo.registration, 'showNotification', 'showNotification() must be exposed.'); |
+ workerInfo.registration.showNotification(scope, { |
+ data: function() { return 1; } |
+ }).then(unreached_fulfillment(test)) |
+ .catch(function(error) { |
+ assert_equals(error.name, 'DataCloneError'); |
+ test.done(); |
+ }); |
+ }).catch(unreached_rejection(test)); |
+ |
+ }, 'showNotification() must reject if data is invalid value.'); |
+ </script> |
+ </body> |
+</html> |