#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/lens/lens_overlay_image_helper.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/lens/lens_overlay_colors.h"
#include "components/lens/lens_features.h"
#include "lens_overlay_image_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/lens_server_proto/lens_overlay_image_crop.pb.h"
#include "third_party/lens_server_proto/lens_overlay_image_data.pb.h"
#include "third_party/lens_server_proto/lens_overlay_polygon.pb.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/webp_codec.h"
#include "ui/gfx/color_analysis.h"
#include "ui/gfx/geometry/rect.h"
namespace lens {
constexpr int kImageCompressionQuality = …;
constexpr int kImageMaxArea = …;
constexpr int kImageMaxHeight = …;
constexpr int kImageMaxWidth = …;
constexpr int kImageMaxAreaTier3 = …;
constexpr int kImageMaxHeightTier3 = …;
constexpr int kImageMaxWidthTier3 = …;
constexpr int kImageMaxAreaTier2 = …;
constexpr int kImageMaxHeightTier2 = …;
constexpr int kImageMaxWidthTier2 = …;
constexpr int kImageMaxAreaTier1 = …;
constexpr int kImageMaxHeightTier1 = …;
constexpr int kImageMaxWidthTier1 = …;
constexpr int kImageDownscaleUIScalingFactor = …;
class LensOverlayImageHelperTest : public testing::Test { … };
TEST_F(LensOverlayImageHelperTest, DownscaleAndEncodeBitmapMaxSize) { … }
TEST_F(LensOverlayImageHelperTest, DownscaleAndEncodeBitmapSmallSize) { … }
TEST_F(LensOverlayImageHelperTest, DownscaleAndEncodeBitmapLargeSize) { … }
TEST_F(LensOverlayImageHelperTest, DownscaleAndEncodeBitmapHeightTooLarge) { … }
TEST_F(LensOverlayImageHelperTest, DownscaleAndEncodeBitmapWidthTooLarge) { … }
TEST_F(LensOverlayImageHelperTest, AddSignificantRegions) { … }
TEST_F(LensOverlayImageHelperTest, CropBitmapToRegion) { … }
TEST_F(LensOverlayImageHelperTest,
DownscaleAndEncodeBitmapRegionNonRegionRequest) { … }
TEST_F(LensOverlayImageHelperTest, DownscaleAndEncodeBitmapRegionMaxSize) { … }
TEST_F(LensOverlayImageHelperTest, DownscaleAndEncodeBitmapRegionSmallSize) { … }
TEST_F(LensOverlayImageHelperTest,
DownscaleAndEncodeBitmapRegionLargeFullImageSize) { … }
TEST_F(LensOverlayImageHelperTest,
DownscaleAndEncodeBitmapRegionLargeRegionSize) { … }
TEST_F(LensOverlayImageHelperTest,
DownscaleAndEncodeBitmapRegionWidthTooLarge) { … }
TEST_F(LensOverlayImageHelperTest,
DownscaleAndEncodeBitmapRegionHeightTooLarge) { … }
TEST_F(LensOverlayImageHelperTest,
DownscaleAndEncodeBitmapWithOpaqueRegionBytes) { … }
TEST_F(LensOverlayImageHelperTest,
DownscaleAndEncodeBitmapWithTransparentRegionBytes) { … }
TEST_F(LensOverlayImageHelperTest,
GetCenterRotatedBoxFromTabViewAndImageBounds) { … }
TEST_F(LensOverlayImageHelperTest,
GetCenterRotatedBoxFromTabViewAndImageBoundsClipsWhenImageOutOfView) { … }
TEST_F(LensOverlayImageHelperTest, ExtractVibrantOrDominantColorFromImage) { … }
TEST_F(LensOverlayImageHelperTest, ConvertColorToLab) { … }
TEST_F(LensOverlayImageHelperTest, ColorUtilityFunctions) { … }
TEST_F(LensOverlayImageHelperTest, FindBestMatchedColorOrTransparent) { … }
TEST_F(LensOverlayImageHelperTest, TieredDownscalingTier3) { … }
TEST_F(LensOverlayImageHelperTest, TieredDownscalingTier2) { … }
TEST_F(LensOverlayImageHelperTest, TieredDownscalingTier1) { … }
TEST_F(LensOverlayImageHelperTest, TieredDownscalingNoCompression) { … }
}