Index: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-no-permission.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-no-permission.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-no-permission.html |
index e5f5b3f6614bf492e6056e666fab3bb83265791a..94008cb1f5739570ca50f2cc51bb54b3c3fec3c9 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-no-permission.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-no-permission.html |
@@ -14,32 +14,23 @@ |
async_test(function(test) { |
var scope = 'resources/scope/serviceworkerregistration-service-worker-click', |
- script = 'resources/instrumentation-service-worker.js'; |
+ script = 'instrumentation-service-worker.js'; |
- getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(workerInfo) { |
+ getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) { |
// (1) Tell the Service Worker to display a Web Notification. |
- workerInfo.port.postMessage({ |
+ return sendCommand(info.port, { |
command: 'show', |
title: 'My Notification', |
options: { body: 'Hello, world!' } |
}); |
+ }).then(function(data) { |
+ // (2) Confirm that the service worker could not display the notification due to a |
+ // permission error. |
+ assert_false(data.success); |
+ assert_equals(data.message, 'No notification permission has been granted for this origin.'); |
- workerInfo.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 not be displayed because of a permission error. |
- assert_equals(event.data.command, 'show'); |
- |
- assert_false(event.data.success); |
- assert_equals(event.data.message, 'No notification permission has been granted for this origin.'); |
- |
- test.done(); |
- }); |
+ test.done(); |
}).catch(unreached_rejection(test)); |
}, 'showNotification() must reject if no Web Notification permission has been granted.'); |