blob: f6b9a054f72d5d3ef0cc8a717939ffc7e098bb5a [file] [log] [blame]
<!doctype html>
<title>Notifications: Showing a notification with an image that takes some time to load.</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>
// Tests that showing a notification with an image that takes a non-trivial
// time to load still ends up resolving the 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 200ms to load.
return sendCommand(info.port, {
command: 'show',
title: 'My Notification',
options: { body: 'Hello, world!',
icon: '/resources/slow-image.php?redirect_name=square100.png&mimeType=image/png&sleep=200' }
}).then(function(data) {
// (2) Confirm that the service worker displayed the notification successfully.
}, 'Displaying a notification with an image that takes some time to load still resolves the promise.');