media_notification_background_impl_unittest.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/media_message_center/media_notification_background_impl.h"
  5. #include <memory>
  6. #include "base/i18n/base_i18n_switches.h"
  7. #include "base/i18n/rtl.h"
  8. #include "base/test/icu_test_util.h"
  9. #include "base/test/scoped_command_line.h"
  10. #include "testing/gtest/include/gtest/gtest.h"
  11. #include "third_party/skia/include/core/SkBitmap.h"
  12. #include "ui/gfx/color_analysis.h"
  13. #include "ui/gfx/color_utils.h"
  14. #include "ui/gfx/geometry/skia_conversions.h"
  15. #include "ui/views/test/test_views.h"
  16. #include "ui/views/test/views_test_base.h"
  17. namespace media_message_center {
  18. namespace {
  19. constexpr double kLightLuma = 0.9;
  20. constexpr double kNormalLuma = 0.5;
  21. constexpr double kDarkLuma = 0.2;
  22. constexpr double kMutedSaturation = 0.2;
  23. constexpr double kVibrantSaturation = 0.8;
  24. constexpr int kDefaultForegroundArtworkHeight = 100;
  25. SkColor GetColorFromSL(double s, double l) {
  26. return color_utils::HSLToSkColor({0.2, s, l}, SK_AlphaOPAQUE);
  27. }
  28. gfx::ImageSkia CreateTestBackgroundImage(SkColor first_color,
  29. SkColor second_color,
  30. int second_height) {
  31. constexpr SkColor kRightHandSideColor = SK_ColorMAGENTA;
  32. DCHECK_NE(kRightHandSideColor, first_color);
  33. DCHECK_NE(kRightHandSideColor, second_color);
  34. SkBitmap bitmap;
  35. bitmap.allocN32Pixels(100, 100);
  36. int first_height = bitmap.height() - second_height;
  37. int right_width = bitmap.width() / 2;
  38. // Fill the right hand side of the image with a constant color. The color
  39. // derivation algorithm does not look at the right hand side so we should
  40. // never see |kRightHandSideColor|.
  41. bitmap.erase(kRightHandSideColor,
  42. {right_width, 0, bitmap.width(), bitmap.height()});
  43. // Fill the left hand side with |first_color|.
  44. bitmap.erase(first_color, {0, 0, right_width, first_height});
  45. // Fill the left hand side with |second_color|.
  46. bitmap.erase(second_color, {0, first_height, right_width, bitmap.height()});
  47. return gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
  48. }
  49. gfx::ImageSkia CreateTestBackgroundImage(SkColor color) {
  50. return CreateTestBackgroundImage(color, SK_ColorTRANSPARENT, 0);
  51. }
  52. } // namespace
  53. class MediaNotificationBackgroundImplTest : public views::ViewsTestBase {
  54. public:
  55. MediaNotificationBackgroundImplTest() = default;
  56. MediaNotificationBackgroundImplTest(
  57. const MediaNotificationBackgroundImplTest&) = delete;
  58. MediaNotificationBackgroundImplTest& operator=(
  59. const MediaNotificationBackgroundImplTest&) = delete;
  60. ~MediaNotificationBackgroundImplTest() override = default;
  61. void SetUp() override {
  62. views::ViewsTestBase::SetUp();
  63. background_ =
  64. std::make_unique<MediaNotificationBackgroundImpl>(10, 10, 0.1);
  65. EXPECT_FALSE(GetBackgroundColor().has_value());
  66. }
  67. void TearDown() override {
  68. background_.reset();
  69. views::ViewsTestBase::TearDown();
  70. }
  71. MediaNotificationBackgroundImpl* background() const {
  72. return background_.get();
  73. }
  74. absl::optional<SkColor> GetBackgroundColor() const {
  75. return background_->background_color_;
  76. }
  77. absl::optional<SkColor> GetForegroundColor() const {
  78. return background_->foreground_color_;
  79. }
  80. double GetBackgroundFaviconColorShadeFactor() const {
  81. return MediaNotificationBackgroundImpl::kBackgroundFaviconColorShadeFactor;
  82. }
  83. private:
  84. std::unique_ptr<MediaNotificationBackgroundImpl> background_;
  85. };
  86. // If we have no artwork then we should use the default background color.
  87. TEST_F(MediaNotificationBackgroundImplTest, DeriveBackgroundColor_NoArtwork) {
  88. background()->UpdateArtwork(gfx::ImageSkia());
  89. EXPECT_FALSE(GetBackgroundColor().has_value());
  90. }
  91. // If we have artwork with no popular color then we should use the default
  92. // background color.
  93. TEST_F(MediaNotificationBackgroundImplTest,
  94. DeriveBackgroundColor_NoPopularColor) {
  95. background()->UpdateArtwork(CreateTestBackgroundImage(SK_ColorTRANSPARENT));
  96. EXPECT_FALSE(GetBackgroundColor().has_value());
  97. }
  98. // If the most popular color is not white or black then we should use that
  99. // color.
  100. TEST_F(MediaNotificationBackgroundImplTest,
  101. DeriveBackgroundColor_PopularNonWhiteBlackColor) {
  102. constexpr SkColor kTestColor = SK_ColorYELLOW;
  103. background()->UpdateArtwork(CreateTestBackgroundImage(kTestColor));
  104. EXPECT_EQ(kTestColor, GetBackgroundColor());
  105. }
  106. TEST_F(MediaNotificationBackgroundImplTest,
  107. DeriveBackgroundColor_NoArtworkAfterHavingOne) {
  108. constexpr SkColor kTestColor = SK_ColorYELLOW;
  109. background()->UpdateArtwork(CreateTestBackgroundImage(kTestColor));
  110. EXPECT_EQ(kTestColor, GetBackgroundColor());
  111. background()->UpdateArtwork(gfx::ImageSkia());
  112. EXPECT_FALSE(GetBackgroundColor().has_value());
  113. }
  114. // Favicons should be used when available but have a shade applying to them.
  115. TEST_F(MediaNotificationBackgroundImplTest,
  116. DeriveBackgroundColor_PopularNonWhiteBlackColorFavicon) {
  117. constexpr SkColor kTestColor = SK_ColorYELLOW;
  118. background()->UpdateFavicon(CreateTestBackgroundImage(kTestColor));
  119. const SkColor expected_color = SkColorSetRGB(
  120. SkColorGetR(kTestColor) * GetBackgroundFaviconColorShadeFactor(),
  121. SkColorGetG(kTestColor) * GetBackgroundFaviconColorShadeFactor(),
  122. SkColorGetB(kTestColor) * GetBackgroundFaviconColorShadeFactor());
  123. EXPECT_EQ(expected_color, GetBackgroundColor());
  124. }
  125. TEST_F(MediaNotificationBackgroundImplTest,
  126. DeriveBackgroundColor_NoFaviconAfterHavingOne) {
  127. constexpr SkColor kTestColor = SK_ColorYELLOW;
  128. background()->UpdateFavicon(CreateTestBackgroundImage(kTestColor));
  129. const SkColor expected_color = SkColorSetRGB(
  130. SkColorGetR(kTestColor) * GetBackgroundFaviconColorShadeFactor(),
  131. SkColorGetG(kTestColor) * GetBackgroundFaviconColorShadeFactor(),
  132. SkColorGetB(kTestColor) * GetBackgroundFaviconColorShadeFactor());
  133. EXPECT_EQ(expected_color, GetBackgroundColor());
  134. background()->UpdateFavicon(gfx::ImageSkia());
  135. EXPECT_FALSE(GetBackgroundColor().has_value());
  136. }
  137. TEST_F(MediaNotificationBackgroundImplTest,
  138. DeriveBackgroundColor_FaviconSetThenArtwork) {
  139. constexpr SkColor kArtworkColor = SK_ColorYELLOW;
  140. constexpr SkColor kFaviconColor = SK_ColorRED;
  141. background()->UpdateFavicon(CreateTestBackgroundImage(kFaviconColor));
  142. background()->UpdateArtwork(CreateTestBackgroundImage(kArtworkColor));
  143. EXPECT_EQ(kArtworkColor, GetBackgroundColor());
  144. }
  145. TEST_F(MediaNotificationBackgroundImplTest,
  146. DeriveBackgroundColor_ArtworkSetThenFavicon) {
  147. constexpr SkColor kArtworkColor = SK_ColorYELLOW;
  148. constexpr SkColor kFaviconColor = SK_ColorRED;
  149. background()->UpdateArtwork(CreateTestBackgroundImage(kArtworkColor));
  150. background()->UpdateFavicon(CreateTestBackgroundImage(kFaviconColor));
  151. EXPECT_EQ(kArtworkColor, GetBackgroundColor());
  152. }
  153. TEST_F(MediaNotificationBackgroundImplTest,
  154. DeriveBackgroundColor_SetAndRemoveArtworkWithFavicon) {
  155. constexpr SkColor kArtworkColor = SK_ColorYELLOW;
  156. constexpr SkColor kFaviconColor = SK_ColorRED;
  157. background()->UpdateArtwork(CreateTestBackgroundImage(kArtworkColor));
  158. background()->UpdateFavicon(CreateTestBackgroundImage(kFaviconColor));
  159. background()->UpdateArtwork(gfx::ImageSkia());
  160. const SkColor expected_color = SkColorSetRGB(
  161. SkColorGetR(kFaviconColor) * GetBackgroundFaviconColorShadeFactor(),
  162. SkColorGetG(kFaviconColor) * GetBackgroundFaviconColorShadeFactor(),
  163. SkColorGetB(kFaviconColor) * GetBackgroundFaviconColorShadeFactor());
  164. EXPECT_EQ(expected_color, GetBackgroundColor());
  165. }
  166. TEST_F(MediaNotificationBackgroundImplTest, GetBackgroundColorRespectsTheme) {
  167. std::unique_ptr<views::Widget> widget = CreateTestWidget();
  168. auto* theme = widget->GetNativeTheme();
  169. theme->set_use_dark_colors(false);
  170. auto* owner = widget->SetContentsView(std::make_unique<views::View>());
  171. SkColor light_background_color = background()->GetBackgroundColor(*owner);
  172. theme->set_use_dark_colors(true);
  173. EXPECT_NE(light_background_color, background()->GetBackgroundColor(*owner));
  174. }
  175. // MediaNotificationBackgroundImplBlackWhiteTest will repeat these tests with a
  176. // parameter that is either black or white.
  177. class MediaNotificationBackgroundImplBlackWhiteTest
  178. : public MediaNotificationBackgroundImplTest,
  179. public testing::WithParamInterface<SkColor> {
  180. public:
  181. bool IsBlack() const { return GetParam() == SK_ColorBLACK; }
  182. gfx::ImageSkia CreateTestForegroundArtwork(const SkColor& first,
  183. const SkColor& second,
  184. int first_width,
  185. int second_height) {
  186. gfx::Rect area(100, 100);
  187. SkBitmap bitmap;
  188. bitmap.allocN32Pixels(area.width(), area.height());
  189. bitmap.eraseColor(GetParam());
  190. area.Inset(gfx::Insets::TLBR(0, 40, 0, 0));
  191. bitmap.erase(first, gfx::RectToSkIRect(area));
  192. area.Inset(
  193. gfx::Insets::TLBR(area.height() - second_height, first_width, 0, 0));
  194. bitmap.erase(second, gfx::RectToSkIRect(area));
  195. return gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
  196. }
  197. };
  198. INSTANTIATE_TEST_SUITE_P(All,
  199. MediaNotificationBackgroundImplBlackWhiteTest,
  200. testing::Values(SK_ColorBLACK, SK_ColorWHITE));
  201. // If the most popular color is black or white but there is no secondary color
  202. // we should use the most popular color.
  203. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  204. DeriveBackgroundColor_PopularBlackWhiteNoSecondaryColor) {
  205. background()->UpdateArtwork(CreateTestBackgroundImage(GetParam()));
  206. EXPECT_EQ(GetParam(), GetBackgroundColor());
  207. }
  208. // If the most popular color is black or white and there is a secondary color
  209. // that is very minor then we should use the most popular color.
  210. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  211. DeriveBackgroundColor_VeryPopularBlackWhite) {
  212. background()->UpdateArtwork(
  213. CreateTestBackgroundImage(GetParam(), SK_ColorYELLOW, 20));
  214. EXPECT_EQ(GetParam(), GetBackgroundColor());
  215. }
  216. // If the most popular color is black or white but it is not that popular then
  217. // we should use the secondary color.
  218. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  219. DeriveBackgroundColor_NotVeryPopularBlackWhite) {
  220. constexpr SkColor kTestColor = SK_ColorYELLOW;
  221. background()->UpdateArtwork(
  222. CreateTestBackgroundImage(GetParam(), kTestColor, 40));
  223. EXPECT_EQ(kTestColor, GetBackgroundColor());
  224. }
  225. // If there are multiple vibrant colors then the foreground color should be the
  226. // most popular one.
  227. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  228. DeriveForegroundColor_Palette_MultiVibrant) {
  229. const SkColor kTestColor = SK_ColorCYAN;
  230. background()->UpdateArtwork(CreateTestForegroundArtwork(
  231. kTestColor, GetColorFromSL(kVibrantSaturation, kDarkLuma), 59,
  232. kDefaultForegroundArtworkHeight));
  233. EXPECT_EQ(GetParam(), GetBackgroundColor());
  234. EXPECT_EQ(kTestColor, GetForegroundColor());
  235. }
  236. // If there is a vibrant and muted color then the foreground color should be the
  237. // more vibrant one.
  238. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  239. DeriveForegroundColor_Palette_Vibrant) {
  240. const SkColor kTestColor = GetColorFromSL(kVibrantSaturation, kNormalLuma);
  241. background()->UpdateArtwork(CreateTestForegroundArtwork(
  242. kTestColor, GetColorFromSL(kMutedSaturation, kNormalLuma), 30,
  243. kDefaultForegroundArtworkHeight));
  244. EXPECT_EQ(GetParam(), GetBackgroundColor());
  245. EXPECT_EQ(kTestColor, GetForegroundColor());
  246. }
  247. // If there are multiple muted colors then the foreground color should be the
  248. // most popular one.
  249. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  250. DeriveForegroundColor_Palette_MultiMuted) {
  251. const SkColor kTestColor = GetColorFromSL(kMutedSaturation, kNormalLuma);
  252. background()->UpdateArtwork(CreateTestForegroundArtwork(
  253. kTestColor, GetColorFromSL(kMutedSaturation, kDarkLuma), 59,
  254. kDefaultForegroundArtworkHeight));
  255. EXPECT_EQ(GetParam(), GetBackgroundColor());
  256. EXPECT_EQ(kTestColor, GetForegroundColor());
  257. }
  258. // If there is a normal and light muted color then the foreground color should
  259. // be the normal one.
  260. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  261. DeriveForegroundColor_Palette_Muted) {
  262. const SkColor kTestColor = GetColorFromSL(kMutedSaturation, kNormalLuma);
  263. const SkColor kSecondColor =
  264. GetColorFromSL(kMutedSaturation, IsBlack() ? kDarkLuma : kLightLuma);
  265. background()->UpdateArtwork(CreateTestForegroundArtwork(
  266. kTestColor, kSecondColor, 30, kDefaultForegroundArtworkHeight));
  267. EXPECT_EQ(GetParam(), GetBackgroundColor());
  268. EXPECT_EQ(kTestColor, GetForegroundColor());
  269. }
  270. // If the best color is not the most popular one, but the most popular one is
  271. // not that popular then we should use the best color.
  272. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  273. DeriveForegroundColor_Palette_NotPopular) {
  274. const SkColor kTestColor = SK_ColorMAGENTA;
  275. background()->UpdateArtwork(CreateTestForegroundArtwork(
  276. kTestColor, GetColorFromSL(kMutedSaturation, kNormalLuma), 25,
  277. kDefaultForegroundArtworkHeight));
  278. EXPECT_EQ(GetParam(), GetBackgroundColor());
  279. EXPECT_EQ(kTestColor, GetForegroundColor());
  280. }
  281. // If we do not have a best color but we have a popular one over a threshold
  282. // then we should use that one.
  283. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  284. DeriveForegroundColor_MostPopular) {
  285. const SkColor kTestColor = GetColorFromSL(kMutedSaturation, kNormalLuma);
  286. background()->UpdateArtwork(CreateTestForegroundArtwork(
  287. kTestColor, GetColorFromSL(kVibrantSaturation, kNormalLuma), 59, 50));
  288. EXPECT_EQ(GetParam(), GetBackgroundColor());
  289. EXPECT_EQ(kTestColor, GetForegroundColor());
  290. }
  291. // If the background color is dark then we should select for a lighter color,
  292. // otherwise we should select for a darker one.
  293. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  294. DeriveForegroundColor_Palette_MoreVibrant) {
  295. const SkColor kTestColor =
  296. GetColorFromSL(kVibrantSaturation, IsBlack() ? kLightLuma : kDarkLuma);
  297. background()->UpdateArtwork(CreateTestForegroundArtwork(
  298. kTestColor, GetColorFromSL(kVibrantSaturation, kNormalLuma), 30,
  299. kDefaultForegroundArtworkHeight));
  300. EXPECT_EQ(GetParam(), GetBackgroundColor());
  301. EXPECT_EQ(kTestColor, GetForegroundColor());
  302. }
  303. // If the background color is dark then we should select for a lighter color,
  304. // otherwise we should select for a darker one.
  305. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  306. DeriveForegroundColor_Palette_MoreMuted) {
  307. const SkColor kTestColor =
  308. GetColorFromSL(kMutedSaturation, IsBlack() ? kLightLuma : kDarkLuma);
  309. const SkColor kSecondColor =
  310. GetColorFromSL(kMutedSaturation, IsBlack() ? kDarkLuma : kLightLuma);
  311. background()->UpdateArtwork(CreateTestForegroundArtwork(
  312. kTestColor, kSecondColor, 30, kDefaultForegroundArtworkHeight));
  313. EXPECT_EQ(GetParam(), GetBackgroundColor());
  314. EXPECT_EQ(kTestColor, GetForegroundColor());
  315. }
  316. // If we do not have any colors then we should use the fallback color based on
  317. // the background color.
  318. TEST_P(MediaNotificationBackgroundImplBlackWhiteTest,
  319. DeriveForegroundColor_Fallback) {
  320. background()->UpdateArtwork(CreateTestForegroundArtwork(
  321. SK_ColorTRANSPARENT, SK_ColorTRANSPARENT, 0, 0));
  322. EXPECT_EQ(GetParam(), GetBackgroundColor());
  323. EXPECT_EQ(GetParam() == SK_ColorBLACK ? SK_ColorWHITE : SK_ColorBLACK,
  324. GetForegroundColor());
  325. }
  326. // MediaNotificationBackgroundImplRTLTest will repeat these tests with RTL
  327. // disabled and enabled.
  328. class MediaNotificationBackgroundImplRTLTest
  329. : public MediaNotificationBackgroundImplTest,
  330. public testing::WithParamInterface<bool> {
  331. public:
  332. void SetUp() override {
  333. command_line_.GetProcessCommandLine()->AppendSwitchASCII(
  334. switches::kForceUIDirection, GetParam() ? switches::kForceDirectionRTL
  335. : switches::kForceDirectionLTR);
  336. MediaNotificationBackgroundImplTest::SetUp();
  337. ASSERT_EQ(IsRTL(), base::i18n::IsRTL());
  338. }
  339. bool IsRTL() const { return GetParam(); }
  340. private:
  341. base::test::ScopedRestoreICUDefaultLocale scoped_locale_;
  342. base::test::ScopedCommandLine command_line_;
  343. };
  344. INSTANTIATE_TEST_SUITE_P(All,
  345. MediaNotificationBackgroundImplRTLTest,
  346. testing::Bool());
  347. TEST_P(MediaNotificationBackgroundImplRTLTest, BoundsSanityCheck) {
  348. // The test notification will have a width of 200 and a height of 50.
  349. gfx::Rect bounds(0, 0, 200, 50);
  350. auto owner = std::make_unique<views::StaticSizedView>();
  351. owner->SetBoundsRect(bounds);
  352. ASSERT_EQ(bounds, owner->GetContentsBounds());
  353. // Check the artwork is not visible by default.
  354. EXPECT_EQ(0, background()->GetArtworkWidth(bounds.size()));
  355. EXPECT_EQ(0, background()->GetArtworkVisibleWidth(bounds.size()));
  356. EXPECT_EQ(gfx::Rect(IsRTL() ? 0 : 200, 0, 0, 50),
  357. background()->GetArtworkBounds(*owner.get()));
  358. EXPECT_EQ(gfx::Rect(IsRTL() ? 0 : 0, 0, 200, 50),
  359. background()->GetFilledBackgroundBounds(*owner.get()));
  360. EXPECT_EQ(gfx::Rect(0, 0, 0, 0),
  361. background()->GetGradientBounds(*owner.get()));
  362. // The background artwork image will have an aspect ratio of 2:1.
  363. SkBitmap bitmap;
  364. bitmap.allocN32Pixels(20, 10);
  365. bitmap.eraseColor(SK_ColorWHITE);
  366. background()->UpdateArtwork(gfx::ImageSkia::CreateFrom1xBitmap(bitmap));
  367. // The artwork width will be 2x the height of the notification and the visible
  368. // width will be limited to 10% the width of the notification.
  369. EXPECT_EQ(100, background()->GetArtworkWidth(bounds.size()));
  370. EXPECT_EQ(20, background()->GetArtworkVisibleWidth(bounds.size()));
  371. // Update the visible width % to be greater than the width of the image.
  372. background()->UpdateArtworkMaxWidthPct(0.6);
  373. EXPECT_EQ(100, background()->GetArtworkVisibleWidth(bounds.size()));
  374. // Check the artwork is positioned to the right.
  375. EXPECT_EQ(gfx::Rect(IsRTL() ? 0 : 100, 0, 100, 50),
  376. background()->GetArtworkBounds(*owner.get()));
  377. // Check the filled background is to the left of the image.
  378. EXPECT_EQ(gfx::Rect(IsRTL() ? 100 : 0, 0, 100, 50),
  379. background()->GetFilledBackgroundBounds(*owner.get()));
  380. // Check the gradient is positioned above the artwork.
  381. const gfx::Rect gradient_bounds =
  382. background()->GetGradientBounds(*owner.get());
  383. EXPECT_EQ(gfx::Rect(IsRTL() ? 60 : 100, 0, 40, 50), gradient_bounds);
  384. // Check the gradient point X-values are the start and end of
  385. // |gradient_bounds|.
  386. EXPECT_EQ(100, background()->GetGradientStartPoint(gradient_bounds).x());
  387. EXPECT_EQ(IsRTL() ? 60 : 140,
  388. background()->GetGradientEndPoint(gradient_bounds).x());
  389. // Check both of the gradient point Y-values are half the height.
  390. EXPECT_EQ(25, background()->GetGradientStartPoint(gradient_bounds).y());
  391. EXPECT_EQ(25, background()->GetGradientEndPoint(gradient_bounds).y());
  392. }
  393. } // namespace media_message_center