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

Unified Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-throw.html

Issue 1095093002: Add layouttest for notification properties of persistent notification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698