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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/manifest/manifest_icon_downloader.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 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 "chrome/browser/manifest/manifest_icon_downloader.h" 5 #include "chrome/browser/manifest/manifest_icon_downloader.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 TEST_F(ManifestIconDownloaderTest, MixedCanReturnMiddle) { 107 TEST_F(ManifestIconDownloaderTest, MixedCanReturnMiddle) {
108 std::vector<SkBitmap> bitmaps; 108 std::vector<SkBitmap> bitmaps;
109 bitmaps.push_back(CreateDummyBitmap(10, 10)); 109 bitmaps.push_back(CreateDummyBitmap(10, 10));
110 bitmaps.push_back(CreateDummyBitmap(8, 8)); 110 bitmaps.push_back(CreateDummyBitmap(8, 8));
111 bitmaps.push_back(CreateDummyBitmap(6, 6)); 111 bitmaps.push_back(CreateDummyBitmap(6, 6));
112 112
113 ASSERT_EQ(1, FindBitmap(7, 0, bitmaps)); 113 ASSERT_EQ(1, FindBitmap(7, 0, bitmaps));
114 } 114 }
115 115
116 TEST_F(ManifestIconDownloaderTest, NonSquareIsIgnored) { 116 TEST_F(ManifestIconDownloaderTest, SquareIsPickedOverNonSquare) {
117 std::vector<SkBitmap> bitmaps; 117 std::vector<SkBitmap> bitmaps;
118 bitmaps.push_back(CreateDummyBitmap(15, 10)); 118 bitmaps.push_back(CreateDummyBitmap(5, 5));
119 bitmaps.push_back(CreateDummyBitmap(10, 15)); 119 bitmaps.push_back(CreateDummyBitmap(10, 15));
120 120
121 ASSERT_EQ(-1, FindBitmap(15, 0, bitmaps)); 121 ASSERT_EQ(0, FindBitmap(15, 5, bitmaps));
122 ASSERT_EQ(-1, FindBitmap(10, 0, bitmaps)); 122 ASSERT_EQ(0, FindBitmap(10, 5, bitmaps));
123 } 123 }
124
125 TEST_F(ManifestIconDownloaderTest, MostSquareNonSquareIsPicked) {
126 std::vector<SkBitmap> bitmaps;
127 bitmaps.push_back(CreateDummyBitmap(25, 35));
128 bitmaps.push_back(CreateDummyBitmap(10, 11));
129
130 ASSERT_EQ(1, FindBitmap(25, 0, bitmaps));
131 ASSERT_EQ(1, FindBitmap(35, 0, bitmaps));
132 }
133
134 TEST_F(ManifestIconDownloaderTest, NonSquareBelowMinimumIsNotPicked) {
135 std::vector<SkBitmap> bitmaps;
136 bitmaps.push_back(CreateDummyBitmap(10, 15));
137 bitmaps.push_back(CreateDummyBitmap(15, 10));
138
139 ASSERT_EQ(-1, FindBitmap(15, 11, bitmaps));
140 }
OLDNEW
« 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