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

Unified 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: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | public/platform/WebPushProvider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/push_messaging/unregister.html
diff --git a/LayoutTests/http/tests/push_messaging/unregister.html b/LayoutTests/http/tests/push_messaging/unregister.html
index 5702267b6dced4fb2432f198a416b43fa0afaaa2..2ddec8924a03b4c0557123d2797487bdf0e0df23 100644
--- a/LayoutTests/http/tests/push_messaging/unregister.html
+++ b/LayoutTests/http/tests/push_messaging/unregister.html
@@ -13,6 +13,7 @@ async_test(function(test) {
var workerUrl = 'resources/empty_worker.js';
var workerScope = 'resources/scope/' + location.pathname;
var swRegistration;
+ var pushRegistration;
service_worker_unregister_and_register(test, workerUrl, workerScope)
.then(function(serviceWorkerRegistration) {
swRegistration = serviceWorkerRegistration;
@@ -24,7 +25,8 @@ async_test(function(test) {
testRunner.setPushMessagingPermission(location.origin, true);
return swRegistration.pushManager.register();
})
- .then(function(pushRegistration) {
+ .then(function(registration) {
+ pushRegistration = registration;
assert_inherits(pushRegistration, 'unregister',
'unregister() should be exposed on the PushRegistration object');
assert_equals(typeof(pushRegistration.unregister), 'function',
@@ -33,15 +35,21 @@ async_test(function(test) {
})
.then(function(unregistration_result) {
assert_true(unregistration_result,
- 'Unregistering a registered PushRegistration should succeed.');
- // FIXME: we should add another call to unregister(). It should then
- // fail.
- // FIXME: we should check that there is no more push registration
- // object available if we query the registrations.
+ "unregister() called when correctly registered should be fulfilled with true");
+ return pushRegistration.unregister();
+ })
+ .then(function(unregistration_result) {
+ assert_false(unregistration_result,
+ "unregister() called a second time should be fulfilled with false");
+ return swRegistration.pushManager.getRegistration();
+ })
+ .then(function(pushRegistration) {
+ assert_equals(pushRegistration, null,
+ "After unregistration, there is no more PushRegistration.");
return service_worker_unregister_and_done(test, workerScope);
})
.catch(unreached_rejection(test));
-}, 'unregister() succeeds if called after a successful registration');
+});
</script>
</body>
</html>
« 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