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

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: 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 e0e135bfb7ff18604df927b2d9949fce8a345728..a6acaf07c59310bc32e56341a6596210d9cfcc2c 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,19 +25,23 @@ async_test(function(test) {
testRunner.setPushMessagingPermission(location.origin, true);
return swRegistration.pushManager.register();
})
- .then(function(pushRegistration) {
+ .then(function(registration) {
+ pushRegistration = registration;
return pushRegistration.unregister();
})
.then(function(unregistration_result) {
Michael van Ouwerkerk 2014/12/12 13:59:48 Please rename this to something more meaningful e.
- assert_true(unregistration_result);
- // FIXME: we should add another call to unregister(). It should then
- // fail.
+ assert_true(unregistration_result, "unregister() called when correctly registered should be fulfilled with true");
Michael van Ouwerkerk 2014/12/12 13:59:48 s/fulfilled/resolved/ also below
+ return pushRegistration.unregister();
+ })
+ .then(function(unregistration_result) {
+ assert_false(unregistration_result, "unregister() called a second time should be fulfilled with false");
+
// FIXME: we should check that there is no more push registration
// object available if we query the registrations.
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