Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-no-permission.html

Issue 1907443007: Use promises in notifications tests and enable controlling the page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Address peter's comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-slow-404.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.');
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-slow-404.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698