| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>getSubscription must return the details of the active subscription if the
re is one</title> | 4 <title>getSubscription must return the details of the active subscription if the
re is one</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 24 matching lines...) Expand all Loading... |
| 35 "pushSubscription should be null if there is no active
push registration.") | 35 "pushSubscription should be null if there is no active
push registration.") |
| 36 return swRegistration.pushManager.subscribe(); | 36 return swRegistration.pushManager.subscribe(); |
| 37 }) | 37 }) |
| 38 .then(function(pushSubscription) { | 38 .then(function(pushSubscription) { |
| 39 previousPushSubscription = pushSubscription; | 39 previousPushSubscription = pushSubscription; |
| 40 return swRegistration.pushManager.getSubscription(); | 40 return swRegistration.pushManager.getSubscription(); |
| 41 }) | 41 }) |
| 42 .then(function(pushSubscription) { | 42 .then(function(pushSubscription) { |
| 43 assert_equals(previousPushSubscription.endpoint, pushSubscription.en
dpoint, | 43 assert_equals(previousPushSubscription.endpoint, pushSubscription.en
dpoint, |
| 44 "Both subscription objects should have the same endpoi
nt."); | 44 "Both subscription objects should have the same endpoi
nt."); |
| 45 assert_equals(previousPushSubscription.subscriptionId, pushSubscript
ion.subscriptionId, | |
| 46 "Both subscription objects should have the same id."); | |
| 47 return pushSubscription.unsubscribe(); | 45 return pushSubscription.unsubscribe(); |
| 48 }) | 46 }) |
| 49 .then(function(unsubscribed) { | 47 .then(function(unsubscribed) { |
| 50 assert_true(unsubscribed, "unsubscription was successful"); | 48 assert_true(unsubscribed, "unsubscription was successful"); |
| 51 return swRegistration.pushManager.getSubscription(); | 49 return swRegistration.pushManager.getSubscription(); |
| 52 }) | 50 }) |
| 53 .then(function(pushSubscription) { | 51 .then(function(pushSubscription) { |
| 54 assert_equals(pushSubscription, null, | 52 assert_equals(pushSubscription, null, |
| 55 "pushSubscription should be null after unsubscribing."
) | 53 "pushSubscription should be null after unsubscribing."
) |
| 56 return swRegistration.pushManager.subscribe(); | 54 return swRegistration.pushManager.subscribe(); |
| 57 }) | 55 }) |
| 58 .then(function(pushSubscription) { | 56 .then(function(pushSubscription) { |
| 59 assert_not_equals(pushSubscription, null, | 57 assert_not_equals(pushSubscription, null, |
| 60 "Subscription should have succeeded."); | 58 "Subscription should have succeeded."); |
| 61 return service_worker_unregister(test, workerScope); | 59 return service_worker_unregister(test, workerScope); |
| 62 }) | 60 }) |
| 63 .then(function() { | 61 .then(function() { |
| 64 return swRegistration.pushManager.getSubscription(); | 62 return swRegistration.pushManager.getSubscription(); |
| 65 }) | 63 }) |
| 66 .then(function(pushSubscription) { | 64 .then(function(pushSubscription) { |
| 67 assert_equals(pushSubscription, null, | 65 assert_equals(pushSubscription, null, |
| 68 "After unregistration of SW, there should be no push s
ubscription."); | 66 "After unregistration of SW, there should be no push s
ubscription."); |
| 69 return service_worker_unregister_and_done(test, workerScope); | 67 return service_worker_unregister_and_done(test, workerScope); |
| 70 }) | 68 }) |
| 71 .catch(unreached_rejection(test)); | 69 .catch(unreached_rejection(test)); |
| 72 }, 'getSubscription must return the details of the active subscription if there
is one'); | 70 }, 'getSubscription must return the details of the active subscription if there
is one'); |
| 73 </script> | 71 </script> |
| 74 </body> | 72 </body> |
| 75 </html> | 73 </html> |
| OLD | NEW |