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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 PaymentAppProviderTest() {} | 44 PaymentAppProviderTest() {} |
45 ~PaymentAppProviderTest() override {} | 45 ~PaymentAppProviderTest() override {} |
46 | 46 |
47 void GetAllManifests(PaymentAppProvider::GetAllManifestsCallback callback) { | 47 void GetAllManifests(PaymentAppProvider::GetAllManifestsCallback callback) { |
48 PaymentAppProviderImpl::GetInstance()->GetAllManifests(browser_context(), | 48 PaymentAppProviderImpl::GetInstance()->GetAllManifests(browser_context(), |
49 callback); | 49 callback); |
50 base::RunLoop().RunUntilIdle(); | 50 base::RunLoop().RunUntilIdle(); |
51 } | 51 } |
52 | 52 |
53 void InvokePaymentApp(int64_t registration_id, | 53 void InvokePaymentApp(int64_t registration_id, |
54 payments::mojom::PaymentAppRequestDataPtr data) { | 54 payments::mojom::PaymentAppRequestPtr appRequest) { |
jam
2017/01/30 18:05:00
ditto in this file as well
| |
55 PaymentAppProviderImpl::GetInstance()->InvokePaymentApp( | 55 PaymentAppProviderImpl::GetInstance()->InvokePaymentApp( |
56 browser_context(), registration_id, std::move(data)); | 56 browser_context(), registration_id, std::move(appRequest)); |
57 base::RunLoop().RunUntilIdle(); | 57 base::RunLoop().RunUntilIdle(); |
58 } | 58 } |
59 | 59 |
60 void CreatePaymentApp(const GURL& scope_url, const GURL& sw_script_url) { | 60 void CreatePaymentApp(const GURL& scope_url, const GURL& sw_script_url) { |
61 PaymentAppManager* manager = | 61 PaymentAppManager* manager = |
62 CreatePaymentAppManager(scope_url, sw_script_url); | 62 CreatePaymentAppManager(scope_url, sw_script_url); |
63 | 63 |
64 PaymentAppManifestError error = | 64 PaymentAppManifestError error = |
65 PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED; | 65 PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED; |
66 bool called = false; | 66 bool called = false; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 CreatePaymentApp(GURL(kPaymentAppInfo[i].scopeUrl), | 121 CreatePaymentApp(GURL(kPaymentAppInfo[i].scopeUrl), |
122 GURL(kPaymentAppInfo[i].scriptUrl)); | 122 GURL(kPaymentAppInfo[i].scriptUrl)); |
123 } | 123 } |
124 | 124 |
125 PaymentAppProvider::Manifests manifests; | 125 PaymentAppProvider::Manifests manifests; |
126 bool called = false; | 126 bool called = false; |
127 GetAllManifests(base::Bind(&GetAllManifestsCallback, &called, &manifests)); | 127 GetAllManifests(base::Bind(&GetAllManifestsCallback, &called, &manifests)); |
128 ASSERT_TRUE(called); | 128 ASSERT_TRUE(called); |
129 ASSERT_EQ(3U, manifests.size()); | 129 ASSERT_EQ(3U, manifests.size()); |
130 | 130 |
131 payments::mojom::PaymentAppRequestDataPtr data = | 131 payments::mojom::PaymentAppRequestPtr appRequest = |
132 payments::mojom::PaymentAppRequestData::New(); | 132 payments::mojom::PaymentAppRequest::New(); |
133 data->methodData.push_back(payments::mojom::PaymentMethodData::New()); | 133 appRequest->methodData.push_back(payments::mojom::PaymentMethodData::New()); |
134 data->total = payments::mojom::PaymentItem::New(); | 134 appRequest->total = payments::mojom::PaymentItem::New(); |
135 data->total->amount = payments::mojom::PaymentCurrencyAmount::New(); | 135 appRequest->total->amount = payments::mojom::PaymentCurrencyAmount::New(); |
136 | 136 |
137 EXPECT_FALSE(payment_app_invoked()); | 137 EXPECT_FALSE(payment_app_invoked()); |
138 InvokePaymentApp(manifests[1].first, std::move(data)); | 138 InvokePaymentApp(manifests[1].first, std::move(appRequest)); |
139 | 139 |
140 ASSERT_TRUE(payment_app_invoked()); | 140 ASSERT_TRUE(payment_app_invoked()); |
141 EXPECT_EQ(manifests[1].first, last_sw_registration_id()); | 141 EXPECT_EQ(manifests[1].first, last_sw_registration_id()); |
142 EXPECT_EQ(GURL(kPaymentAppInfo[1].scopeUrl), last_sw_scope_url()); | 142 EXPECT_EQ(GURL(kPaymentAppInfo[1].scopeUrl), last_sw_scope_url()); |
143 } | 143 } |
144 | 144 |
145 } // namespace content | 145 } // namespace content |
OLD | NEW |