| Index: LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
|
| diff --git a/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6f2f52f40927a851e64966042d1798a96f02f8ce
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
|
| @@ -0,0 +1,41 @@
|
| +<!doctype html>
|
| +<html>
|
| + <head>
|
| + <title>Notifications: ServiceWorkerRegistration.showNotification() fails on too much data.</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 promise when the
|
| + // developer-provided data exceeds a megabyte. This is an implementation-
|
| + // defined limit to prevent abuse.
|
| +
|
| + async_test(function(test) {
|
| + var scope = 'resources/scope/' + location.pathname,
|
| + script = 'resources/instrumentation-service-worker.js';
|
| +
|
| + testRunner.grantWebNotificationPermission(location.origin, true);
|
| +
|
| + var workerInfo = null;
|
| + getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) {
|
| + workerInfo = info;
|
| +
|
| + // (1) Display a Web Notification from the document.
|
| + assert_inherits(workerInfo.registration, 'showNotification', 'showNotification() must be exposed.');
|
| + return workerInfo.registration.showNotification(scope, {
|
| + body: 'Hello, world!',
|
| + icon: '/icon.png',
|
| + data: new Array(1024 * 1024 * 2).join('.'), // 2 million dots
|
| + });
|
| + }).then(unreached_fulfillment(test))
|
| + .catch(function() {
|
| + test.done();
|
| + });
|
| +
|
| + }, 'ServiceWorkerRegistration.showNotification() fails on too much data.');
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|