chromium/chrome/browser/ui/views/autofill/payments/autofill_error_dialog_view_native_views_browsertest.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/autofill/payments/autofill_error_dialog_view_native_views.h"

#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/ui/autofill/payments/view_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
#include "components/autofill/core/browser/payments/autofill_error_dialog_context.h"
#include "components/autofill/core/browser/ui/payments/autofill_error_dialog_controller_impl.h"
#include "components/autofill/core/browser/ui/payments/autofill_error_dialog_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
#include "content/public/test/browser_test.h"

namespace autofill {

// Param of the AutofillErrorDialogViewNativeViewsBrowserTest:
// -- bool server_did_return_title;
// -- bool server_did_return_description;
class AutofillErrorDialogViewNativeViewsBrowserTest
    : public DialogBrowserTest,
      public testing::WithParamInterface<std::tuple<bool, bool>> {};

INSTANTIATE_TEST_SUITE_P();

// Verify that the dialog is shown, and the metrics for shown are incremented
// correctly for virtual card temporary error.
IN_PROC_BROWSER_TEST_P(AutofillErrorDialogViewNativeViewsBrowserTest,
                       InvokeUi_temporary) {}

// Verify that the dialog is shown, and the metrics for shown are incremented
// correctly for virtual card permanent error.
IN_PROC_BROWSER_TEST_P(AutofillErrorDialogViewNativeViewsBrowserTest,
                       InvokeUi_permanent) {}

// Verify that the dialog is shown, and the metrics for shown are incremented
// correctly for virtual card not eligible error.
IN_PROC_BROWSER_TEST_P(AutofillErrorDialogViewNativeViewsBrowserTest,
                       InvokeUi_eligibility) {}

// Ensures closing current tab while dialog being visible is correctly handled,
// and the metrics for shown are incremented correctly.
IN_PROC_BROWSER_TEST_P(AutofillErrorDialogViewNativeViewsBrowserTest,
                       CloseTabWhileDialogShowing) {}

// Ensures closing browser while dialog being visible is correctly handled, and
// the metrics for shown are incremented correctly.
IN_PROC_BROWSER_TEST_P(AutofillErrorDialogViewNativeViewsBrowserTest,
                       CanCloseBrowserWhileDialogShowing) {}

// Ensures clicking on the cancel button is correctly handled, and the metrics
// for shown are incremented correctly.
IN_PROC_BROWSER_TEST_P(AutofillErrorDialogViewNativeViewsBrowserTest,
                       ClickCancelButton) {}

}  // namespace autofill