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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html

Issue 1417913002: Notifications: Improve SW notification property layout test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reflection.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reflection.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html
similarity index 72%
rename from third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reflection.html
rename to third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html
index 2c7283b7ec601a6666f6c67f535dbc4d6894a6d7..24e9df817f2f457f4936b73655614024af88e4bc 100644
--- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reflection.html
+++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notification-properties.html
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
- <title>Notifications: Property reflection in the "notificationclick" event.</title>
+ <title>Notifications: Property reflection in the "notificationclick" event and SWR.getNotifications().</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../serviceworker/resources/test-helpers.js"></script>
@@ -9,9 +9,9 @@
</head>
<body>
<script>
- // Tests that the notification available in the "notificationclick" event in the
- // Service Worker accurately reflects the attributes with which the notification
- // was created (for this test --) in the document.
+ // Tests that the notification object in a) the "notificationclick" event in the
+ // Service Worker, and b) ServiceWorkerRegistration.getNotifications(), both
+ // accurately reflect the attributes with which the notification was created.
async_test(function(test) {
var scope = 'resources/scope/' + location.pathname,
@@ -66,18 +66,31 @@
// (3) Listen for confirmation from the Service Worker that the
// notification has been clicked on. Make sure that all properties
- // set on the Notification object are as expected.
+ // set on the (cloned) Notification object are as expected.
Peter Beverloo 2015/10/21 13:29:00 no need for parenthesis
johnme 2015/10/21 14:21:18 Done.
assert_equals(event.data.command, 'click', 'The notification was expected to be clicked.');
options.actions = options.actions.slice(0, Notification.maxActions);
Object.keys(options).forEach(function(key) {
if (typeof options[key] == 'object')
- assert_object_equals(event.data.notification[key], options[key], 'The ' + key + ' field must be the same.');
+ assert_object_equals(event.data.notification[key], options[key], 'The ' + key + ' field must be the same in notificationclick events.');
else
- assert_equals(event.data.notification[key], options[key], 'The ' + key + ' field must be the same.');
+ assert_equals(event.data.notification[key], options[key], 'The ' + key + ' field must be the same in notificationclick events.');
});
- test.done();
+ // (4) Check that the properties are also set correctly on the
+ // (non-cloned) Notification object from getNotifications.
Peter Beverloo 2015/10/21 13:29:00 no need for parenthesis
johnme 2015/10/21 14:21:18 Done.
+ workerInfo.registration.getNotifications().then(function(notifications) {
+ assert_equals(notifications.length, 1);
+
+ Object.keys(options).forEach(function(key) {
Peter Beverloo 2015/10/21 13:29:00 Can we extract this to a function w/ an argument t
johnme 2015/10/21 14:21:18 Done.
+ if (typeof options[key] == 'object')
+ assert_object_equals(notifications[0][key], options[key], 'The ' + key + ' field must be the same in getNotifications.');
+ else
+ assert_equals(notifications[0][key], options[key], 'The ' + key + ' field must be the same in getNotifications.');
+ });
+
+ test.done();
+ });
});
}).catch(unreached_rejection(test));
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reflection.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698