#include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/time/default_clock.h"
#include "chrome/browser/commerce/shopping_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/commerce/mock_commerce_ui_tab_helper.h"
#include "chrome/browser/ui/views/commerce/discounts_coupon_code_label_view.h"
#include "chrome/browser/ui/views/commerce/discounts_icon_view.h"
#include "chrome/browser/ui/views/controls/subpage_view.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/mock_shopping_service.h"
#include "components/commerce/core/test_utils.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/strings/grit/components_strings.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/test/browser_test.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/interaction/interactive_test.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/interaction/interactive_views_test.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/widget/any_widget_observer.h"
namespace {
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
const char kShoppingURL[] = …;
std::unique_ptr<net::test_server::HttpResponse> BasicResponse(
const net::test_server::HttpRequest& request) { … }
}
class DiscountsInteractiveTest : public InteractiveBrowserTest { … };
class DiscountsIconViewInteractiveTest : public DiscountsInteractiveTest { … };
IN_PROC_BROWSER_TEST_F(DiscountsIconViewInteractiveTest,
DiscountsBubbleDialogShownOnPress) { … }
IN_PROC_BROWSER_TEST_F(DiscountsIconViewInteractiveTest,
DiscountsPageActionIconStateRecordedOnPress) { … }
IN_PROC_BROWSER_TEST_F(DiscountsIconViewInteractiveTest,
MetricsRecordedOnPress) { … }
IN_PROC_BROWSER_TEST_F(DiscountsIconViewInteractiveTest,
DiscountsPageActionIconClickedRecordedOnPress) { … }
class DiscountsBubbleDialogInteractiveTest : public DiscountsInteractiveTest { … };
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
CouponCodeCopiedOnCopyButtonPress) { … }
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
TooltipChangedOnCopyButtonPress) { … }
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
AccessibleNameChangedOnCopyButtonPress) { … }
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
MetricsCollectedOnCopyButtonPress) { … }
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
IsNotCopiedRecordedOnDialogClosed) { … }
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
IsCopiedRecordedOnDialogClosed) { … }
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
ShowTermsAndConditionOnClick) { … }
IN_PROC_BROWSER_TEST_F(DiscountsBubbleDialogInteractiveTest,
ShowMainPageOnBackPress) { … }