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

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

Issue 2665583002: PaymentApp: Rename PaymentAppRequestData to PaymentAppRequest. (Closed)
Patch Set: PaymentApp: Rename PaymentAppRequestData to PaymentAppRequest. Created 3 years, 10 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 app_request) {
55 PaymentAppProviderImpl::GetInstance()->InvokePaymentApp( 55 PaymentAppProviderImpl::GetInstance()->InvokePaymentApp(
56 browser_context(), registration_id, std::move(data)); 56 browser_context(), registration_id, std::move(app_request));
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
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 app_request =
132 payments::mojom::PaymentAppRequestData::New(); 132 payments::mojom::PaymentAppRequest::New();
133 data->methodData.push_back(payments::mojom::PaymentMethodData::New()); 133 app_request->methodData.push_back(payments::mojom::PaymentMethodData::New());
134 data->total = payments::mojom::PaymentItem::New(); 134 app_request->total = payments::mojom::PaymentItem::New();
135 data->total->amount = payments::mojom::PaymentCurrencyAmount::New(); 135 app_request->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(app_request));
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
OLDNEW
« no previous file with comments | « content/browser/payments/payment_app_provider_impl.cc ('k') | content/browser/service_worker/embedded_worker_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698