| 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/content/payment_request_state.h" | 5 #include "components/payments/content/payment_request_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // PaymentRequestState::Observer: | 46 // PaymentRequestState::Observer: |
| 47 void OnSelectedInformationChanged() override { | 47 void OnSelectedInformationChanged() override { |
| 48 num_on_selected_information_changed_called_++; | 48 num_on_selected_information_changed_called_++; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // PaymentRequestState::Delegate: | 51 // PaymentRequestState::Delegate: |
| 52 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override { | 52 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override { |
| 53 payment_response_ = std::move(response); | 53 payment_response_ = std::move(response); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 PaymentRequestDelegate* GetPaymentRequestDelegate() override { |
| 57 return nullptr; |
| 58 } |
| 59 |
| 56 void RecreateStateWithOptionsAndDetails( | 60 void RecreateStateWithOptionsAndDetails( |
| 57 mojom::PaymentOptionsPtr options, | 61 mojom::PaymentOptionsPtr options, |
| 58 mojom::PaymentDetailsPtr details, | 62 mojom::PaymentDetailsPtr details, |
| 59 std::vector<mojom::PaymentMethodDataPtr> method_data) { | 63 std::vector<mojom::PaymentMethodDataPtr> method_data) { |
| 60 // The spec will be based on the |options| and |details| passed in. | 64 // The spec will be based on the |options| and |details| passed in. |
| 61 spec_ = base::MakeUnique<PaymentRequestSpec>( | 65 spec_ = base::MakeUnique<PaymentRequestSpec>( |
| 62 std::move(options), std::move(details), std::move(method_data), nullptr, | 66 std::move(options), std::move(details), std::move(method_data), nullptr, |
| 63 "en-US"); | 67 "en-US"); |
| 64 state_ = base::MakeUnique<PaymentRequestState>( | 68 state_ = base::MakeUnique<PaymentRequestState>( |
| 65 spec_.get(), this, "en-US", &test_personal_data_manager_); | 69 spec_.get(), this, "en-US", &test_personal_data_manager_); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 EXPECT_TRUE(state()->is_ready_to_pay()); | 408 EXPECT_TRUE(state()->is_ready_to_pay()); |
| 405 state()->GeneratePaymentResponse(); | 409 state()->GeneratePaymentResponse(); |
| 406 | 410 |
| 407 // Check that the name was set, but not the other values. | 411 // Check that the name was set, but not the other values. |
| 408 EXPECT_EQ("John H. Doe", response()->payer_name.value()); | 412 EXPECT_EQ("John H. Doe", response()->payer_name.value()); |
| 409 EXPECT_FALSE(response()->payer_phone.has_value()); | 413 EXPECT_FALSE(response()->payer_phone.has_value()); |
| 410 EXPECT_FALSE(response()->payer_email.has_value()); | 414 EXPECT_FALSE(response()->payer_email.has_value()); |
| 411 } | 415 } |
| 412 | 416 |
| 413 } // namespace payments | 417 } // namespace payments |
| OLD | NEW |