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 cadcdf5ac16d7ae68e8a20054cbbf6ae6558344a..68dbb3c57885441ae4c4af788cdccaa8510ec1b8 100644 |
--- a/content/browser/service_worker/embedded_worker_test_helper.cc |
+++ b/content/browser/service_worker/embedded_worker_test_helper.cc |
@@ -179,7 +179,9 @@ class EmbeddedWorkerTestHelper::MockServiceWorkerEventDispatcher |
void DispatchPaymentRequestEvent( |
payments::mojom::PaymentAppRequestDataPtr data, |
const DispatchPaymentRequestEventCallback& callback) override { |
- NOTIMPLEMENTED(); |
+ if (!helper_) |
+ return; |
+ helper_->OnPaymentRequestEventStub(std::move(data), callback); |
} |
void DispatchExtendableMessageEvent( |
@@ -387,6 +389,13 @@ void EmbeddedWorkerTestHelper::OnPushEvent( |
callback.Run(SERVICE_WORKER_OK, base::Time::Now()); |
} |
+void EmbeddedWorkerTestHelper::OnPaymentRequestEvent( |
+ payments::mojom::PaymentAppRequestDataPtr data, |
+ const mojom::ServiceWorkerEventDispatcher:: |
+ DispatchPaymentRequestEventCallback& callback) { |
+ callback.Run(SERVICE_WORKER_OK, base::Time::Now()); |
+} |
+ |
void EmbeddedWorkerTestHelper::SimulateWorkerReadyForInspection( |
int embedded_worker_id) { |
EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
@@ -545,6 +554,16 @@ void EmbeddedWorkerTestHelper::OnPushEventStub( |
payload, callback)); |
} |
+void EmbeddedWorkerTestHelper::OnPaymentRequestEventStub( |
+ payments::mojom::PaymentAppRequestDataPtr data, |
+ const mojom::ServiceWorkerEventDispatcher:: |
+ DispatchPaymentRequestEventCallback& callback) { |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&EmbeddedWorkerTestHelper::OnPaymentRequestEvent, AsWeakPtr(), |
+ base::Passed(std::move(data)), callback)); |
+} |
+ |
EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
DCHECK(context()); |
return context()->embedded_worker_registry(); |