| Index: LayoutTests/http/tests/push_messaging/get_subscription.html
|
| diff --git a/LayoutTests/http/tests/push_messaging/get_registration.html b/LayoutTests/http/tests/push_messaging/get_subscription.html
|
| similarity index 40%
|
| rename from LayoutTests/http/tests/push_messaging/get_registration.html
|
| rename to LayoutTests/http/tests/push_messaging/get_subscription.html
|
| index d3eae6caf22512fdd3557a1f9b2f9827b3601d3d..6da0a2629d8f364456f2c6be1c086a012dbb0160 100644
|
| --- a/LayoutTests/http/tests/push_messaging/get_registration.html
|
| +++ b/LayoutTests/http/tests/push_messaging/get_subscription.html
|
| @@ -1,7 +1,7 @@
|
| <!DOCTYPE html>
|
| <html>
|
| <head>
|
| -<title>Test PushManager.getRegistration()</title>
|
| +<title>Test PushManager.getSubscription()</title>
|
| <link rel="manifest" href="resources/push_manifest.json">
|
| <script src="../resources/testharness.js"></script>
|
| <script src="../resources/testharnessreport.js"></script>
|
| @@ -23,49 +23,49 @@ async_test(function(test) {
|
| if (self.testRunner)
|
| testRunner.setPushMessagingPermission(location.origin, true);
|
|
|
| - assert_inherits(swRegistration.pushManager, 'getRegistration',
|
| - 'getRegistration() should be exposed on the PushManager object');
|
| - assert_equals(typeof(swRegistration.pushManager.getRegistration), 'function',
|
| - 'PushManager.getRegistration() is a function.');
|
| + assert_inherits(swRegistration.pushManager, 'getSubscription',
|
| + 'getSubscription() should be exposed on the PushManager object');
|
| + assert_equals(typeof(swRegistration.pushManager.getSubscription), 'function',
|
| + 'PushManager.getSubscription() is a function.');
|
|
|
| - return swRegistration.pushManager.getRegistration();
|
| + return swRegistration.pushManager.getSubscription();
|
| })
|
| - .then(function(pushRegistration) {
|
| - assert_equals(pushRegistration, null,
|
| - "pushRegistration should be null if there is no active push registration.")
|
| - return swRegistration.pushManager.register();
|
| + .then(function(pushSubscription) {
|
| + assert_equals(pushSubscription, null,
|
| + "pushSubscription should be null if there is no active push registration.")
|
| + return swRegistration.pushManager.subscribe();
|
| })
|
| - .then(function(pushRegistration) {
|
| - previousPushRegistration = pushRegistration;
|
| - return swRegistration.pushManager.getRegistration();
|
| + .then(function(pushSubscription) {
|
| + previousPushSubscription = pushSubscription;
|
| + return swRegistration.pushManager.getSubscription();
|
| })
|
| - .then(function(pushRegistration) {
|
| - assert_equals(previousPushRegistration.endPoint, pushRegistration.endPoint,
|
| - "Both registration objects should have the same endpoint.");
|
| - assert_equals(previousPushRegistration.registrationId, pushRegistration.registrationId,
|
| - "Both registration objects should have the same registration id.");
|
| - return pushRegistration.unregister();
|
| + .then(function(pushSubscription) {
|
| + assert_equals(previousPushSubscription.endPoint, pushSubscription.endPoint,
|
| + "Both subscription objects should have the same endpoint.");
|
| + assert_equals(previousPushSubscription.subscriptionId, pushSubscription.subscriptionId,
|
| + "Both subscription objects should have the same id.");
|
| + return pushSubscription.unsubscribe();
|
| })
|
| - .then(function(unregistered) {
|
| - assert_true(unregistered, "unregistration was successful");
|
| - return swRegistration.pushManager.getRegistration();
|
| + .then(function(unsubscribed) {
|
| + assert_true(unsubscribed, "unsubscription was successful");
|
| + return swRegistration.pushManager.getSubscription();
|
| })
|
| - .then(function(pushRegistration) {
|
| - assert_equals(pushRegistration, null,
|
| - "pushRegistration should be null after unregistering.")
|
| - return swRegistration.pushManager.register();
|
| + .then(function(pushSubscription) {
|
| + assert_equals(pushSubscription, null,
|
| + "pushSubscription should be null after unsubscribing.")
|
| + return swRegistration.pushManager.subscribe();
|
| })
|
| - .then(function(pushRegistration) {
|
| - assert_not_equals(pushRegistration, null,
|
| - "Registration should have succeeded.");
|
| + .then(function(pushSubscription) {
|
| + assert_not_equals(pushSubscription, null,
|
| + "Subscription should have succeeded.");
|
| return service_worker_unregister(test, workerScope);
|
| })
|
| .then(function() {
|
| - return swRegistration.pushManager.getRegistration();
|
| + return swRegistration.pushManager.getSubscription();
|
| })
|
| - .then(function(pushRegistration) {
|
| - assert_equals(pushRegistration, null,
|
| - "After unregistration from SW, there should be no registration.");
|
| + .then(function(pushSubscription) {
|
| + assert_equals(pushSubscription, null,
|
| + "After unregistration of SW, there should be no push subscription.");
|
| return service_worker_unregister_and_done(test, workerScope);
|
| })
|
| .catch(unreached_rejection(test));
|
|
|