| 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 <list> | 5 #include <list> |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
| 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 shipping_option_labels[0]); | 85 shipping_option_labels[0]); |
| 86 EXPECT_EQ(base::ASCIIToUTF16("$5.00"), shipping_option_labels[1]); | 86 EXPECT_EQ(base::ASCIIToUTF16("$5.00"), shipping_option_labels[1]); |
| 87 | 87 |
| 88 // Go to the shipping address screen and select the second address (Canada). | 88 // Go to the shipping address screen and select the second address (Canada). |
| 89 OpenShippingAddressSectionScreen(); | 89 OpenShippingAddressSectionScreen(); |
| 90 ResetEventObserver(DialogEvent::SPEC_DONE_UPDATING); | 90 ResetEventObserver(DialogEvent::SPEC_DONE_UPDATING); |
| 91 ClickOnChildInListViewAndWait( | 91 ClickOnChildInListViewAndWait( |
| 92 /* child_index=*/1, /*total_num_children=*/2, | 92 /* child_index=*/1, /*total_num_children=*/2, |
| 93 DialogViewID::SHIPPING_ADDRESS_SHEET_LIST_VIEW, false); | 93 DialogViewID::SHIPPING_ADDRESS_SHEET_LIST_VIEW, false); |
| 94 | 94 |
| 95 // Now no address is selected. |
| 96 EXPECT_EQ(nullptr, request->state()->selected_shipping_profile()); |
| 97 EXPECT_EQ(request->state()->shipping_profiles().back(), |
| 98 request->state()->selected_shipping_option_error_profile()); |
| 99 |
| 100 // The address selector has this error. |
| 101 EXPECT_EQ(base::ASCIIToUTF16("We do not ship to this address"), |
| 102 GetLabelText(DialogViewID::SHIPPING_ADDRESS_OPTION_ERROR)); |
| 103 |
| 95 // There is no a longer shipping option section, because no shipping options | 104 // There is no a longer shipping option section, because no shipping options |
| 96 // are available for Canada. | 105 // are available for Canada. |
| 97 EXPECT_EQ(nullptr, dialog_view()->GetViewByID(static_cast<int>( | 106 EXPECT_EQ(nullptr, dialog_view()->GetViewByID(static_cast<int>( |
| 98 DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION))); | 107 DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION))); |
| 99 EXPECT_EQ(nullptr, | 108 EXPECT_EQ(nullptr, |
| 100 dialog_view()->GetViewByID(static_cast<int>( | 109 dialog_view()->GetViewByID(static_cast<int>( |
| 101 DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON))); | 110 DialogViewID::PAYMENT_SHEET_SHIPPING_OPTION_SECTION_BUTTON))); |
| 102 | 111 |
| 103 // There is now an appropriate error that is shown in the shipping address | |
| 104 // section of the Payment Sheet. The string is returned by the merchant. | |
| 105 EXPECT_EQ(base::ASCIIToUTF16("We do not ship to this address"), | |
| 106 GetProfileLabelValues( | |
| 107 DialogViewID::PAYMENT_SHEET_SHIPPING_ADDRESS_SECTION) | |
| 108 .back()); | |
| 109 | |
| 110 // Go to the address selector and see this error as well. | |
| 111 EXPECT_EQ(base::ASCIIToUTF16("We do not ship to this address"), | |
| 112 GetLabelText(DialogViewID::SHIPPING_ADDRESS_OPTION_ERROR)); | |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace payments | 114 } // namespace payments |
| OLD | NEW |