| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_ba
se.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_ba
se.h" |
| 9 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 10 #include "components/payments/payment_request.h" | 12 #include "components/payments/payment_request.h" |
| 11 #include "components/payments/payment_request_web_contents_manager.h" | 13 #include "components/payments/payment_request_web_contents_manager.h" |
| 12 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 14 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
| 14 | 16 |
| 15 namespace payments { | 17 namespace payments { |
| 16 | 18 |
| 17 class PaymentRequestWebContentsManagerTest | 19 class PaymentRequestWebContentsManagerTest |
| (...skipping 11 matching lines...) Expand all Loading... |
| 29 EXPECT_EQ(5U, payment_requests.size()); | 31 EXPECT_EQ(5U, payment_requests.size()); |
| 30 } | 32 } |
| 31 | 33 |
| 32 class PaymentRequestNoShippingTest : public PaymentRequestInteractiveTestBase { | 34 class PaymentRequestNoShippingTest : public PaymentRequestInteractiveTestBase { |
| 33 protected: | 35 protected: |
| 34 PaymentRequestNoShippingTest() | 36 PaymentRequestNoShippingTest() |
| 35 : PaymentRequestInteractiveTestBase( | 37 : PaymentRequestInteractiveTestBase( |
| 36 "/payment_request_no_shipping_test.html") {} | 38 "/payment_request_no_shipping_test.html") {} |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenPaymentRequestSheet) { | 41 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, |
| 42 OpenAndNavigateToOrderSummary) { |
| 40 InvokePaymentRequestUI(); | 43 InvokePaymentRequestUI(); |
| 44 |
| 45 OpenOrderSummaryScreen(); |
| 46 |
| 47 // Verify the expected amounts are shown. |
| 48 EXPECT_EQ(base::ASCIIToUTF16("USD $5.00"), |
| 49 GetStyledLabelText(DialogViewID::ORDER_SUMMARY_TOTAL_AMOUNT_LABEL)); |
| 50 EXPECT_EQ(base::ASCIIToUTF16("$4.50"), |
| 51 GetStyledLabelText(DialogViewID::ORDER_SUMMARY_LINE_ITEM_1)); |
| 52 EXPECT_EQ(base::ASCIIToUTF16("$0.50"), |
| 53 GetStyledLabelText(DialogViewID::ORDER_SUMMARY_LINE_ITEM_2)); |
| 41 } | 54 } |
| 42 | 55 |
| 43 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndNavigateTo404) { | 56 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndNavigateTo404) { |
| 44 InvokePaymentRequestUI(); | 57 InvokePaymentRequestUI(); |
| 45 | 58 |
| 46 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 59 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 47 | 60 |
| 48 ui_test_utils::NavigateToURL(browser(), | 61 ui_test_utils::NavigateToURL(browser(), |
| 49 https_server()->GetURL("/non-existent.html")); | 62 https_server()->GetURL("/non-existent.html")); |
| 50 | 63 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 105 |
| 93 WaitForObservedEvent(); | 106 WaitForObservedEvent(); |
| 94 | 107 |
| 95 // The web-modal dialog should now be closed. | 108 // The web-modal dialog should now be closed. |
| 96 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 109 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 97 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); | 110 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| 98 EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive()); | 111 EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive()); |
| 99 } | 112 } |
| 100 | 113 |
| 101 } // namespace payments | 114 } // namespace payments |
| OLD | NEW |