Index: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-redirect.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-redirect.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-redirect.html |
index 217a4cb03824a6300a0601f0bc0423c9016d6c34..bbce8195fed6477f11a8eb859f2df6e72500812c 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-redirect.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-redirect.html |
@@ -14,33 +14,24 @@ |
async_test(function(test) { |
var scope = 'resources/scope/' + location.pathname, |
- script = 'resources/instrumentation-service-worker.js'; |
+ 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. |
- info.port.postMessage({ |
+ 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); |
- info.port.addEventListener('message', function(event) { |
- if (typeof event.data != 'object' || !event.data.command) { |
- assert_unreached('Invalid message from the Service Worker.'); |
- return; |
- } |
- |
- // (2) Listen for confirmation from the Service Worker that the |
- // notification could be displayed as expected. |
- assert_equals(event.data.command, 'show'); |
- assert_true(event.data.success); |
- |
- test.done(); |
- }); |
+ test.done(); |
}).catch(unreached_rejection(test)); |
}, 'Displaying a notification with an image that redirects still resolves the promise.'); |