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

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

Issue 2610163002: PaymentApp: Implement InvokePaymentApp() in browser side. (Closed)
Patch Set: nhiroki's comments Created 3 years, 11 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
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();

Powered by Google App Engine
This is Rietveld 408576698