Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: LayoutTests/http/tests/push_messaging/unsubscribe.html

Issue 841333002: Push API: rename registration to subscription. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use https in the spec link. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/push_messaging/unregister.html ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test PushRegistration.unregister()</title> 4 <title>Test PushSubscription.unsubscribe()</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>
11 <script> 11 <script>
12 async_test(function(test) { 12 async_test(function(test) {
13 var workerUrl = 'resources/empty_worker.js'; 13 var workerUrl = 'resources/empty_worker.js';
14 var workerScope = 'resources/scope/' + location.pathname; 14 var workerScope = 'resources/scope/' + location.pathname;
15 var swRegistration; 15 var swRegistration;
16 var pushRegistration; 16 var pushSubscription;
17 service_worker_unregister_and_register(test, workerUrl, workerScope) 17 service_worker_unregister_and_register(test, workerUrl, workerScope)
18 .then(function(serviceWorkerRegistration) { 18 .then(function(serviceWorkerRegistration) {
19 swRegistration = serviceWorkerRegistration; 19 swRegistration = serviceWorkerRegistration;
20 return wait_for_state(test, swRegistration.installing, 'activated'); 20 return wait_for_state(test, swRegistration.installing, 'activated');
21 }) 21 })
22 .then(function() { 22 .then(function() {
23 // If running manually, grant permission when prompted. 23 // If running manually, grant permission when prompted.
24 if (self.testRunner) 24 if (self.testRunner)
25 testRunner.setPushMessagingPermission(location.origin, true); 25 testRunner.setPushMessagingPermission(location.origin, true);
26 return swRegistration.pushManager.register(); 26 return swRegistration.pushManager.subscribe();
27 }) 27 })
28 .then(function(registration) { 28 .then(function(subscription) {
29 pushRegistration = registration; 29 pushSubscription = subscription;
30 assert_inherits(pushRegistration, 'unregister', 30 assert_inherits(pushSubscription, 'unsubscribe',
31 'unregister() should be exposed on the PushRegistrat ion object'); 31 'unsubscribe() should be exposed on the PushSubscrip tion object');
32 assert_equals(typeof(pushRegistration.unregister), 'function', 32 assert_equals(typeof(pushSubscription.unsubscribe), 'function',
33 'PushRegistration.unregister() is a function.'); 33 'PushSubscription.unsubscribe() is a function.');
34 return pushRegistration.unregister(); 34 return pushSubscription.unsubscribe();
35 }) 35 })
36 .then(function(unregistration_result) { 36 .then(function(unsubscription_result) {
37 assert_true(unregistration_result, 37 assert_true(unsubscription_result,
38 "unregister() called when correctly registered should be fulfilled with true"); 38 "unsubscribe() called when correctly subscribed should b e fulfilled with true");
39 return pushRegistration.unregister(); 39 return pushSubscription.unsubscribe();
40 }) 40 })
41 .then(function(unregistration_result) { 41 .then(function(unsubscription_result) {
42 assert_false(unregistration_result, 42 assert_false(unsubscription_result,
43 "unregister() called a second time should be fulfilled with false"); 43 "unsubcribe() called a second time should be fulfilled with false");
44 return swRegistration.pushManager.getRegistration(); 44 return swRegistration.pushManager.getSubscription();
45 }) 45 })
46 .then(function(pushRegistration) { 46 .then(function(pushSubscription) {
47 assert_equals(pushRegistration, null, 47 assert_equals(pushSubscription, null,
48 "After unregistration, there is no more PushRegistrati on."); 48 "After unsubscription, there is no more PushSubscripti on.");
49 return service_worker_unregister_and_done(test, workerScope); 49 return service_worker_unregister_and_done(test, workerScope);
50 }) 50 })
51 .catch(unreached_rejection(test)); 51 .catch(unreached_rejection(test));
52 }); 52 });
53 </script> 53 </script>
54 </body> 54 </body>
55 </html> 55 </html>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/push_messaging/unregister.html ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698