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

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

Issue 800503002: PushRegistration.unregister(), cleanups and more tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@push_unregister
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | public/platform/WebPushProvider.h » ('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 PushRegistration.unregister()</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 service_worker_unregister_and_register(test, workerUrl, workerScope) 17 service_worker_unregister_and_register(test, workerUrl, workerScope)
17 .then(function(serviceWorkerRegistration) { 18 .then(function(serviceWorkerRegistration) {
18 swRegistration = serviceWorkerRegistration; 19 swRegistration = serviceWorkerRegistration;
19 return wait_for_state(test, swRegistration.installing, 'activated'); 20 return wait_for_state(test, swRegistration.installing, 'activated');
20 }) 21 })
21 .then(function() { 22 .then(function() {
22 // If running manually, grant permission when prompted. 23 // If running manually, grant permission when prompted.
23 if (self.testRunner) 24 if (self.testRunner)
24 testRunner.setPushMessagingPermission(location.origin, true); 25 testRunner.setPushMessagingPermission(location.origin, true);
25 return swRegistration.pushManager.register(); 26 return swRegistration.pushManager.register();
26 }) 27 })
27 .then(function(pushRegistration) { 28 .then(function(registration) {
29 pushRegistration = registration;
28 return pushRegistration.unregister(); 30 return pushRegistration.unregister();
29 }) 31 })
30 .then(function(unregistration_result) { 32 .then(function(unregistration_result) {
Michael van Ouwerkerk 2014/12/12 13:59:48 Please rename this to something more meaningful e.
31 assert_true(unregistration_result); 33 assert_true(unregistration_result, "unregister() called when correct ly registered should be fulfilled with true");
Michael van Ouwerkerk 2014/12/12 13:59:48 s/fulfilled/resolved/ also below
32 // FIXME: we should add another call to unregister(). It should then 34 return pushRegistration.unregister();
33 // fail. 35 })
36 .then(function(unregistration_result) {
37 assert_false(unregistration_result, "unregister() called a second ti me should be fulfilled with false");
38
34 // FIXME: we should check that there is no more push registration 39 // FIXME: we should check that there is no more push registration
35 // object available if we query the registrations. 40 // object available if we query the registrations.
36 return service_worker_unregister_and_done(test, workerScope); 41 return service_worker_unregister_and_done(test, workerScope);
37 }) 42 })
38 .catch(unreached_rejection(test)); 43 .catch(unreached_rejection(test));
39 }, 'unregister() succeeds if called after a successful registration'); 44 });
40 </script> 45 </script>
41 </body> 46 </body>
42 </html> 47 </html>
OLDNEW
« no previous file with comments | « no previous file | public/platform/WebPushProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698