Index: LayoutTests/http/tests/push_messaging/unregister.html |
diff --git a/LayoutTests/http/tests/push_messaging/register_success.html b/LayoutTests/http/tests/push_messaging/unregister.html |
similarity index 56% |
copy from LayoutTests/http/tests/push_messaging/register_success.html |
copy to LayoutTests/http/tests/push_messaging/unregister.html |
index 13db7e0822ce9bc7b86ae012fff148bb83b2e07d..5702267b6dced4fb2432f198a416b43fa0afaaa2 100644 |
--- a/LayoutTests/http/tests/push_messaging/register_success.html |
+++ b/LayoutTests/http/tests/push_messaging/unregister.html |
@@ -1,7 +1,7 @@ |
<!DOCTYPE html> |
<html> |
<head> |
-<title>register() succeeds when permission is granted and resolves with a valid registration</title> |
+<title>Test PushRegistration.unregister()</title> |
<link rel="manifest" href="resources/push_manifest.json"> |
<script src="../resources/testharness.js"></script> |
<script src="../resources/testharnessreport.js"></script> |
@@ -25,21 +25,23 @@ async_test(function(test) { |
return swRegistration.pushManager.register(); |
}) |
.then(function(pushRegistration) { |
- assert_own_property(pushRegistration, 'pushRegistrationId'); |
- assert_equals(typeof pushRegistration.pushRegistrationId, 'string'); |
- |
- assert_own_property(pushRegistration, 'pushEndpoint'); |
- assert_equals(typeof pushRegistration.pushEndpoint, 'string'); |
- try { |
- var endpointUrl = new URL(pushRegistration.pushEndpoint); |
- } catch(e) { |
- assert_unreached('Constructing a URL from the endpoint should not throw.'); |
- } |
- |
+ assert_inherits(pushRegistration, 'unregister', |
+ 'unregister() should be exposed on the PushRegistration object'); |
+ assert_equals(typeof(pushRegistration.unregister), 'function', |
+ 'PushRegistration.unregister() is a function.'); |
+ return pushRegistration.unregister(); |
+ }) |
+ .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. |
return service_worker_unregister_and_done(test, workerScope); |
}) |
.catch(unreached_rejection(test)); |
-}, 'register() succeeds when permission is granted and resolves with a valid registration'); |
+}, 'unregister() succeeds if called after a successful registration'); |
</script> |
</body> |
</html> |