OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>subscribe() succeeds when permission is granted and resolves with a valid
subscription</title> | 4 <title>subscribe() succeeds when permission is granted and resolves with a valid
subscription</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 10 matching lines...) Expand all Loading... |
21 .then(function() { | 21 .then(function() { |
22 // If running manually, grant permission when prompted. | 22 // If running manually, grant permission when prompted. |
23 if (window.testRunner) | 23 if (window.testRunner) |
24 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); | 24 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); |
25 return swRegistration.pushManager.subscribe(); | 25 return swRegistration.pushManager.subscribe(); |
26 }) | 26 }) |
27 .then(function(pushSubscription) { | 27 .then(function(pushSubscription) { |
28 assert_idl_attribute(pushSubscription, 'endpoint'); | 28 assert_idl_attribute(pushSubscription, 'endpoint'); |
29 assert_equals(typeof pushSubscription.endpoint, 'string'); | 29 assert_equals(typeof pushSubscription.endpoint, 'string'); |
30 | 30 |
| 31 assert_idl_attribute(pushSubscription, 'expirationTime'); |
| 32 assert_equals(pushSubscription.expirationTime, null); |
| 33 |
31 try { | 34 try { |
32 var endpointUrl = new URL(pushSubscription.endpoint); | 35 var endpointUrl = new URL(pushSubscription.endpoint); |
33 } catch(e) { | 36 } catch(e) { |
34 assert_unreached('Constructing a URL from the endpoint should no
t throw.'); | 37 assert_unreached('Constructing a URL from the endpoint should no
t throw.'); |
35 } | 38 } |
36 | 39 |
37 return service_worker_unregister_and_done(test, workerScope); | 40 return service_worker_unregister_and_done(test, workerScope); |
38 }) | 41 }) |
39 .catch(unreached_rejection(test)); | 42 .catch(unreached_rejection(test)); |
40 }, 'subscribe() succeeds when permission is granted and resolves with a valid su
bscription'); | 43 }, 'subscribe() succeeds when permission is granted and resolves with a valid su
bscription'); |
41 </script> | 44 </script> |
42 </body> | 45 </body> |
43 </html> | 46 </html> |
OLD | NEW |