12345678910111213141516171819202122232425262728293031323334353637383940 |
- <!doctype html>
- <html>
- <head>
- <title>Notifications: Showing a notification with an image having a redirect.</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 showing a notification with an image that redirect to another
- // location will still resolve the showNotification() promise.
- async_test(function(test) {
- var scope = 'resources/scope/' + location.pathname,
- script = 'instrumentation-service-worker.js';
- testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
- getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) {
- // (1) Display a Web Notification through the Service Worker with
- // an image that takes redirects to another image.
- return sendCommand(info.port, {
- command: 'show',
- title: 'My Notification',
- options: { body: 'Hello, world!',
- icon: '/resources/redirect.php?url=square100.png&refresh=0' }
- });
- }).then(function(data) {
- // (2) Confirm that the service worker displayed the notification successfully.
- assert_true(data.success);
- test.done();
- }).catch(unreached_rejection(test));
- }, 'Displaying a notification with an image that redirects still resolves the promise.');
- </script>
- </body>
- </html>
|