OLD | NEW |
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 PaymentInstrumentPtr instrument_1 = PaymentInstrument::New(); |
| 124 instrument_1->enabled_methods.push_back("hellopay"); |
| 125 SetPaymentInstrument(manager1, "test_key1", std::move(instrument_1), |
124 base::Bind(&SetPaymentInstrumentCallback, &status)); | 126 base::Bind(&SetPaymentInstrumentCallback, &status)); |
125 SetPaymentInstrument(manager2, "test_key2", PaymentInstrument::New(), | 127 |
| 128 PaymentInstrumentPtr instrument_2 = PaymentInstrument::New(); |
| 129 instrument_2->enabled_methods.push_back("hellopay"); |
| 130 SetPaymentInstrument(manager2, "test_key2", std::move(instrument_2), |
126 base::Bind(&SetPaymentInstrumentCallback, &status)); | 131 base::Bind(&SetPaymentInstrumentCallback, &status)); |
127 SetPaymentInstrument(manager2, "test_key3", PaymentInstrument::New(), | 132 |
| 133 PaymentInstrumentPtr instrument_3 = PaymentInstrument::New(); |
| 134 instrument_3->enabled_methods.push_back("bobpay"); |
| 135 SetPaymentInstrument(manager2, "test_key3", std::move(instrument_3), |
128 base::Bind(&SetPaymentInstrumentCallback, &status)); | 136 base::Bind(&SetPaymentInstrumentCallback, &status)); |
129 | 137 |
130 PaymentAppProvider::PaymentApps apps; | 138 PaymentAppProvider::PaymentApps apps; |
131 GetAllPaymentApps(base::Bind(&GetAllPaymentAppsCallback, &apps)); | 139 GetAllPaymentApps(base::Bind(&GetAllPaymentAppsCallback, &apps)); |
132 | 140 |
133 ASSERT_EQ(2U, apps.size()); | 141 ASSERT_EQ(2U, apps.size()); |
134 ASSERT_EQ(1U, apps[GURL("https://hellopay.com/")]->instruments.size()); | 142 ASSERT_EQ(1U, apps[GURL("https://hellopay.com/")]->enabled_methods.size()); |
135 ASSERT_EQ(2U, apps[GURL("https://bobpay.com/")]->instruments.size()); | 143 ASSERT_EQ(2U, apps[GURL("https://bobpay.com/")]->enabled_methods.size()); |
136 } | 144 } |
137 | 145 |
138 } // namespace content | 146 } // namespace content |
OLD | NEW |