OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Stringifying a PushSubscription object includes all object members</title
> | 4 <title>Stringifying a PushSubscription object includes all object members</title
> |
5 <link rel="manifest" href="resources/push_manifest.json"> | 5 <link rel="manifest" href="resources/push_manifest.json"> |
6 <script src="../resources/testharness.js"></script> | 6 <script src="../resources/testharness.js"></script> |
7 <script src="../resources/testharnessreport.js"></script> | 7 <script src="../resources/testharnessreport.js"></script> |
8 <script src="../serviceworker/resources/test-helpers.js"></script> | 8 <script src="../serviceworker/resources/test-helpers.js"></script> |
9 </head> | 9 </head> |
10 <body> | 10 <body> |
(...skipping 18 matching lines...) Expand all Loading... |
29 if (window.testRunner) | 29 if (window.testRunner) |
30 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); | 30 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); |
31 return swRegistration.pushManager.subscribe(); | 31 return swRegistration.pushManager.subscribe(); |
32 }) | 32 }) |
33 .then(function(pushSubscription) { | 33 .then(function(pushSubscription) { |
34 var reflectedObject = JSON.parse(JSON.stringify(pushSubscription)); | 34 var reflectedObject = JSON.parse(JSON.stringify(pushSubscription)); |
35 | 35 |
36 assert_own_property(reflectedObject, 'endpoint'); | 36 assert_own_property(reflectedObject, 'endpoint'); |
37 assert_equals(reflectedObject.endpoint, pushSubscription.endpoint); | 37 assert_equals(reflectedObject.endpoint, pushSubscription.endpoint); |
38 | 38 |
| 39 assert_own_property(reflectedObject, 'expirationTime'); |
| 40 assert_equals(reflectedObject.expirationTime, null); |
| 41 |
39 assert_own_property(reflectedObject, 'keys'); | 42 assert_own_property(reflectedObject, 'keys'); |
40 assert_own_property(reflectedObject.keys, 'p256dh'); | 43 assert_own_property(reflectedObject.keys, 'p256dh'); |
41 assert_own_property(reflectedObject.keys, 'auth'); | 44 assert_own_property(reflectedObject.keys, 'auth'); |
42 | 45 |
43 var key = ArrayBufferToBase64UrlEncodedString(pushSubscription.getKe
y('p256dh')), | 46 var key = ArrayBufferToBase64UrlEncodedString(pushSubscription.getKe
y('p256dh')), |
44 auth = ArrayBufferToBase64UrlEncodedString(pushSubscription.getK
ey('auth')); | 47 auth = ArrayBufferToBase64UrlEncodedString(pushSubscription.getK
ey('auth')); |
45 | 48 |
46 assert_equals(reflectedObject.keys.p256dh, key); | 49 assert_equals(reflectedObject.keys.p256dh, key); |
47 assert_equals(reflectedObject.keys.auth, auth); | 50 assert_equals(reflectedObject.keys.auth, auth); |
48 | 51 |
49 return service_worker_unregister_and_done(test, workerScope); | 52 return service_worker_unregister_and_done(test, workerScope); |
50 }) | 53 }) |
51 .catch(unreached_rejection(test)); | 54 .catch(unreached_rejection(test)); |
52 }, 'Stringifying a PushSubscription object includes all object members'); | 55 }, 'Stringifying a PushSubscription object includes all object members'); |
53 </script> | 56 </script> |
54 </body> | 57 </body> |
55 </html> | 58 </html> |
OLD | NEW |