#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/web_test/browser/web_test_push_messaging_service.h"
#include <optional>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/time/time.h"
#include "content/public/browser/permission_controller.h"
#include "content/public/browser/render_process_host.h"
#include "content/web_test/browser/web_test_browser_context.h"
#include "content/web_test/browser/web_test_content_browser_client.h"
#include "content/web_test/browser/web_test_permission_manager.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h"
namespace content {
namespace {
const uint8_t kTestP256Key[] = …;
static_assert …;
const uint8_t kAuthentication[] = …;
static_assert …;
const int64_t kTestExpirationWindowInDays = …;
base::Time GetFutureTime() { … }
}
WebTestPushMessagingService::WebTestPushMessagingService()
: … { … }
WebTestPushMessagingService::~WebTestPushMessagingService() { … }
void WebTestPushMessagingService::SubscribeFromDocument(
const GURL& requesting_origin,
int64_t service_worker_registration_id,
int render_process_id,
int render_frame_id,
blink::mojom::PushSubscriptionOptionsPtr options,
bool user_gesture,
RegisterCallback callback) { … }
void WebTestPushMessagingService::SubscribeFromWorker(
const GURL& requesting_origin,
int64_t service_worker_registration_id,
int render_process_id,
blink::mojom::PushSubscriptionOptionsPtr options,
RegisterCallback callback) { … }
void WebTestPushMessagingService::GetSubscriptionInfo(
const GURL& origin,
int64_t service_worker_registration_id,
const std::string& sender_id,
const std::string& subscription_id,
SubscriptionInfoCallback callback) { … }
bool WebTestPushMessagingService::SupportNonVisibleMessages() { … }
void WebTestPushMessagingService::Unsubscribe(
blink::mojom::PushUnregistrationReason reason,
const GURL& requesting_origin,
int64_t service_worker_registration_id,
const std::string& sender_id,
UnregisterCallback callback) { … }
void WebTestPushMessagingService::DidDeleteServiceWorkerRegistration(
const GURL& origin,
int64_t service_worker_registration_id) { … }
void WebTestPushMessagingService::DidDeleteServiceWorkerDatabase() { … }
GURL WebTestPushMessagingService::CreateEndpoint(
const std::string& subscription_id) const { … }
}