#include "chrome/browser/ui/commerce/price_tracking_page_action_controller.h"
#include <memory>
#include <optional>
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "chrome/test/base/testing_profile.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/mock_shopping_service.h"
#include "components/commerce/core/shopping_service.h"
#include "components/commerce/core/subscriptions/commerce_subscription.h"
#include "components/commerce/core/test_utils.h"
#include "components/feature_engagement/test/mock_tracker.h"
#include "components/image_fetcher/core/mock_image_fetcher.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "url/gurl.h"
namespace commerce {
namespace {
std::optional<ProductInfo> CreateProductInfo(uint64_t cluster_id,
const GURL& image_url = GURL()) { … }
}
class PriceTrackingPageActionControllerUnittest : public testing::Test { … };
TEST_F(PriceTrackingPageActionControllerUnittest, IconShown) { … }
TEST_F(PriceTrackingPageActionControllerUnittest, IconNotShown_NoImage) { … }
TEST_F(PriceTrackingPageActionControllerUnittest, IconNotShown_NoProductInfo) { … }
TEST_F(PriceTrackingPageActionControllerUnittest, IconNotShown_NotEligible) { … }
TEST_F(PriceTrackingPageActionControllerUnittest,
SubscriptionEventsUpdateState) { … }
TEST_F(PriceTrackingPageActionControllerUnittest, WantsExpandedUi_HighPrice) { … }
TEST_F(PriceTrackingPageActionControllerUnittest, WantsExpandedUi_Tracker) { … }
TEST_F(PriceTrackingPageActionControllerUnittest,
IconInteractionStateMetrics_Expanded) { … }
TEST_F(PriceTrackingPageActionControllerUnittest,
IconInteractionStateMetrics_NotExpanded) { … }
TEST_F(PriceTrackingPageActionControllerUnittest,
IconInteractionStateMetrics_AlreadyTracked) { … }
}