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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/notifications/resources/serviceworker-notification-event.js

Issue 2380273002: Added reply field to blink NotificationEvent (not yet piped through) (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 importScripts('../../serviceworker/resources/worker-testharness.js'); 1 importScripts('../../serviceworker/resources/worker-testharness.js');
2 2
3 let messagePort = null; 3 let messagePort = null;
4 addEventListener('message', workerEvent => { 4 addEventListener('message', workerEvent => {
5 messagePort = workerEvent.data; 5 messagePort = workerEvent.data;
6 messagePort.postMessage('ready'); 6 messagePort.postMessage('ready');
7 }); 7 });
8 8
9 addEventListener('notificationclick', e => runTest(e.notification)); 9 addEventListener('notificationclick', e => runTest(e.notification));
10 10
(...skipping 11 matching lines...) Expand all
22 assert_throws(null, () => new NotificationEvent('NotificationEvent', { not ification: null })); 22 assert_throws(null, () => new NotificationEvent('NotificationEvent', { not ification: null }));
23 23
24 const event = new NotificationEvent('NotificationEvent', { notification }) ; 24 const event = new NotificationEvent('NotificationEvent', { notification }) ;
25 25
26 assert_equals(event.type, 'NotificationEvent'); 26 assert_equals(event.type, 'NotificationEvent');
27 assert_idl_attribute(event, 'notification'); 27 assert_idl_attribute(event, 'notification');
28 assert_idl_attribute(event, 'action'); 28 assert_idl_attribute(event, 'action');
29 assert_equals(event.cancelable, false); 29 assert_equals(event.cancelable, false);
30 assert_equals(event.bubbles, false); 30 assert_equals(event.bubbles, false);
31 assert_equals(event.notification, notification); 31 assert_equals(event.notification, notification);
32 assert_equals(event.action, ''); 32 assert_equals(event.action, '');
Peter Beverloo 2016/09/30 11:10:22 nit: assert that |event.reply| is either an empty
awdf 2016/09/30 13:52:54 Done.
33 assert_inherits(event, 'waitUntil'); 33 assert_inherits(event, 'waitUntil');
34 34
35 const customEvent = new NotificationEvent('NotificationEvent', { 35 const customEvent = new NotificationEvent('NotificationEvent', {
36 notification: notification, 36 notification: notification,
37 reply: 'my reply',
37 bubbles: true, 38 bubbles: true,
38 cancelable: true }); 39 cancelable: true });
39 40
40 assert_equals(customEvent.type, 'NotificationEvent'); 41 assert_equals(customEvent.type, 'NotificationEvent');
41 assert_equals(customEvent.cancelable, true); 42 assert_equals(customEvent.cancelable, true);
42 assert_equals(customEvent.bubbles, true); 43 assert_equals(customEvent.bubbles, true);
43 assert_equals(customEvent.notification, notification); 44 assert_equals(customEvent.notification, notification);
45 assert_equals(customEvent.reply, 'my reply');
44 } catch (e) { 46 } catch (e) {
45 result.success = false; 47 result.success = false;
46 result.message = e.message + '\n' + e.stack; 48 result.message = e.message + '\n' + e.stack;
47 } 49 }
48 // Signal to the document that the test has finished running. 50 // Signal to the document that the test has finished running.
49 messagePort.postMessage(result); 51 messagePort.postMessage(result);
50 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698