chromium/components/media_message_center/media_notification_background_impl_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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) {}

}  // namespace

class MediaNotificationBackgroundImplTest : public views::ViewsTestBase {};

// If we have no artwork then we should use the default background color.
TEST_F(MediaNotificationBackgroundImplTest, DeriveBackgroundColor_NoArtwork) {}

// If we have artwork with no popular color then we should use the default
// background color.
TEST_F(MediaNotificationBackgroundImplTest,
       DeriveBackgroundColor_NoPopularColor) {}

// If the most popular color is not white or black then we should use that
// color.
TEST_F(MediaNotificationBackgroundImplTest,
       DeriveBackgroundColor_PopularNonWhiteBlackColor) {}

TEST_F(MediaNotificationBackgroundImplTest,
       DeriveBackgroundColor_NoArtworkAfterHavingOne) {}

// Favicons should be used when available but have a shade applying to them.
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) {}

// MediaNotificationBackgroundImplBlackWhiteTest will repeat these tests with a
// parameter that is either black or white.
class MediaNotificationBackgroundImplBlackWhiteTest
    : public MediaNotificationBackgroundImplTest,
      public testing::WithParamInterface<SkColor> {};

INSTANTIATE_TEST_SUITE_P();

// If the most popular color is black or white but there is no secondary color
// we should use the most popular color.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveBackgroundColor_PopularBlackWhiteNoSecondaryColor) {}

// If the most popular color is black or white and there is a secondary color
// that is very minor then we should use the most popular color.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveBackgroundColor_VeryPopularBlackWhite) {}

// If the most popular color is black or white but it is not that popular then
// we should use the secondary color.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveBackgroundColor_NotVeryPopularBlackWhite) {}

// If there are multiple vibrant colors then the foreground color should be the
// most popular one.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Palette_MultiVibrant) {}

// If there is a vibrant and muted color then the foreground color should be the
// more vibrant one.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Palette_Vibrant) {}

// If there are multiple muted colors then the foreground color should be the
// most popular one.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Palette_MultiMuted) {}

// If there is a normal and light muted color then the foreground color should
// be the normal one.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Palette_Muted) {}

// If the best color is not the most popular one, but the most popular one is
// not that popular then we should use the best color.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Palette_NotPopular) {}

// If we do not have a best color but we have a popular one over a threshold
// then we should use that one.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_MostPopular) {}

// If the background color is dark then we should select for a lighter color,
// otherwise we should select for a darker one.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Palette_MoreVibrant) {}

// If the background color is dark then we should select for a lighter color,
// otherwise we should select for a darker one.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Palette_MoreMuted) {}

// If we do not have any colors then we should use the fallback color based on
// the background color.
TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
       DeriveForegroundColor_Fallback) {}

// MediaNotificationBackgroundImplRTLTest will repeat these tests with RTL
// disabled and enabled.
class MediaNotificationBackgroundImplRTLTest
    : public MediaNotificationBackgroundImplTest,
      public testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(MediaNotificationBackgroundImplRTLTest, BoundsSanityCheck) {}

}  // namespace media_message_center