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

Unified Diff: components/payments/core/test_payment_request_delegate.cc

Issue 2860563002: [Payments] Make AutofillPaymentInstrumentTest use test objects (Closed)
Patch Set: Addressed comment Created 3 years, 8 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
« no previous file with comments | « components/payments/core/test_payment_request_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/core/test_payment_request_delegate.cc
diff --git a/components/payments/core/test_payment_request_delegate.cc b/components/payments/core/test_payment_request_delegate.cc
index 35daf8b6f4f26969899391e7cf9c4785fb96dd8c..f36a2a8f9b2cf80a6efe97693f7c2de36606d602 100644
--- a/components/payments/core/test_payment_request_delegate.cc
+++ b/components/payments/core/test_payment_request_delegate.cc
@@ -41,20 +41,36 @@ void TestPaymentRequestDelegate::DoFullCardRequest(
const autofill::CreditCard& credit_card,
base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate>
result_delegate) {
- result_delegate->OnFullCardRequestSucceeded(credit_card,
- base::ASCIIToUTF16("123"));
+ if (instantaneous_full_card_request_result_) {
+ result_delegate->OnFullCardRequestSucceeded(credit_card,
+ base::ASCIIToUTF16("123"));
+ return;
+ }
+
+ full_card_request_card_ = credit_card;
+ full_card_result_delegate_ = result_delegate;
}
AddressNormalizer* TestPaymentRequestDelegate::GetAddressNormalizer() {
return &address_normalizer_;
}
-TestAddressNormalizer* TestPaymentRequestDelegate::GetTestAddressNormalizer() {
+autofill::RegionDataLoader* TestPaymentRequestDelegate::GetRegionDataLoader() {
+ return nullptr;
+}
+
+TestAddressNormalizer* TestPaymentRequestDelegate::test_address_normalizer() {
return &address_normalizer_;
}
-autofill::RegionDataLoader* TestPaymentRequestDelegate::GetRegionDataLoader() {
- return nullptr;
+void TestPaymentRequestDelegate::DelayFullCardRequestCompletion() {
+ instantaneous_full_card_request_result_ = false;
+}
+
+void TestPaymentRequestDelegate::CompleteFullCardRequest() {
+ DCHECK(instantaneous_full_card_request_result_ == false);
+ full_card_result_delegate_->OnFullCardRequestSucceeded(
+ full_card_request_card_, base::ASCIIToUTF16("123"));
}
} // namespace payments
« no previous file with comments | « components/payments/core/test_payment_request_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698