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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclose-event-data-reflection.html

Issue 1656823002: Add layout tests for ServiceWorker's notificationclose event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now the test actually works Created 4 years, 11 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/serviceworker-notificationclose-event-data-reflection.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-data-reflection.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclose-event-data-reflection.html
similarity index 81%
copy from third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-data-reflection.html
copy to third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclose-event-data-reflection.html
index 693f0ac6eeabfe5133ff46f6e17889ef50b845c6..9d2a4c66667207ead7a4c1a401431657deb2aac6 100644
--- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-data-reflection.html
+++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclose-event-data-reflection.html
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
- <title>Notifications: data property reflection in the "notificationclick" event.</title>
+ <title>Notifications: Action reflection in the "notificationclose" event.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../serviceworker/resources/test-helpers.js"></script>
@@ -9,9 +9,8 @@
</head>
<body>
<script>
- // Tests that the notification available in the "notificationclick" event in the
- // Service Worker accurately reflects the data attributes of several type
- // with which the notification was created (for this test --) in the document.
+ // Tests that the action property of the "notificationclose" event in the
+ // Service Worker accurately reflects which action was activated, if any.
async_test(function(test) {
var scope = 'resources/scope/' + location.pathname,
@@ -54,14 +53,14 @@
// notification's display promise has been resolved.
if (event.data.command == 'show') {
assert_true(event.data.success, 'The notification must have been displayed.');
- testRunner.simulateWebNotificationClick(scope, -1 /* action_index */);
Peter Beverloo 2016/02/02 23:50:10 Can we perhaps generalize the data reflection test
Nina 2016/02/03 15:04:23 I refactored the logic into a different file and e
+ testRunner.simulateWebNotificationClose(scope, true /* by_user */);
return;
}
// (3) Listen for confirmation from the Service Worker that the
- // notification has been clicked on. Make sure that all properties
+ // notification has been closed. Make sure that all properties
// set on the Notification object are as expected.
- assert_equals(event.data.command, 'click', 'The notification was expected to be clicked.');
+ assert_equals(event.data.command, 'close', 'The notification was expected to be closed.');
var pos = event.data.notification.tag;
@@ -79,7 +78,7 @@
assertNotificationDataReflects(0);
}).catch(unreached_rejection(test));
- }, 'Clicking on a notification displayed by a Service Worker the notificationclick event.');
+ }, 'NotificationEvent data property should be reflected when the notification is closed by the user.');
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698