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

Side by Side Diff: content/browser/payments/payment_app_provider_impl_unittest.cc

Issue 2958333002: [Payments] Implement web payment app manifest (Closed)
Patch Set: rename and 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cstddef> 5 #include <cstddef>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 GetAllPaymentApps(base::Bind(&GetAllPaymentAppsCallback, &apps)); 97 GetAllPaymentApps(base::Bind(&GetAllPaymentAppsCallback, &apps));
98 ASSERT_EQ(2U, apps.size()); 98 ASSERT_EQ(2U, apps.size());
99 99
100 payments::mojom::PaymentRequestEventDataPtr event_data = 100 payments::mojom::PaymentRequestEventDataPtr event_data =
101 payments::mojom::PaymentRequestEventData::New(); 101 payments::mojom::PaymentRequestEventData::New();
102 event_data->method_data.push_back(payments::mojom::PaymentMethodData::New()); 102 event_data->method_data.push_back(payments::mojom::PaymentMethodData::New());
103 event_data->total = payments::mojom::PaymentItem::New(); 103 event_data->total = payments::mojom::PaymentItem::New();
104 event_data->total->amount = payments::mojom::PaymentCurrencyAmount::New(); 104 event_data->total->amount = payments::mojom::PaymentCurrencyAmount::New();
105 105
106 bool called = false; 106 bool called = false;
107 InvokePaymentApp(apps[GURL("https://hellopay.com/")][0]->registration_id, 107 InvokePaymentApp(apps[GURL("https://hellopay.com/")]->registration_id,
108 std::move(event_data), 108 std::move(event_data),
109 base::Bind(&InvokePaymentAppCallback, &called)); 109 base::Bind(&InvokePaymentAppCallback, &called));
110 ASSERT_TRUE(called); 110 ASSERT_TRUE(called);
111 111
112 EXPECT_EQ(apps[GURL("https://hellopay.com/")][0]->registration_id, 112 EXPECT_EQ(apps[GURL("https://hellopay.com/")]->registration_id,
113 last_sw_registration_id()); 113 last_sw_registration_id());
114 } 114 }
115 115
116 TEST_F(PaymentAppProviderTest, GetAllPaymentAppsTest) { 116 TEST_F(PaymentAppProviderTest, GetAllPaymentAppsTest) {
117 PaymentManager* manager1 = CreatePaymentManager( 117 PaymentManager* manager1 = CreatePaymentManager(
118 GURL("https://hellopay.com/a"), GURL("https://hellopay.com/a/script.js")); 118 GURL("https://hellopay.com/a"), GURL("https://hellopay.com/a/script.js"));
119 PaymentManager* manager2 = CreatePaymentManager( 119 PaymentManager* manager2 = CreatePaymentManager(
120 GURL("https://bobpay.com/b"), GURL("https://bobpay.com/b/script.js")); 120 GURL("https://bobpay.com/b"), GURL("https://bobpay.com/b/script.js"));
121 121
122 PaymentHandlerStatus status; 122 PaymentHandlerStatus status;
123 SetPaymentInstrument(manager1, "test_key1", PaymentInstrument::New(), 123 SetPaymentInstrument(manager1, "test_key1", PaymentInstrument::New(),
124 base::Bind(&SetPaymentInstrumentCallback, &status)); 124 base::Bind(&SetPaymentInstrumentCallback, &status));
125 SetPaymentInstrument(manager2, "test_key2", PaymentInstrument::New(), 125 SetPaymentInstrument(manager2, "test_key2", PaymentInstrument::New(),
126 base::Bind(&SetPaymentInstrumentCallback, &status)); 126 base::Bind(&SetPaymentInstrumentCallback, &status));
127 SetPaymentInstrument(manager2, "test_key3", PaymentInstrument::New(), 127 SetPaymentInstrument(manager2, "test_key3", PaymentInstrument::New(),
128 base::Bind(&SetPaymentInstrumentCallback, &status)); 128 base::Bind(&SetPaymentInstrumentCallback, &status));
129 129
130 PaymentAppProvider::PaymentApps apps; 130 PaymentAppProvider::PaymentApps apps;
131 GetAllPaymentApps(base::Bind(&GetAllPaymentAppsCallback, &apps)); 131 GetAllPaymentApps(base::Bind(&GetAllPaymentAppsCallback, &apps));
132 132
133 ASSERT_EQ(2U, apps.size()); 133 ASSERT_EQ(2U, apps.size());
134 ASSERT_EQ(1U, apps[GURL("https://hellopay.com/")].size()); 134 ASSERT_EQ(1U, apps[GURL("https://hellopay.com/")]->instruments.size());
135 ASSERT_EQ(2U, apps[GURL("https://bobpay.com/")].size()); 135 ASSERT_EQ(2U, apps[GURL("https://bobpay.com/")]->instruments.size());
136 } 136 }
137 137
138 } // namespace content 138 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/payments/payment_app_info_fetcher.cc ('k') | content/browser/payments/payment_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698