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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-get-filter.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-get-filter.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-get-filter.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-get-filter.html
index 94facb36bacfa0577a54dcfb4f9af9edb98a826b..d676333bfd97ef795b8748452da351c2202c52e8 100644
--- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-get-filter.html
+++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-get-filter.html
@@ -14,7 +14,7 @@
// the same Service Worker registration id.
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);
@@ -33,33 +33,25 @@
tag: 'strawberry',
});
}).then(function() {
- // (2) Request the Service Worker to give us all notifications.
- info.port.postMessage({
+ // (2) Request the Service Worker to give us a filtered list of notifications.
+ return sendCommand(info.port, {
command: 'get',
filter: {
tag: 'strawberry',
}
});
+ }).then(function(data) {
+ // (3) Confirm that the Service Worker was able to get the one matching notification.
+ 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;
- }
-
- // (3) Confirm that the Service Worker was able to read both of them.
- assert_equals(event.data.command, 'get');
- assert_true(event.data.success);
+ var notifications = data.notifications;
- var notifications = event.data.notifications;
+ assert_equals(notifications.length, 1);
- assert_equals(notifications.length, 1);
+ assert_equals(notifications[0].title, 'Hello again, world!');
+ assert_equals(notifications[0].body, 'Second notification');
- assert_equals(notifications[0].title, 'Hello again, world!');
- assert_equals(notifications[0].body, 'Second notification');
-
- test.done();
- });
+ test.done();
}).catch(unreached_rejection(test));
}, 'ServiceWorkerRegistration.getNotifications() returns the opened notifications within a Service Worker with a filter.');

Powered by Google App Engine
This is Rietveld 408576698