| 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 e6639c3bd68c41edd1a33adc884ac553f892a306..70ca79f4cdbfdd39a9e520c3e7b8fb7779091030 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
|
| @@ -22,6 +22,7 @@ void LayoutTestPushMessagingService::SetPermission(const GURL& origin,
|
|
|
| void LayoutTestPushMessagingService::ClearPermissions() {
|
| permission_map_.clear();
|
| + registrations_.clear();
|
| }
|
|
|
| GURL LayoutTestPushMessagingService::GetPushEndpoint() {
|
| @@ -47,6 +48,7 @@ void LayoutTestPushMessagingService::RegisterFromWorker(
|
| const PushMessagingService::RegisterCallback& callback) {
|
| if (GetPermissionStatus(requesting_origin, requesting_origin) ==
|
| blink::WebPushPermissionStatusGranted) {
|
| + registrations_.insert(requesting_origin);
|
| callback.Run("layoutTestRegistrationId",
|
| PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
|
| } else {
|
| @@ -72,4 +74,17 @@ LayoutTestPushMessagingService::GetPermissionStatus(
|
| return it->second;
|
| }
|
|
|
| +void LayoutTestPushMessagingService::Unregister(
|
| + const GURL& requesting_origin,
|
| + int64 service_worker_registration_id,
|
| + const UnregisterCallback& callback) {
|
| + PushUnregistrationStatus status;
|
| + if (registrations_.erase(requesting_origin) == 1)
|
| + status = PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER;
|
| + else
|
| + status = PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED;
|
| +
|
| + callback.Run(status);
|
| +}
|
| +
|
| } // namespace content
|
|
|