#include <memory>
#include <string>
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/ui/autofill/payments/virtual_card_enroll_bubble_controller_impl.h"
#include "chrome/browser/ui/autofill/payments/virtual_card_enroll_bubble_controller_impl_test_api.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/autofill/payments/dialog_view_ids.h"
#include "chrome/browser/ui/views/autofill/payments/virtual_card_enroll_bubble_views.h"
#include "chrome/browser/ui/views/autofill/payments/virtual_card_enroll_icon_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/toolbar_button_provider.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/metrics/payments/virtual_card_enrollment_metrics.h"
#include "components/autofill/core/browser/payments/legal_message_line.h"
#include "components/autofill/core/browser/payments/payments_service_url.h"
#include "components/autofill/core/browser/payments/test_legal_message_line.h"
#include "components/autofill/core/browser/payments/virtual_card_enrollment_manager.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/test/browser_test.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/gfx/image/image_unittest_util.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/view_observer.h"
namespace autofill {
namespace {
constexpr int kCardImageWidthInPx = …;
constexpr int kCardImageLengthInPx = …;
}
class VirtualCardEnrollBubbleViewsInteractiveUiTest
: public InProcessBrowserTest { … };
class VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized
: public VirtualCardEnrollBubbleViewsInteractiveUiTest,
public testing::WithParamInterface<VirtualCardEnrollmentSource> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
ShowBubble) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
Metrics_BubbleLostFocus) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
Metrics_BubbleCancelled) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
Metrics_BubbleClosed) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
Metrics_NotInteracted) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
ShownAndLostFocusTest_AllSources) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
LearnMoreTest_AllSources) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
GoogleLegalMessageTest_AllSources) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
IssuerLegalMessageTest_AllSources) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
CardArtAvailableTest_AllSources) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
CardArtNotAvailableTest_AllSources) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
PreviouslyDeclinedTest_AllSources) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
NoLoggingOnLinkClickReshowBubbleTest) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
IconViewAccessibleName) { … }
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestParameterized,
ShowLoadingViewOnAccept) { … }
class
VirtualCardEnrollBubbleViewsInteractiveUiTestDisabledLoadingAndConfirmation
: public VirtualCardEnrollBubbleViewsInteractiveUiTest,
public testing::WithParamInterface<VirtualCardEnrollmentSource> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(
VirtualCardEnrollBubbleViewsInteractiveUiTestDisabledLoadingAndConfirmation,
CloseBubbleOnAcceptWhenLoadingAndConfirmationIsDisabled) { … }
}