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

Side by Side Diff: LayoutTests/http/tests/notifications/resources/instrumentation-service-worker.js

Issue 1264403002: Test that NotificationEvent.action is set correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@click_actions1
Patch Set: Rebase Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-action-reflection.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 importScripts('/resources/testharness-helpers.js'); 1 importScripts('/resources/testharness-helpers.js');
2 2
3 // Copies the serializable attributes of |notification|. 3 // Copies the serializable attributes of |notification|.
4 function cloneNotification(notification) { 4 function cloneNotification(notification) {
5 return JSON.parse(stringifyDOMObject(notification)); 5 return JSON.parse(stringifyDOMObject(notification));
6 } 6 }
7 7
8 // Allows a document to exercise the Notifications API within a service worker b y sending commands. 8 // Allows a document to exercise the Notifications API within a service worker b y sending commands.
9 var messagePort = null; 9 var messagePort = null;
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // immediately by the Service Worker. 70 // immediately by the Service Worker.
71 if (event.notification.body.indexOf('ACTION:CLOSE') != -1) 71 if (event.notification.body.indexOf('ACTION:CLOSE') != -1)
72 event.notification.close(); 72 event.notification.close();
73 73
74 // Notifications containing "ACTION:OPENWINDOW" in their message will attemp t 74 // Notifications containing "ACTION:OPENWINDOW" in their message will attemp t
75 // to open a new window for an example URL. 75 // to open a new window for an example URL.
76 if (event.notification.body.indexOf('ACTION:OPENWINDOW') != -1) 76 if (event.notification.body.indexOf('ACTION:OPENWINDOW') != -1)
77 event.waitUntil(clients.openWindow('https://example.com/')); 77 event.waitUntil(clients.openWindow('https://example.com/'));
78 78
79 messagePort.postMessage({ command: 'click', 79 messagePort.postMessage({ command: 'click',
80 notification: notificationCopy }); 80 notification: notificationCopy,
81 action: event.action });
81 }); 82 });
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-action-reflection.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698