blob: 6ee0ee21ef64d3c041aea28a96cfe806fe36be7f [file] [log] [blame]
<!doctype html>
<html>
<head>
<title>Notifications: Showing a notification with an image that 404s after a slow 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 creates a 404 response
// after a slow redirect works properly, and does not block the actual display of it.
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 with an image that 404s after a 200ms redirect.
return info.registration.showNotification(scope, {
body: 'Hello, world!',
icon: '/resources/slow-image.php?redirect_name=not_there.png&mimeType=image/png&sleep=200'
});
}).then(function() {
test.done();
}).catch(unreached_rejection(test));
}, 'Displaying a notification with an image that 404s after a slow redirect still resolves the promise.');
</script>
</body>
</html>