Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reply-reflection.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-action-reflection.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reply-reflection.html |
| similarity index 57% |
| copy from third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-action-reflection.html |
| copy to third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reply-reflection.html |
| index 67c439072ce1ac8cd4c00cd54496462c91b32344..ad1cd833cad05ef1d9ac1c5ed6a37abfc2602031 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-action-reflection.html |
| +++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reply-reflection.html |
| @@ -1,7 +1,7 @@ |
| <!doctype html> |
| <html> |
| <head> |
| - <title>Notifications: Action reflection in the "notificationclick" event.</title> |
| + <title>Notifications: Reply reflection in the "notificationclick" event.</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../serviceworker/resources/test-helpers.js"></script> |
| @@ -9,8 +9,8 @@ |
| </head> |
| <body> |
| <script> |
| - // Tests that the action property of the "notificationclick" event in the |
| - // Service Worker accurately reflects which action was activated, if any. |
| + // Tests that the reply property of the "notificationclick" event in the |
| + // Service Worker accurately reflects the reply entered. |
| async_test(function(test) { |
| var scope = 'resources/scope/' + location.pathname; |
| @@ -18,18 +18,9 @@ |
| var port; |
| var options = { |
| - actions: [] |
| + actions: [{ action: 'actionName', title: 'ActionTitle', type: 'text' }] |
| }; |
| - var expectedActions = []; |
| - for (var i = 0; i < Notification.maxActions; ++i) { |
| - var action = { action: 'action' + i, title: 'Action ' + i }; |
| - options.actions.push(action); |
| - expectedActions.push(action.action); |
| - } |
| - // Expect empty string when main body of notification is activated. |
| - expectedActions.push(''); |
| - |
| testRunner.setPermission('notifications', 'granted', location.origin, location.origin); |
| getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) { |
| port = info.port; |
| @@ -44,25 +35,22 @@ |
| // (2) Confirm that the service worker displayed the notification successfully. |
| assert_true(data.success, 'The notification must have been displayed.'); |
| - // (3) Simulate a click on each button and on the notification body. |
| - for (var i = 0; i < options.actions.length; ++i) |
| - testRunner.simulateWebNotificationClick(scope, i); |
| - testRunner.simulateWebNotificationClick(scope, -1 /* action_index */); |
| + // (3) Simulate a reply to the notification text action. |
| + testRunner.simulateWebNotificationClickWithReply(scope, 0 /* action_index */, 'My reply.'); |
| port.addEventListener('message', function(event) { |
| // (4) Listen for confirmation from the Service Worker that the |
| - // notification has been clicked on. Make sure that the action |
| + // notification has been clicked on. Make sure that the reply |
| // property set on the NotificationEvent object is as expected. |
| assert_equals(event.data.command, 'click', 'The notification was expected to be clicked.'); |
| - assert_equals(event.data.action, expectedActions.shift()); |
| + assert_equals(event.data.reply, 'My reply.'); |
|
Peter Beverloo
2016/10/11 14:28:39
We should probably test the NULL-string and empty-
awdf
2016/10/12 14:59:45
Done the empty string case but not sure how to che
awdf
2016/10/13 13:17:29
Done.
|
| - if (expectedActions.length === 0) |
| - test.done(); |
| + test.done(); |
| }); |
| }).catch(unreached_rejection(test)); |
| - }, 'NotificationEvent action property should be reflect which action was clicked.'); |
| + }, 'NotificationEvent reply property should reflect the reply that was entered'); |
| </script> |
| </body> |
| </html> |