4 <title>Notifications: ServiceWorkerRegistration.showNotification() fails on too much data.
</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>
12 // Tests that the showNotification() function rejects the promise when the
13 // developer-provided data exceeds a megabyte. This is an implementation-
14 // defined limit to prevent abuse.
16 async_test(function(test
) {
17 var scope
= 'resources/scope/' + location
.pathname
,
18 script
= 'resources/instrumentation-service-worker.js';
20 testRunner
.setPermission('notifications', 'granted', location
.origin
, location
.origin
);
22 var workerInfo
= null;
23 getActiveServiceWorkerWithMessagePort(test
, script
, scope
).then(function(info
) {
26 // (1) Display a Web Notification from the document.
27 assert_inherits(workerInfo
.registration
, 'showNotification', 'showNotification() must be exposed.');
28 return workerInfo
.registration
.showNotification(scope
, {
29 body
: 'Hello, world!',
31 data
: new Array(1024 * 1024 * 2).join('.'), // 2 million dots
33 }).then(unreached_fulfillment(test
))
38 }, 'ServiceWorkerRegistration.showNotification() fails on too much data.');