Chromium Code Reviews| Index: chrome/browser/ui/views/payments/payment_request_interactive_uitest.cc |
| diff --git a/chrome/browser/ui/views/payments/payment_request_interactive_uitest.cc b/chrome/browser/ui/views/payments/payment_request_interactive_uitest.cc |
| index f4838628d8324b77a1c9122b0468a8a360a4ba18..d32ce190c74cf4ff76e5cb8c7cea08840f1cf724 100644 |
| --- a/chrome/browser/ui/views/payments/payment_request_interactive_uitest.cc |
| +++ b/chrome/browser/ui/views/payments/payment_request_interactive_uitest.cc |
| @@ -4,9 +4,13 @@ |
| #include <vector> |
| +#include "chrome/browser/ui/browser_commands.h" |
| #include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h" |
| +#include "chrome/test/base/ui_test_utils.h" |
| #include "components/payments/payment_request.h" |
| #include "components/payments/payment_request_web_contents_manager.h" |
| +#include "components/web_modal/web_contents_modal_dialog_manager.h" |
| +#include "content/public/test/browser_test_utils.h" |
| namespace payments { |
| @@ -36,4 +40,62 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenPaymentRequestSheet) { |
| InvokePaymentRequestUI(); |
| } |
| +IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndNavigateTo404) { |
| + InvokePaymentRequestUI(); |
| + |
| + event_observer_.reset(new DialogEventObserver(DialogEvent::DIALOG_CLOSED)); |
|
sky
2017/01/24 00:45:02
MakeUnique where possible.
Mathieu
2017/01/24 01:11:39
Acknowledged.
|
| + |
| + ui_test_utils::NavigateToURL(browser(), |
| + https_server()->GetURL("/non-existent.html")); |
| + |
| + event_observer_->Wait(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndNavigateToSame) { |
| + InvokePaymentRequestUI(); |
| + |
| + event_observer_.reset(new DialogEventObserver(DialogEvent::DIALOG_CLOSED)); |
| + |
| + ui_test_utils::NavigateToURL( |
| + browser(), |
| + https_server()->GetURL("/payment_request_no_shipping_test.html")); |
| + |
| + event_observer_->Wait(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndReload) { |
| + InvokePaymentRequestUI(); |
| + |
| + event_observer_.reset(new DialogEventObserver(DialogEvent::DIALOG_CLOSED)); |
| + |
| + chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
| + |
| + event_observer_->Wait(); |
| +} |
| + |
| +class PaymentRequestAbortTest : public PaymentRequestInteractiveTestBase { |
| + protected: |
| + PaymentRequestAbortTest() |
| + : PaymentRequestInteractiveTestBase("/payment_request_abort_test.html") {} |
| +}; |
| + |
| +// Testing the use of the abort() JS API. |
| +IN_PROC_BROWSER_TEST_F(PaymentRequestAbortTest, OpenThenAbort) { |
| + InvokePaymentRequestUI(); |
| + |
| + event_observer_.reset(new DialogEventObserver(DialogEvent::DIALOG_CLOSED)); |
| + |
| + content::WebContents* web_contents = GetActiveWebContents(); |
| + const std::string click_buy_button_js = |
| + "(function() { document.getElementById('abort').click(); })();"; |
| + ASSERT_TRUE(content::ExecuteScript(web_contents, click_buy_button_js)); |
| + |
| + event_observer_->Wait(); |
| + |
| + // The web-modal dialog should now be closed. |
| + web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| + web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| + EXPECT_FALSE(web_contents_modal_dialog_manager->IsDialogActive()); |
| +} |
| + |
| } // namespace payments |