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

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

Issue 2969713002: [Payments] Present web payment app instead of instruments to user (Closed)
Patch Set: address comments Created 3 years, 5 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 bab82aec4d0016a949f2260c006874587ebee687..9d97a400720774e3255fbc774060e1379f86b78f 100644
--- a/content/browser/payments/payment_app_browsertest.cc
+++ b/content/browser/payments/payment_app_browsertest.cc
@@ -84,7 +84,7 @@ class PaymentAppBrowserTest : public ContentBrowserTest {
ASSERT_EQ("registered", script_result);
}
- std::map<std::string, int64_t> GetAllPaymentInstrumentRegistrationIDs() {
+ std::vector<int64_t> GetAllPaymentAppRegistrationIDs() {
base::RunLoop run_loop;
PaymentAppProvider::PaymentApps apps;
PaymentAppProvider::GetInstance()->GetAllPaymentApps(
@@ -93,12 +93,9 @@ class PaymentAppBrowserTest : public ContentBrowserTest {
&apps));
run_loop.Run();
- std::map<std::string, int64_t> registrationIds;
+ std::vector<int64_t> registrationIds;
for (const auto& app_info : apps) {
- for (const auto& instrument : app_info.second->instruments) {
- registrationIds.insert(std::pair<std::string, int64_t>(
- instrument->instrument_key, app_info.second->registration_id));
- }
+ registrationIds.push_back(app_info.second->registration_id);
}
return registrationIds;
@@ -170,18 +167,16 @@ class PaymentAppBrowserTest : public ContentBrowserTest {
IN_PROC_BROWSER_TEST_F(PaymentAppBrowserTest, PaymentAppInvocation) {
RegisterPaymentApp();
- std::map<std::string, int64_t> registrationIds =
- GetAllPaymentInstrumentRegistrationIDs();
- ASSERT_EQ(2U, registrationIds.size());
+ std::vector<int64_t> registrationIds = GetAllPaymentAppRegistrationIDs();
+ ASSERT_EQ(1U, registrationIds.size());
PaymentAppResponsePtr response(InvokePaymentAppWithTestData(
- registrationIds.at("basic-card-payment-app-id"), "basic-card",
- "basic-card-payment-app-id"));
+ registrationIds[0], "basic-card", "basic-card-payment-app-id"));
ASSERT_EQ("test", response->method_name);
ClearStoragePartitionData();
- registrationIds = GetAllPaymentInstrumentRegistrationIDs();
+ registrationIds = GetAllPaymentAppRegistrationIDs();
ASSERT_EQ(0U, registrationIds.size());
EXPECT_EQ("https://example.com/", PopConsoleString() /* topLevelOrigin */);
@@ -206,20 +201,18 @@ IN_PROC_BROWSER_TEST_F(PaymentAppBrowserTest, PaymentAppInvocation) {
IN_PROC_BROWSER_TEST_F(PaymentAppBrowserTest, PaymentAppOpenWindowFailed) {
RegisterPaymentApp();
- std::map<std::string, int64_t> registrationIds =
- GetAllPaymentInstrumentRegistrationIDs();
- ASSERT_EQ(2U, registrationIds.size());
+ std::vector<int64_t> registrationIds = GetAllPaymentAppRegistrationIDs();
+ ASSERT_EQ(1U, registrationIds.size());
PaymentAppResponsePtr response(InvokePaymentAppWithTestData(
- registrationIds.at("bobpay-payment-app-id"), "https://bobpay.com",
- "bobpay-payment-app-id"));
+ registrationIds[0], "https://bobpay.com", "bobpay-payment-app-id"));
// InvokePaymentAppCallback returns empty method_name in case of failure, like
// in PaymentRequestRespondWithObserver::OnResponseRejected.
ASSERT_EQ("", response->method_name);
ClearStoragePartitionData();
- registrationIds = GetAllPaymentInstrumentRegistrationIDs();
+ registrationIds = GetAllPaymentAppRegistrationIDs();
ASSERT_EQ(0U, registrationIds.size());
EXPECT_EQ("https://example.com/", PopConsoleString() /* topLevelOrigin */);
« no previous file with comments | « chrome/browser/android/payments/service_worker_payment_app_bridge.cc ('k') | content/browser/payments/payment_app_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698