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

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

Issue 923443005: Disallow constructing the Notification object in a Service Worker. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comments Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 importScripts('../../serviceworker/resources/worker-testharness.js'); 1 importScripts('../../serviceworker/resources/worker-testharness.js');
2 importScripts('/resources/testharness-helpers.js'); 2 importScripts('/resources/testharness-helpers.js');
3 3
4 test(function() { 4 test(function() {
5 assert_true('NotificationEvent' in self); 5 assert_true('NotificationEvent' in self);
6 6
7 var event = new NotificationEvent('NotificationEvent'); 7 var event = new NotificationEvent('NotificationEvent');
8 assert_equals(event.type, 'NotificationEvent'); 8 assert_equals(event.type, 'NotificationEvent');
9 assert_will_be_idl_attribute(event, 'notification'); 9 assert_will_be_idl_attribute(event, 'notification');
10 assert_equals(event.cancelable, false); 10 assert_equals(event.cancelable, false);
11 assert_equals(event.bubbles, false); 11 assert_equals(event.bubbles, false);
12 assert_equals(event.notification, null); 12 assert_equals(event.notification, null);
13 assert_inherits(event, 'waitUntil'); 13 assert_inherits(event, 'waitUntil');
14 14
15 var notification = new Notification('foo');
16 var eventWithInit = new NotificationEvent('NotificationEvent', 15 var eventWithInit = new NotificationEvent('NotificationEvent',
17 { cancelable: true, 16 { cancelable: true,
18 bubbles: true, 17 bubbles: true
19 notification: notification,
20 }); 18 });
21 assert_equals(eventWithInit.cancelable, true); 19 assert_equals(eventWithInit.cancelable, true);
22 assert_equals(eventWithInit.bubbles, true); 20 assert_equals(eventWithInit.bubbles, true);
23 assert_equals(eventWithInit.notification, notification);
24 21
25 }, 'NotificationEvent is exposed, and has the expected interface.'); 22 }, 'NotificationEvent is exposed, and has the expected interface.');
26 23
27 test(function() { 24 test(function() {
28 assert_will_be_idl_attribute(self, 'onnotificationclick', 25 assert_will_be_idl_attribute(self, 'onnotificationclick',
29 'The notificationclick event exists.'); 26 'The notificationclick event exists.');
30 assert_will_be_idl_attribute(self, 'onnotificationerror', 27 assert_will_be_idl_attribute(self, 'onnotificationerror',
31 'The notificationerror event exists.'); 28 'The notificationerror event exists.');
32 29
33 }, 'The notificationclick and notificationerror events exist on the global scope .'); 30 }, 'The notificationclick and notificationerror events exist on the global scope .');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698