diff options
author | gpdavis.chromium@gmail.com <gpdavis.chromium@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-19 17:42:31 +0000 |
---|---|---|
committer | gpdavis.chromium@gmail.com <gpdavis.chromium@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-19 17:43:31 +0000 |
commit | 9cfffade2b96158d0071efe3ee812a5863d07660 (patch) | |
tree | 2949bc86711c12c487bed01f327c2a0b447ea512 /extensions | |
parent | 8b38bcfe379ceebb9a8dafa920b61767af7e9d75 (diff) | |
download | chromium_src-9cfffade2b96158d0071efe3ee812a5863d07660.zip chromium_src-9cfffade2b96158d0071efe3ee812a5863d07660.tar.gz chromium_src-9cfffade2b96158d0071efe3ee812a5863d07660.tar.bz2 |
Fix issue with action icons not downscaling
BUG=404203
Review URL: https://codereview.chromium.org/475993002
Cr-Commit-Position: refs/heads/master@{#290605}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/browser/extension_icon_image.cc | 11 | ||||
-rw-r--r-- | extensions/browser/extension_icon_image_unittest.cc | 13 |
2 files changed, 10 insertions, 14 deletions
diff --git a/extensions/browser/extension_icon_image.cc b/extensions/browser/extension_icon_image.cc index a70924d..14ba290 100644 --- a/extensions/browser/extension_icon_image.cc +++ b/extensions/browser/extension_icon_image.cc @@ -40,8 +40,6 @@ namespace { -const int kMatchBiggerTreshold = 32; - extensions::ExtensionResource GetExtensionIconResource( const extensions::Extension* extension, const ExtensionIconSet& icons, @@ -169,11 +167,10 @@ gfx::ImageSkiaRep IconImage::LoadImageForScaleFactor( extensions::ExtensionResource resource; // Find extension resource for non bundled component extensions. - // We try loading bigger image only if resource size is >= 32. - if (resource_size_in_pixel >= kMatchBiggerTreshold) { - resource = GetExtensionIconResource(extension_, icon_set_, - resource_size_in_pixel, ExtensionIconSet::MATCH_BIGGER); - } + resource = GetExtensionIconResource(extension_, + icon_set_, + resource_size_in_pixel, + ExtensionIconSet::MATCH_BIGGER); // If resource is not found by now, try matching smaller one. if (resource.empty()) { diff --git a/extensions/browser/extension_icon_image_unittest.cc b/extensions/browser/extension_icon_image_unittest.cc index ead9dc0..57b5c47 100644 --- a/extensions/browser/extension_icon_image_unittest.cc +++ b/extensions/browser/extension_icon_image_unittest.cc @@ -318,9 +318,8 @@ TEST_F(ExtensionIconImageTest, FallbackToSmallerWhenNoBigger) { } // There is no resource with exact size, but there is a smaller and a bigger -// one. Requested size is smaller than 32 though, so the smaller resource should -// be loaded. -TEST_F(ExtensionIconImageTest, FallbackToSmaller) { +// one. The bigger resource should be loaded. +TEST_F(ExtensionIconImageTest, FallbackToBigger) { scoped_ptr<content::BrowserContext> profile(new TestingProfile()); scoped_refptr<Extension> extension(CreateExtension( "extension_icon_image", Manifest::INVALID_LOCATION)); @@ -330,8 +329,8 @@ TEST_F(ExtensionIconImageTest, FallbackToSmaller) { // Load images we expect to find as representations in icon_image, so we // can later use them to validate icon_image. - SkBitmap bitmap_16 = GetTestBitmap(extension.get(), "16.png", 16); - ASSERT_FALSE(bitmap_16.empty()); + SkBitmap bitmap_24 = GetTestBitmap(extension.get(), "24.png", 24); + ASSERT_FALSE(bitmap_24.empty()); IconImage image(profile.get(), extension.get(), @@ -348,11 +347,11 @@ TEST_F(ExtensionIconImageTest, FallbackToSmaller) { representation = image.image_skia().GetRepresentation(1.0f); - // We should have loaded smaller (resized) resource. + // We should have loaded the smallest bigger (resized) resource. EXPECT_EQ(1.0f, representation.scale()); EXPECT_EQ(17, representation.pixel_width()); EXPECT_TRUE(gfx::BitmapsAreEqual(representation.sk_bitmap(), - EnsureBitmapSize(bitmap_16, 17))); + EnsureBitmapSize(bitmap_24, 17))); } // If resource set is empty, |GetRepresentation| should synchronously return |