Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(967)

Unified Diff: components/doodle/doodle_fetcher_impl_unittest.cc

Issue 2743273002: [Doodle] Don't create invalid DoodleImages or DoodleConfigs (Closed)
Patch Set: add checks for absence of optional images Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/doodle/doodle_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/doodle/doodle_fetcher_impl_unittest.cc
diff --git a/components/doodle/doodle_fetcher_impl_unittest.cc b/components/doodle/doodle_fetcher_impl_unittest.cc
index 939b7b82bd61ac49a38e3a752650bb3e932d07fe..bc67bf7de3d8b6bda623d3d41e298d7cafc9858d 100644
--- a/components/doodle/doodle_fetcher_impl_unittest.cc
+++ b/components/doodle/doodle_fetcher_impl_unittest.cc
@@ -229,6 +229,9 @@ TEST_F(DoodleFetcherImplTest, ResponseContainsValidBaseInformation) {
EXPECT_THAT(config.interactive_html,
Eq("\u003cstyle\u003e\u003c/style\u003e"));
+ EXPECT_FALSE(config.large_cta_image.has_value());
+ EXPECT_FALSE(config.transparent_large_image.has_value());
+
EXPECT_THAT(time_to_live, Eq(base::TimeDelta::FromMilliseconds(55000)));
}
@@ -347,15 +350,6 @@ TEST_F(DoodleFetcherImplTest, ResponseContainsExactlyTheSampleImages) {
ASSERT_TRUE(response.has_value());
DoodleConfig config = response.value();
- EXPECT_TRUE(config.transparent_large_image.url.is_valid());
- EXPECT_THAT(config.transparent_large_image.url.spec(),
- Eq(Resolve("/logos/doodles/2015/new-years-eve-2015-5985438795"
- "8251-thp.png")));
- EXPECT_THAT(config.transparent_large_image.width, Eq(510));
- EXPECT_THAT(config.transparent_large_image.height, Eq(225));
- EXPECT_FALSE(config.transparent_large_image.is_animated_gif);
- EXPECT_FALSE(config.transparent_large_image.is_cta);
-
EXPECT_TRUE(config.large_image.url.is_valid());
EXPECT_THAT(config.large_image.url.spec(),
Eq(Resolve("/logos/doodles/2015/new-years-eve-2015-5985438795"
@@ -365,14 +359,25 @@ TEST_F(DoodleFetcherImplTest, ResponseContainsExactlyTheSampleImages) {
EXPECT_TRUE(config.large_image.is_animated_gif);
EXPECT_FALSE(config.large_image.is_cta);
- EXPECT_TRUE(config.large_cta_image.url.is_valid());
- EXPECT_THAT(config.large_cta_image.url.spec(),
+ ASSERT_TRUE(config.transparent_large_image.has_value());
+ EXPECT_TRUE(config.transparent_large_image->url.is_valid());
+ EXPECT_THAT(config.transparent_large_image->url.spec(),
+ Eq(Resolve("/logos/doodles/2015/new-years-eve-2015-5985438795"
+ "8251-thp.png")));
+ EXPECT_THAT(config.transparent_large_image->width, Eq(510));
+ EXPECT_THAT(config.transparent_large_image->height, Eq(225));
+ EXPECT_FALSE(config.transparent_large_image->is_animated_gif);
+ EXPECT_FALSE(config.transparent_large_image->is_cta);
+
+ ASSERT_TRUE(config.large_cta_image.has_value());
+ EXPECT_TRUE(config.large_cta_image->url.is_valid());
+ EXPECT_THAT(config.large_cta_image->url.spec(),
Eq(Resolve("/logos/doodles/2015/new-years-eve-2015-5985438795"
"8251-cta.gif")));
- EXPECT_THAT(config.large_cta_image.width, Eq(489));
- EXPECT_THAT(config.large_cta_image.height, Eq(225));
- EXPECT_TRUE(config.large_cta_image.is_animated_gif);
- EXPECT_TRUE(config.large_cta_image.is_cta);
+ EXPECT_THAT(config.large_cta_image->width, Eq(489));
+ EXPECT_THAT(config.large_cta_image->height, Eq(225));
+ EXPECT_TRUE(config.large_cta_image->is_animated_gif);
+ EXPECT_TRUE(config.large_cta_image->is_cta);
}
TEST_F(DoodleFetcherImplTest, RespondsToMultipleRequestsWithSameFetcher) {
« no previous file with comments | « no previous file | components/doodle/doodle_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698