Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: content/browser/service_worker/embedded_worker_test_helper.cc

Issue 2682353002: Mojoify the notificationclick and notificationclose events (Closed)
Patch Set: Mojoify the notificationclick and notificationclose events Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/embedded_worker_test_helper.h ('k') | content/common/service_worker/OWNERS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/embedded_worker_test_helper.cc
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc
index da005712c138d692db181626ac7919d4dffb16f9..caa07fcff9e03d2e72d947cf45318a344e7e2e20 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.cc
+++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -159,6 +159,28 @@ class EmbeddedWorkerTestHelper::MockServiceWorkerEventDispatcher
std::move(preload_handle), callback);
}
+ void DispatchNotificationClickEvent(
+ const std::string& notification_id,
+ const PlatformNotificationData& notification_data,
+ int action_index,
+ const base::Optional<base::string16>& reply,
+ const DispatchNotificationClickEventCallback& callback) override {
+ if (!helper_)
+ return;
+ helper_->OnNotificationClickEventStub(notification_id, notification_data,
+ action_index, reply, callback);
+ }
+
+ void DispatchNotificationCloseEvent(
+ const std::string& notification_id,
+ const PlatformNotificationData& notification_data,
+ const DispatchNotificationCloseEventCallback& callback) override {
+ if (!helper_)
+ return;
+ helper_->OnNotificationCloseEventStub(notification_id, notification_data,
+ callback);
+ }
+
void DispatchPushEvent(const PushEventPayload& payload,
const DispatchPushEventCallback& callback) override {
if (!helper_)
@@ -384,6 +406,24 @@ void EmbeddedWorkerTestHelper::OnPushEvent(
callback.Run(SERVICE_WORKER_OK, base::Time::Now());
}
+void EmbeddedWorkerTestHelper::OnNotificationClickEvent(
+ const std::string& notification_id,
+ const PlatformNotificationData& notification_data,
+ int action_index,
+ const base::Optional<base::string16>& reply,
+ const mojom::ServiceWorkerEventDispatcher::
+ DispatchNotificationClickEventCallback& callback) {
+ callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+}
+
+void EmbeddedWorkerTestHelper::OnNotificationCloseEvent(
+ const std::string& notification_id,
+ const PlatformNotificationData& notification_data,
+ const mojom::ServiceWorkerEventDispatcher::
+ DispatchNotificationCloseEventCallback& callback) {
+ callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+}
+
void EmbeddedWorkerTestHelper::OnPaymentRequestEvent(
payments::mojom::PaymentAppRequestPtr app_request,
const mojom::ServiceWorkerEventDispatcher::
@@ -540,6 +580,30 @@ void EmbeddedWorkerTestHelper::OnFetchEventStub(
request, base::Passed(&preload_handle), callback));
}
+void EmbeddedWorkerTestHelper::OnNotificationClickEventStub(
+ const std::string& notification_id,
+ const PlatformNotificationData& notification_data,
+ int action_index,
+ const base::Optional<base::string16>& reply,
+ const mojom::ServiceWorkerEventDispatcher::
+ DispatchNotificationClickEventCallback& callback) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnNotificationClickEvent,
+ AsWeakPtr(), notification_id, notification_data,
+ action_index, reply, callback));
+}
+
+void EmbeddedWorkerTestHelper::OnNotificationCloseEventStub(
+ const std::string& notification_id,
+ const PlatformNotificationData& notification_data,
+ const mojom::ServiceWorkerEventDispatcher::
+ DispatchNotificationCloseEventCallback& callback) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(&EmbeddedWorkerTestHelper::OnNotificationCloseEvent,
+ AsWeakPtr(), notification_id, notification_data, callback));
+}
+
void EmbeddedWorkerTestHelper::OnPushEventStub(
const PushEventPayload& payload,
const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback&
« no previous file with comments | « content/browser/service_worker/embedded_worker_test_helper.h ('k') | content/common/service_worker/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698