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

Unified Diff: content/browser/payments/payment_app_browsertest.cc

Issue 2718013004: PaymentApp: Implement respondWith() in PaymentRequestEvent. (content side) (Closed)
Patch Set: rebase Created 3 years, 9 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/payments/payment_app_browsertest.cc
diff --git a/content/browser/payments/payment_app_browsertest.cc b/content/browser/payments/payment_app_browsertest.cc
index 6810dd38f37ad07bebc7675d1e8a58c47c920743..9f840a0f575c533c7bc309cc8cd30f32dc6b39e9 100644
--- a/content/browser/payments/payment_app_browsertest.cc
+++ b/content/browser/payments/payment_app_browsertest.cc
@@ -26,6 +26,14 @@ void GetAllManifestsCallback(const base::Closure& done_callback,
done_callback.Run();
}
+void InvokePaymentAppCallback(
+ const base::Closure& done_callback,
+ payments::mojom::PaymentAppResponsePtr* out_response,
+ payments::mojom::PaymentAppResponsePtr response) {
+ *out_response = std::move(response);
+ done_callback.Run();
+}
+
} // namespace
class PaymentAppBrowserTest : public ContentBrowserTest {
@@ -83,16 +91,25 @@ class PaymentAppBrowserTest : public ContentBrowserTest {
return ids;
}
- void InvokePaymentApp(int64_t registration_id) {
+ payments::mojom::PaymentAppResponsePtr InvokePaymentApp(
+ int64_t registration_id) {
payments::mojom::PaymentAppRequestPtr app_request =
payments::mojom::PaymentAppRequest::New();
app_request->methodData.push_back(
payments::mojom::PaymentMethodData::New());
app_request->total = payments::mojom::PaymentItem::New();
app_request->total->amount = payments::mojom::PaymentCurrencyAmount::New();
+
+ base::RunLoop run_loop;
+ payments::mojom::PaymentAppResponsePtr response;
PaymentAppProvider::GetInstance()->InvokePaymentApp(
shell()->web_contents()->GetBrowserContext(), registration_id,
- std::move(app_request));
+ std::move(app_request),
+ base::Bind(&InvokePaymentAppCallback, run_loop.QuitClosure(),
+ &response));
+ run_loop.Run();
+
+ return response;
}
private:
@@ -107,10 +124,8 @@ IN_PROC_BROWSER_TEST_F(PaymentAppBrowserTest, PaymentAppInvocation) {
std::vector<int64_t> ids = GetAllPaymentAppIDs();
ASSERT_EQ(1U, ids.size());
- InvokePaymentApp(ids[0]);
-
- ASSERT_EQ("payment_app_window_ready", PopConsoleString());
- ASSERT_EQ("payment_app_response", PopConsoleString());
+ payments::mojom::PaymentAppResponsePtr response(InvokePaymentApp(ids[0]));
+ ASSERT_EQ("test", response->method_name);
}
} // namespace content
« no previous file with comments | « components/payments/content/payment_app.mojom ('k') | content/browser/payments/payment_app_content_unittest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698