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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-redirect.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
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.');

Powered by Google App Engine
This is Rietveld 408576698