#include "components/media_message_center/media_notification_background_impl.h"
#include <memory>
#include "base/i18n/base_i18n_switches.h"
#include "base/i18n/rtl.h"
#include "base/test/icu_test_util.h"
#include "base/test/scoped_command_line.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/views/test/test_views.h"
#include "ui/views/test/views_test_base.h"
namespace media_message_center {
namespace {
constexpr double kLightLuma = …;
constexpr double kNormalLuma = …;
constexpr double kDarkLuma = …;
constexpr double kMutedSaturation = …;
constexpr double kVibrantSaturation = …;
constexpr int kDefaultForegroundArtworkHeight = …;
SkColor GetColorFromSL(double s, double l) { … }
gfx::ImageSkia CreateTestBackgroundImage(SkColor first_color,
SkColor second_color,
int second_height) { … }
gfx::ImageSkia CreateTestBackgroundImage(SkColor color) { … }
}
class MediaNotificationBackgroundImplTest : public views::ViewsTestBase { … };
TEST_F(MediaNotificationBackgroundImplTest, DeriveBackgroundColor_NoArtwork) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_NoPopularColor) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_PopularNonWhiteBlackColor) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_NoArtworkAfterHavingOne) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_PopularNonWhiteBlackColorFavicon) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_NoFaviconAfterHavingOne) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_FaviconSetThenArtwork) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_ArtworkSetThenFavicon) { … }
TEST_F(MediaNotificationBackgroundImplTest,
DeriveBackgroundColor_SetAndRemoveArtworkWithFavicon) { … }
TEST_F(MediaNotificationBackgroundImplTest, GetBackgroundColorRespectsTheme) { … }
class MediaNotificationBackgroundImplBlackWhiteTest
: public MediaNotificationBackgroundImplTest,
public testing::WithParamInterface<SkColor> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveBackgroundColor_PopularBlackWhiteNoSecondaryColor) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveBackgroundColor_VeryPopularBlackWhite) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveBackgroundColor_NotVeryPopularBlackWhite) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Palette_MultiVibrant) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Palette_Vibrant) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Palette_MultiMuted) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Palette_Muted) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Palette_NotPopular) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_MostPopular) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Palette_MoreVibrant) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Palette_MoreMuted) { … }
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
DeriveForegroundColor_Fallback) { … }
class MediaNotificationBackgroundImplRTLTest
: public MediaNotificationBackgroundImplTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MediaNotificationBackgroundImplRTLTest, BoundsSanityCheck) { … }
}