| 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..26109d2902d01e0539e150b3155fba6e0370cbf7 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();
|
| +
|
| + ResetEventObserver(DialogEvent::DIALOG_CLOSED);
|
| +
|
| + ui_test_utils::NavigateToURL(browser(),
|
| + https_server()->GetURL("/non-existent.html"));
|
| +
|
| + WaitForObservedEvent();
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndNavigateToSame) {
|
| + InvokePaymentRequestUI();
|
| +
|
| + ResetEventObserver(DialogEvent::DIALOG_CLOSED);
|
| +
|
| + ui_test_utils::NavigateToURL(
|
| + browser(),
|
| + https_server()->GetURL("/payment_request_no_shipping_test.html"));
|
| +
|
| + WaitForObservedEvent();
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndReload) {
|
| + InvokePaymentRequestUI();
|
| +
|
| + ResetEventObserver(DialogEvent::DIALOG_CLOSED);
|
| +
|
| + chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
|
| +
|
| + WaitForObservedEvent();
|
| +}
|
| +
|
| +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();
|
| +
|
| + ResetEventObserver(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));
|
| +
|
| + WaitForObservedEvent();
|
| +
|
| + // 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
|
|
|