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

Unified Diff: LayoutTests/http/tests/notifications/service-worker-show-notification-click.html

Issue 868053003: Expose ServiceWorkerRegistration.showNotification() in Service Workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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: LayoutTests/http/tests/notifications/service-worker-show-notification-click.html
diff --git a/LayoutTests/http/tests/notifications/service-worker-show-notification-click.html b/LayoutTests/http/tests/notifications/service-worker-show-notification-click.html
deleted file mode 100644
index 9154bbe5b040be277b8e30ed8a4095f68be7b178..0000000000000000000000000000000000000000
--- a/LayoutTests/http/tests/notifications/service-worker-show-notification-click.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <title>Notifications: ServiceWorkerRegistration.showNotification().</title>
- <script src="../resources/testharness.js"></script>
- <script src="../resources/testharnessreport.js"></script>
- <script src="../serviceworker/resources/test-helpers.js"></script>
- </head>
- <body>
- <script>
- // Tests that the showNotification() function resolves a promise, and that the
- // notificationclick event gets fired on the Service Worker when we simulate a
- // click on it. This test requires the test runner.
-
- async_test(function (test) {
- var scope = 'resources/scope/service-worker-show-notification-click',
- workerUrl = 'resources/click-forward-service-worker.js';
-
- testRunner.grantWebNotificationPermission(location.origin, true);
-
- var registration = null,
- messagePort = null;
- service_worker_unregister_and_register(test, workerUrl, scope).then(function (swRegistration) {
- registration = swRegistration;
- return wait_for_state(test, registration.installing, 'activated');
- }).then(function () {
- assert_not_equals(registration.active, null, 'The Service Worker needs to be activated.');
- return new Promise(function (resolve) {
- var messageChannel = new MessageChannel();
- messageChannel.port1.addEventListener('message', function(event) {
- if (event.data == 'ready')
- resolve();
- });
-
- registration.active.postMessage(messageChannel.port2, [messageChannel.port2]);
-
- messagePort = messageChannel.port1;
- messagePort.start();
- });
- }).then(function () {
- assert_inherits(registration, 'showNotification', 'showNotification() must be exposed.');
- return registration.showNotification(scope, {
- body: 'Hello, world!',
- icon: '/icon.png'
- });
- }).then(function () {
- messagePort.addEventListener('message', function(event) {
- assert_equals(event.data, 'Clicked on Notification: ' + scope);
- service_worker_unregister_and_done(test, scope);
- });
-
- testRunner.simulateWebNotificationClick(scope);
-
- }).catch(unreached_rejection(test));
-
- }, 'Clicking on a notification displayed through showNotification() fires a Service Worker event.');
- </script>
- </body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698