| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/payments/core/test_payment_request_delegate.h" | 5 #include "components/payments/core/test_payment_request_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 | 8 |
| 9 namespace payments { | 9 namespace payments { |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 const GURL& TestPaymentRequestDelegate::GetLastCommittedURL() const { | 36 const GURL& TestPaymentRequestDelegate::GetLastCommittedURL() const { |
| 37 return last_committed_url_; | 37 return last_committed_url_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void TestPaymentRequestDelegate::DoFullCardRequest( | 40 void TestPaymentRequestDelegate::DoFullCardRequest( |
| 41 const autofill::CreditCard& credit_card, | 41 const autofill::CreditCard& credit_card, |
| 42 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | 42 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> |
| 43 result_delegate) { | 43 result_delegate) { |
| 44 result_delegate->OnFullCardRequestSucceeded(credit_card, | 44 if (instantaneous_full_card_request_result_) { |
| 45 base::ASCIIToUTF16("123")); | 45 result_delegate->OnFullCardRequestSucceeded(credit_card, |
| 46 base::ASCIIToUTF16("123")); |
| 47 return; |
| 48 } |
| 49 |
| 50 full_card_request_card_ = credit_card; |
| 51 full_card_result_delegate_ = result_delegate; |
| 46 } | 52 } |
| 47 | 53 |
| 48 AddressNormalizer* TestPaymentRequestDelegate::GetAddressNormalizer() { | 54 AddressNormalizer* TestPaymentRequestDelegate::GetAddressNormalizer() { |
| 49 return &address_normalizer_; | 55 return &address_normalizer_; |
| 50 } | 56 } |
| 51 | 57 |
| 52 TestAddressNormalizer* TestPaymentRequestDelegate::GetTestAddressNormalizer() { | |
| 53 return &address_normalizer_; | |
| 54 } | |
| 55 | |
| 56 autofill::RegionDataLoader* TestPaymentRequestDelegate::GetRegionDataLoader() { | 58 autofill::RegionDataLoader* TestPaymentRequestDelegate::GetRegionDataLoader() { |
| 57 return nullptr; | 59 return nullptr; |
| 58 } | 60 } |
| 59 | 61 |
| 62 TestAddressNormalizer* TestPaymentRequestDelegate::test_address_normalizer() { |
| 63 return &address_normalizer_; |
| 64 } |
| 65 |
| 66 void TestPaymentRequestDelegate::DelayFullCardRequestCompletion() { |
| 67 instantaneous_full_card_request_result_ = false; |
| 68 } |
| 69 |
| 70 void TestPaymentRequestDelegate::CompleteFullCardRequest() { |
| 71 DCHECK(instantaneous_full_card_request_result_ == false); |
| 72 full_card_result_delegate_->OnFullCardRequestSucceeded( |
| 73 full_card_request_card_, base::ASCIIToUTF16("123")); |
| 74 } |
| 75 |
| 60 } // namespace payments | 76 } // namespace payments |
| OLD | NEW |