OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>unsubscribe must resolve with true iff it is called on an active subscrip
tion</title> | 4 <title>unsubscribe must resolve with true iff it is called on an active subscrip
tion</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 <script src="../notifications/resources/test-helpers.js"></script> | 9 <script src="../notifications/resources/test-helpers.js"></script> |
10 <script src="resources/test-helpers.js"></script> | 10 <script src="resources/test-helpers.js"></script> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 getActiveServiceWorkerWithMessagePort(test, script, scope) | 23 getActiveServiceWorkerWithMessagePort(test, script, scope) |
24 .then(function(workerInfo) { | 24 .then(function(workerInfo) { |
25 port = workerInfo.port; | 25 port = workerInfo.port; |
26 return subscribeAndUnsubscribePush(workerInfo.registration); | 26 return subscribeAndUnsubscribePush(workerInfo.registration); |
27 }) | 27 }) |
28 .then(function() { | 28 .then(function() { |
29 return runCommandInServiceWorker(port, 'getSubscription'); | 29 return runCommandInServiceWorker(port, 'getSubscription'); |
30 }) | 30 }) |
31 .then(function(data) { | 31 .then(function(data) { |
32 assert_equals(data.subscriptionId, null, | 32 assert_equals(data.endpoint, null, |
33 'There must be no subscription after unsubscribing in the document.'
); | 33 'There must be no subscription after unsubscribing in the document.'
); |
34 return runCommandInServiceWorker(port, 'subscribe'); | 34 return runCommandInServiceWorker(port, 'subscribe'); |
35 }) | 35 }) |
36 .then(function(data) { | 36 .then(function(data) { |
37 assert_equals(typeof data.subscriptionId, 'string', | 37 assert_equals(typeof data.endpoint, 'string', |
38 'There must be a subscription after subscribing'); | 38 'There must be a subscription after subscribing'); |
39 return runCommandInServiceWorker(port, 'unsubscribe'); | 39 return runCommandInServiceWorker(port, 'unsubscribe'); |
40 }) | 40 }) |
41 .then(function(data) { | 41 .then(function(data) { |
42 assert_true(data.unsubscribeResult, | 42 assert_true(data.unsubscribeResult, |
43 'Calling unsubscribe on an active subscription must resolve with tru
e.'); | 43 'Calling unsubscribe on an active subscription must resolve with tru
e.'); |
44 return runCommandInServiceWorker(port, 'unsubscribe'); | 44 return runCommandInServiceWorker(port, 'unsubscribe'); |
45 }) | 45 }) |
46 .then(function(data) { | 46 .then(function(data) { |
47 assert_false(data.unsubscribeResult, | 47 assert_false(data.unsubscribeResult, |
48 'Calling unsubscribe on a deactivated subscription must resolve with
false.'); | 48 'Calling unsubscribe on a deactivated subscription must resolve with
false.'); |
49 return runCommandInServiceWorker(port, 'getSubscription'); | 49 return runCommandInServiceWorker(port, 'getSubscription'); |
50 }) | 50 }) |
51 .then(function(data) { | 51 .then(function(data) { |
52 assert_equals(data.subscriptionId, null, | 52 assert_equals(data.endpoint, null, |
53 'There must be no subscription after unsubscribing in the service wo
rker.'); | 53 'There must be no subscription after unsubscribing in the service wo
rker.'); |
54 test.done(); | 54 test.done(); |
55 }) | 55 }) |
56 .catch(unreached_rejection(test)); | 56 .catch(unreached_rejection(test)); |
57 }, 'unsubscribe must resolve with true iff it is called on an active subscriptio
n'); | 57 }, 'unsubscribe must resolve with true iff it is called on an active subscriptio
n'); |
58 </script> | 58 </script> |
59 </body> | 59 </body> |
60 </html> | 60 </html> |
OLD | NEW |