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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/favicon_base/large_icon_url_parser.h" 5 #include "components/favicon_base/large_icon_url_parser.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 "/http://www.google.com/", // Missing size. 52 "/http://www.google.com/", // Missing size.
53 "not_a_number/http://www.google.com/", // Bad size. 53 "not_a_number/http://www.google.com/", // Bad size.
54 "0/http://www.google.com/", // Non-positive size. 54 "0/http://www.google.com/", // Non-positive size.
55 "-1/http://www.google.com/", // Non-positive size. 55 "-1/http://www.google.com/", // Non-positive size.
56 }; 56 };
57 for (size_t i = 0; i < arraysize(test_cases); ++i) { 57 for (size_t i = 0; i < arraysize(test_cases); ++i) {
58 LargeIconUrlParser parser; 58 LargeIconUrlParser parser;
59 EXPECT_FALSE(parser.Parse(test_cases[i])) << "test_cases[" << i << "]"; 59 EXPECT_FALSE(parser.Parse(test_cases[i])) << "test_cases[" << i << "]";
60 } 60 }
61 } 61 }
62
63 TEST(LargeIconUrlParserTest, ParseLargeIconWithFallbackIconStyle) {
64 // Default style (no parameters).
65 {
66 LargeIconUrlParser parser;
67 EXPECT_TRUE(parser.Parse(std::string("48/") + kTestUrlStr));
68 EXPECT_EQ(parser.fallback_icon_style(), favicon_base::FallbackIconStyle());
69 }
70
71 // Default style (empty parameters).
72 {
73 LargeIconUrlParser parser;
74 EXPECT_TRUE(parser.Parse(std::string("48/fallback/,,,,/") + kTestUrlStr));
75 EXPECT_EQ(parser.fallback_icon_style(), favicon_base::FallbackIconStyle());
76 }
77
78 // Non default specifications.
79 {
80 LargeIconUrlParser parser;
81 EXPECT_TRUE(parser.Parse(std::string("48/fallback/,red,white,0.5,0.4/") +
82 kTestUrlStr));
83 favicon_base::FallbackIconStyle style = parser.fallback_icon_style();
84 EXPECT_EQ(style.background_color, SK_ColorRED);
85 EXPECT_EQ(style.text_color, SK_ColorWHITE);
86 EXPECT_EQ(style.font_size_ratio, 0.5);
87 EXPECT_EQ(style.roundness, 0.4);
88 }
89
90 // Ignore the icon's size in the fallback style.
91 {
92 LargeIconUrlParser parser;
93 EXPECT_TRUE(parser.Parse(std::string("48/fallback/16,,,,/") + kTestUrlStr));
94 EXPECT_EQ(48, parser.size_in_pixels());
95 }
96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698