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

Unified Diff: components/favicon_base/large_icon_url_parser_unittest.cc

Issue 1318523011: [Password Manager] Copiable username and origin. Linkable origin elided from the left. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Icons appearance fixed Created 5 years, 2 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
Index: components/favicon_base/large_icon_url_parser_unittest.cc
diff --git a/components/favicon_base/large_icon_url_parser_unittest.cc b/components/favicon_base/large_icon_url_parser_unittest.cc
index e6f52ec61f68eb9eb9b8b059748d08c24da8d96b..868583d00f06cbad1c57a5d2a55aa632044e875d 100644
--- a/components/favicon_base/large_icon_url_parser_unittest.cc
+++ b/components/favicon_base/large_icon_url_parser_unittest.cc
@@ -59,3 +59,38 @@ TEST(LargeIconUrlParserTest, ParseLargeIconPathFailure) {
EXPECT_FALSE(parser.Parse(test_cases[i])) << "test_cases[" << i << "]";
}
}
+
+TEST(LargeIconUrlParserTest, ParseLargeIconWithFallbackIconStyle) {
+ // Default style (no parameters).
+ {
+ LargeIconUrlParser parser;
+ EXPECT_TRUE(parser.Parse(std::string("48/") + kTestUrlStr));
+ EXPECT_EQ(parser.fallback_icon_style(), favicon_base::FallbackIconStyle());
+ }
+
+ // Default style (empty parameters).
+ {
+ LargeIconUrlParser parser;
+ EXPECT_TRUE(parser.Parse(std::string("48/fallback/,,,,/") + kTestUrlStr));
+ EXPECT_EQ(parser.fallback_icon_style(), favicon_base::FallbackIconStyle());
+ }
+
+ // Non default specifications.
+ {
+ LargeIconUrlParser parser;
+ EXPECT_TRUE(parser.Parse(std::string("48/fallback/,red,white,0.5,0.4/") +
+ kTestUrlStr));
+ favicon_base::FallbackIconStyle style = parser.fallback_icon_style();
+ EXPECT_EQ(style.background_color, SK_ColorRED);
+ EXPECT_EQ(style.text_color, SK_ColorWHITE);
+ EXPECT_EQ(style.font_size_ratio, 0.5);
+ EXPECT_EQ(style.roundness, 0.4);
+ }
+
+ // Ignore the icon's size in the fallback style.
+ {
+ LargeIconUrlParser parser;
+ EXPECT_TRUE(parser.Parse(std::string("48/fallback/16,,,,/") + kTestUrlStr));
+ EXPECT_EQ(48, parser.size_in_pixels());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698