#include <memory>
#include <vector>
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "chrome/browser/ui/commerce/commerce_ui_tab_helper.h"
#include "chrome/browser/ui/views/side_panel/side_panel_entry.h"
#include "chrome/browser/ui/views/side_panel/side_panel_registry.h"
#include "chrome/browser/ui/views/side_panel/side_panel_util.h"
#include "chrome/test/base/testing_profile.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/test/test_bookmark_client.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/mock_shopping_service.h"
#include "components/commerce/core/price_tracking_utils.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/image_fetcher/core/mock_image_fetcher.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_web_contents_factory.h"
#include "content/public/test/web_contents_tester.h"
#include "services/metrics/public/cpp/ukm_builders.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 {
const char kProductUrl[] = …;
const char kProductImageUrl[] = …;
const uint64_t kClusterId = …;
const char kProductClusterTitle[] = …;
std::optional<ProductInfo> CreateProductInfo(
uint64_t cluster_id,
const GURL& url = GURL(),
const std::string cluster_title = std::string()) { … }
}
Shopping_ShoppingInformation;
class CommerceUiTabHelperTest : public testing::Test { … };
TEST_F(CommerceUiTabHelperTest,
TestPriceTrackingIconAvailabilityIfNoImage) { … }
TEST_F(CommerceUiTabHelperTest,
TestPriceTrackingIconAvailabilityWithImage) { … }
TEST_F(CommerceUiTabHelperTest, TestSubscriptionChangeNoBookmark) { … }
TEST_F(CommerceUiTabHelperTest, TestShoppingInsightsSidePanelAvailable) { … }
TEST_F(CommerceUiTabHelperTest, TestShoppingInsightsSidePanelUnavailable) { … }
TEST_F(CommerceUiTabHelperTest,
TestPriceInsightsIconNotAvailableIfEmptyProductInfo) { … }
TEST_F(CommerceUiTabHelperTest,
TestPriceInsightsIconNotAvailableIfNoProductClusterTitle) { … }
TEST_F(CommerceUiTabHelperTest, TestRecordShoppingInformationUKM) { … }
}