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

Side by Side Diff: components/favicon/core/favicon_handler_unittest.cc

Issue 2986033002: Revert of Always prefer 192x192 on mobile, also for touch icons (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « components/favicon/core/favicon_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/core/favicon_handler.h" 5 #include "components/favicon/core/favicon_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 1203
1204 EXPECT_THAT( 1204 EXPECT_THAT(
1205 handler->GetIconURLs(), 1205 handler->GetIconURLs(),
1206 ElementsAre( 1206 ElementsAre(
1207 // The 512x512 bitmap is the best match for the desired size. 1207 // The 512x512 bitmap is the best match for the desired size.
1208 kIconURL1024_512, kIconURL1_17, kIconURL16_14, 1208 kIconURL1024_512, kIconURL1_17, kIconURL16_14,
1209 // The rest of bitmaps come in order, there is no "sizes" attribute. 1209 // The rest of bitmaps come in order, there is no "sizes" attribute.
1210 kIconURLWithoutSize1, kIconURLWithoutSize2)); 1210 kIconURLWithoutSize1, kIconURLWithoutSize2));
1211 } 1211 }
1212 1212
1213 TEST_F(FaviconHandlerTest, TestSortTouchIconLargest) {
1214 const GURL kIconURLWithoutSize("http://www.google.com/touchicon-nosize");
1215 const GURL kIconURL144x144("http://www.google.com/touchicon144x144");
1216 const GURL kIconURL192x192("http://www.google.com/touchicon192x192");
1217
1218 const std::vector<favicon::FaviconURL> kSourceIconURLs{
1219 FaviconURL(kIconURLWithoutSize, TOUCH_ICON, kEmptySizes),
1220 FaviconURL(kIconURL144x144, TOUCH_ICON,
1221 SizeVector(1U, gfx::Size(144, 144))),
1222 FaviconURL(kIconURL192x192, TOUCH_ICON,
1223 SizeVector(1U, gfx::Size(192, 192))),
1224 };
1225
1226 std::unique_ptr<FaviconHandler> handler = RunHandlerWithCandidates(
1227 FaviconDriverObserver::TOUCH_LARGEST, kSourceIconURLs);
1228
1229 EXPECT_THAT(
1230 handler->GetIconURLs(),
1231 ElementsAre(kIconURL192x192, kIconURL144x144, kIconURLWithoutSize));
1232 }
1233
1234 TEST_F(FaviconHandlerTest, TestDownloadLargestFavicon) { 1213 TEST_F(FaviconHandlerTest, TestDownloadLargestFavicon) {
1235 // Names represent the bitmap sizes per icon. 1214 // Names represent the bitmap sizes per icon.
1236 const GURL kIconURL1024_512("http://www.google.com/a"); 1215 const GURL kIconURL1024_512("http://www.google.com/a");
1237 const GURL kIconURL15_14("http://www.google.com/b"); 1216 const GURL kIconURL15_14("http://www.google.com/b");
1238 const GURL kIconURL16_512("http://www.google.com/c"); 1217 const GURL kIconURL16_512("http://www.google.com/c");
1239 const GURL kIconURLWithoutSize1("http://www.google.com/d"); 1218 const GURL kIconURLWithoutSize1("http://www.google.com/d");
1240 const GURL kIconURLWithoutSize2("http://www.google.com/e"); 1219 const GURL kIconURLWithoutSize2("http://www.google.com/e");
1241 1220
1242 RunHandlerWithCandidates( 1221 RunHandlerWithCandidates(
1243 FaviconDriverObserver::NON_TOUCH_LARGEST, 1222 FaviconDriverObserver::NON_TOUCH_LARGEST,
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 1989
2011 // Complete the download. 1990 // Complete the download.
2012 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL2, _, _)); 1991 EXPECT_CALL(favicon_service_, SetFavicons(_, kManifestURL2, _, _));
2013 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL2, _, _)); 1992 EXPECT_CALL(delegate_, OnFaviconUpdated(_, _, kManifestURL2, _, _));
2014 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually()); 1993 EXPECT_TRUE(delegate_.fake_image_downloader().RunCallbackManually());
2015 base::RunLoop().RunUntilIdle(); 1994 base::RunLoop().RunUntilIdle();
2016 } 1995 }
2017 1996
2018 } // namespace 1997 } // namespace
2019 } // namespace favicon 1998 } // namespace favicon
OLDNEW
« no previous file with comments | « components/favicon/core/favicon_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698