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

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

Issue 2347473005: Make required dictionary members non-nullable again (Closed)
Patch Set: rm TouchInit, add tests 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/foreign-fetch-basics.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('../../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
11 // Test body for the serviceworker-notification-event.html layout test. 11 // Test body for the serviceworker-notification-event.html layout test.
12 function runTest(notification) { 12 function runTest(notification) {
13 assert_true('NotificationEvent' in self); 13 assert_true('NotificationEvent' in self);
14 14
15 assert_throws(null, () => new NotificationEvent('NotificationEvent')); 15 assert_throws(null, () => new NotificationEvent('NotificationEvent'));
16 assert_throws(null, () => new NotificationEvent('NotificationEvent', {})); 16 assert_throws(null, () => new NotificationEvent('NotificationEvent', {}));
17 assert_throws(null, () => new NotificationEvent('NotificationEvent', { notif ication: null }));
17 18
18 const event = new NotificationEvent('NotificationEvent', { notification }); 19 const event = new NotificationEvent('NotificationEvent', { notification });
19 20
20 assert_equals(event.type, 'NotificationEvent'); 21 assert_equals(event.type, 'NotificationEvent');
21 assert_idl_attribute(event, 'notification'); 22 assert_idl_attribute(event, 'notification');
22 assert_idl_attribute(event, 'action'); 23 assert_idl_attribute(event, 'action');
23 assert_equals(event.cancelable, false); 24 assert_equals(event.cancelable, false);
24 assert_equals(event.bubbles, false); 25 assert_equals(event.bubbles, false);
25 assert_equals(event.notification, notification); 26 assert_equals(event.notification, notification);
26 assert_equals(event.action, ''); 27 assert_equals(event.action, '');
27 assert_inherits(event, 'waitUntil'); 28 assert_inherits(event, 'waitUntil');
28 29
29 const customEvent = new NotificationEvent('NotificationEvent', { 30 const customEvent = new NotificationEvent('NotificationEvent', {
30 notification: notification, 31 notification: notification,
31 bubbles: true, 32 bubbles: true,
32 cancelable: true }); 33 cancelable: true });
33 34
34 assert_equals(customEvent.type, 'NotificationEvent'); 35 assert_equals(customEvent.type, 'NotificationEvent');
35 assert_equals(customEvent.cancelable, true); 36 assert_equals(customEvent.cancelable, true);
36 assert_equals(customEvent.bubbles, true); 37 assert_equals(customEvent.bubbles, true);
37 assert_equals(customEvent.notification, notification); 38 assert_equals(customEvent.notification, notification);
38 39
39 // Signal to the document that the test has finished running. 40 // Signal to the document that the test has finished running.
40 messagePort.postMessage(true /* success */); 41 messagePort.postMessage(true /* success */);
41 } 42 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/foreign-fetch-basics.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698