Index: content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
diff --git a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
index 59d298fc24c8572ac7a033aad0510536f3195bf0..d4f709d7fe7f2de30d9c115552e7b0b60fd2dbbb 100644 |
--- a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
+++ b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc |
@@ -89,6 +89,7 @@ void LayoutTestPushMessagingService::SubscribeFromWorker( |
std::vector<uint8_t> auth( |
kAuthentication, kAuthentication + arraysize(kAuthentication)); |
+ is_subscribed_ = true; |
callback.Run("layoutTestRegistrationId", p256dh, auth, |
PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE); |
} else { |
@@ -129,7 +130,14 @@ void LayoutTestPushMessagingService::Unsubscribe( |
int64_t service_worker_registration_id, |
const std::string& sender_id, |
const UnregisterCallback& callback) { |
- callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED); |
+ ClearPushSubscriptionId( |
+ LayoutTestContentBrowserClient::Get()->browser_context(), |
+ requesting_origin, service_worker_registration_id, |
+ base::Bind(callback, |
+ is_subscribed_ |
+ ? PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED |
+ : PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED)); |
+ is_subscribed_ = false; |
} |
} // namespace content |