#include "chrome/browser/ui/views/payments/secure_payment_confirmation_dialog_view.h"
#include <optional>
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "cc/test/pixel_comparator.h"
#include "cc/test/pixel_test_utils.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
#include "chrome/browser/ui/views/payments/secure_payment_confirmation_views_util.h"
#include "chrome/browser/ui/views/payments/test_secure_payment_confirmation_payment_request_delegate.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/payments/core/sizes.h"
#include "components/strings/grit/components_strings.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/test/browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features_generated.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/test/mock_input_event_activation_protector.h"
#include "ui/views/window/dialog_client_view.h"
namespace payments {
namespace {
const SkBitmap CreateIcon(SkColor color, int width, int height) { … }
const SkBitmap CreateMaxSizeIcon(SkColor color) { … }
}
class SecurePaymentConfirmationDialogViewTest
: public DialogBrowserTest,
public SecurePaymentConfirmationDialogView::ObserverForTest { … };
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
ViewMatchesModel) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
AcceptButtonTest) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
AcceptButtonIgnoresAccidentalInputs) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
CancelButtonTest) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
ProgressBarVisible) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
ShowProgressBar) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
OnModelUpdated) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
InstrumentIconUpdated) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
WebContentsClosed) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
InvokeUi_default) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
DefaultInstrumentIcon) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
MerchantLabelFormat) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
OversizedInstrumentIcon) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
UndersizedInstrumentIcon) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
MidsizedInstrumentIcon) { … }
IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest,
OptOutShownWhenRequested) { … }
class SecurePaymentConfirmationDialogViewNetworkAndIssuerIconsTest
: public SecurePaymentConfirmationDialogViewTest { … };
IN_PROC_BROWSER_TEST_F(
SecurePaymentConfirmationDialogViewNetworkAndIssuerIconsTest,
ViewMatchesModel) { … }
IN_PROC_BROWSER_TEST_F(
SecurePaymentConfirmationDialogViewNetworkAndIssuerIconsTest,
NetworkRowNotShownIfIconNotPresent) { … }
IN_PROC_BROWSER_TEST_F(
SecurePaymentConfirmationDialogViewNetworkAndIssuerIconsTest,
IssuerRowNotShownIfIconNotPresent) { … }
class SecurePaymentConfirmationDialogViewInlineNetworkAndIssuerIconsTest
: public SecurePaymentConfirmationDialogViewTest { … };
IN_PROC_BROWSER_TEST_F(
SecurePaymentConfirmationDialogViewInlineNetworkAndIssuerIconsTest,
ViewMatchesModel) { … }
IN_PROC_BROWSER_TEST_F(
SecurePaymentConfirmationDialogViewInlineNetworkAndIssuerIconsTest,
NetworkIconNotShownIfNotPresent) { … }
IN_PROC_BROWSER_TEST_F(
SecurePaymentConfirmationDialogViewInlineNetworkAndIssuerIconsTest,
IssuerIconNotShownIfNotPresent) { … }
}