OLD | NEW |
1 importScripts('/resources/testharness.js'); | 1 importScripts('/resources/testharness.js'); |
2 importScripts('/resources/testharness-helpers.js'); | |
3 | 2 |
4 test(function() { | 3 test(function() { |
5 assert_own_property(self, 'PushEvent'); | 4 assert_own_property(self, 'PushEvent'); |
6 | 5 |
7 var event = new PushEvent('PushEvent'); | 6 var event = new PushEvent('PushEvent'); |
8 assert_will_be_idl_attribute(event, 'data'); | 7 assert_idl_attribute(event, 'data'); |
9 assert_equals(event.type, 'PushEvent'); | 8 assert_equals(event.type, 'PushEvent'); |
10 | 9 |
11 // PushEvent should be extending ExtendableEvent. | 10 // PushEvent should be extending ExtendableEvent. |
12 assert_inherits(event, 'waitUntil'); | 11 assert_inherits(event, 'waitUntil'); |
13 | 12 |
14 }, 'PushEvent should be exposed and have the expected interface.'); | 13 }, 'PushEvent should be exposed and have the expected interface.'); |
15 | 14 |
16 test(function() { | 15 test(function() { |
17 assert_own_property(self, 'PushManager', 'PushManager needs to be exposed as
a global.'); | 16 assert_own_property(self, 'PushManager', 'PushManager needs to be exposed as
a global.'); |
18 assert_will_be_idl_attribute(registration, 'pushManager', 'PushManager needs
to be exposed on the registration.'); | 17 assert_idl_attribute(registration, 'pushManager', 'PushManager needs to be e
xposed on the registration.'); |
19 | 18 |
20 assert_inherits(registration.pushManager, 'subscribe'); | 19 assert_inherits(registration.pushManager, 'subscribe'); |
21 assert_inherits(registration.pushManager, 'getSubscription'); | 20 assert_inherits(registration.pushManager, 'getSubscription'); |
22 assert_inherits(registration.pushManager, 'permissionState'); | 21 assert_inherits(registration.pushManager, 'permissionState'); |
23 | 22 |
24 }, 'PushManager should be exposed and have the expected interface.'); | 23 }, 'PushManager should be exposed and have the expected interface.'); |
25 | 24 |
26 test(function() { | 25 test(function() { |
27 assert_own_property(self, 'PushMessageData', 'PushMessageData needs to be ex
posed as a global.'); | 26 assert_own_property(self, 'PushMessageData', 'PushMessageData needs to be ex
posed as a global.'); |
28 | 27 |
29 var pushMessageData = new PushEvent('PushEvent', { data: 'SomeData' }).data; | 28 var pushMessageData = new PushEvent('PushEvent', { data: 'SomeData' }).data; |
30 assert_inherits(pushMessageData, 'arrayBuffer'); | 29 assert_inherits(pushMessageData, 'arrayBuffer'); |
31 assert_inherits(pushMessageData, 'blob'); | 30 assert_inherits(pushMessageData, 'blob'); |
32 assert_inherits(pushMessageData, 'json'); | 31 assert_inherits(pushMessageData, 'json'); |
33 assert_inherits(pushMessageData, 'text'); | 32 assert_inherits(pushMessageData, 'text'); |
34 | 33 |
35 }, 'PushMessageData should be exposed and have the expected interface.'); | 34 }, 'PushMessageData should be exposed and have the expected interface.'); |
36 | 35 |
37 test(function() { | 36 test(function() { |
38 assert_own_property(self, 'PushSubscription', 'PushSubscription needs to be
exposed as a global.'); | 37 assert_own_property(self, 'PushSubscription', 'PushSubscription needs to be
exposed as a global.'); |
39 | 38 |
40 assert_own_property(PushSubscription.prototype, 'endpoint'); | 39 assert_own_property(PushSubscription.prototype, 'endpoint'); |
41 | 40 |
42 assert_own_property(PushSubscription.prototype, 'getKey'); | 41 assert_own_property(PushSubscription.prototype, 'getKey'); |
43 assert_own_property(PushSubscription.prototype, 'unsubscribe'); | 42 assert_own_property(PushSubscription.prototype, 'unsubscribe'); |
44 | 43 |
45 }, 'PushSubscription should be exposed and have the expected interface.'); | 44 }, 'PushSubscription should be exposed and have the expected interface.'); |
OLD | NEW |