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

Unified Diff: chrome/browser/manifest/manifest_icon_downloader_unittest.cc

Issue 1354903003: manifest: allow the icon downloader to choose non-square icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add check for width being greater than ideal Created 5 years, 3 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 | « chrome/browser/manifest/manifest_icon_downloader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/manifest/manifest_icon_downloader_unittest.cc
diff --git a/chrome/browser/manifest/manifest_icon_downloader_unittest.cc b/chrome/browser/manifest/manifest_icon_downloader_unittest.cc
index 624223ee46f54c1b9571fcbd29f6eae72772ea56..a1a08575181b4e16b12788605283589aa7f34552 100644
--- a/chrome/browser/manifest/manifest_icon_downloader_unittest.cc
+++ b/chrome/browser/manifest/manifest_icon_downloader_unittest.cc
@@ -113,11 +113,28 @@ TEST_F(ManifestIconDownloaderTest, MixedCanReturnMiddle) {
ASSERT_EQ(1, FindBitmap(7, 0, bitmaps));
}
-TEST_F(ManifestIconDownloaderTest, NonSquareIsIgnored) {
+TEST_F(ManifestIconDownloaderTest, SquareIsPickedOverNonSquare) {
std::vector<SkBitmap> bitmaps;
- bitmaps.push_back(CreateDummyBitmap(15, 10));
+ bitmaps.push_back(CreateDummyBitmap(5, 5));
bitmaps.push_back(CreateDummyBitmap(10, 15));
- ASSERT_EQ(-1, FindBitmap(15, 0, bitmaps));
- ASSERT_EQ(-1, FindBitmap(10, 0, bitmaps));
+ ASSERT_EQ(0, FindBitmap(15, 5, bitmaps));
+ ASSERT_EQ(0, FindBitmap(10, 5, bitmaps));
+}
+
+TEST_F(ManifestIconDownloaderTest, MostSquareNonSquareIsPicked) {
+ std::vector<SkBitmap> bitmaps;
+ bitmaps.push_back(CreateDummyBitmap(25, 35));
+ bitmaps.push_back(CreateDummyBitmap(10, 11));
+
+ ASSERT_EQ(1, FindBitmap(25, 0, bitmaps));
+ ASSERT_EQ(1, FindBitmap(35, 0, bitmaps));
+}
+
+TEST_F(ManifestIconDownloaderTest, NonSquareBelowMinimumIsNotPicked) {
+ std::vector<SkBitmap> bitmaps;
+ bitmaps.push_back(CreateDummyBitmap(10, 15));
+ bitmaps.push_back(CreateDummyBitmap(15, 10));
+
+ ASSERT_EQ(-1, FindBitmap(15, 11, bitmaps));
}
« no previous file with comments | « chrome/browser/manifest/manifest_icon_downloader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698