Index: trunk/src/chrome/browser/extensions/extension_action_icon_factory_unittest.cc |
=================================================================== |
--- trunk/src/chrome/browser/extensions/extension_action_icon_factory_unittest.cc (revision 224497) |
+++ trunk/src/chrome/browser/extensions/extension_action_icon_factory_unittest.cc (working copy) |
@@ -38,7 +38,7 @@ |
bool ImageRepsAreEqual(const gfx::ImageSkiaRep& image_rep1, |
const gfx::ImageSkiaRep& image_rep2) { |
- return image_rep1.scale() == image_rep2.scale() && |
+ return image_rep1.scale_factor() == image_rep2.scale_factor() && |
gfx::BitmapsAreEqual(image_rep1.sk_bitmap(), image_rep2.sk_bitmap()); |
} |
@@ -53,14 +53,15 @@ |
return gfx::Image::CreateFrom1xBitmap(resized); |
} |
-gfx::ImageSkiaRep CreateBlankRep(int size_dip, float scale) { |
- SkBitmap bitmap; |
- bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
- static_cast<int>(size_dip * scale), |
- static_cast<int>(size_dip * scale)); |
- bitmap.allocPixels(); |
- bitmap.eraseColor(SkColorSetARGB(0, 0, 0, 0)); |
- return gfx::ImageSkiaRep(bitmap, scale); |
+gfx::ImageSkiaRep CreateBlankRep(int size_dip, ui::ScaleFactor scale_factor) { |
+ SkBitmap bitmap; |
+ const float scale = ui::GetScaleFactorScale(scale_factor); |
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
+ static_cast<int>(size_dip * scale), |
+ static_cast<int>(size_dip * scale)); |
+ bitmap.allocPixels(); |
+ bitmap.eraseColor(SkColorSetARGB(0, 0, 0, 0)); |
+ return gfx::ImageSkiaRep(bitmap, scale_factor); |
} |
gfx::Image LoadIcon(const std::string& filename) { |
@@ -202,8 +203,8 @@ |
gfx::Image icon = icon_factory.GetIcon(0); |
EXPECT_TRUE(ImageRepsAreEqual( |
- favicon.GetRepresentation(1.0f), |
- icon.ToImageSkia()->GetRepresentation(1.0f))); |
+ favicon.GetRepresentation(ui::SCALE_FACTOR_100P), |
+ icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); |
} |
// If the icon has been set using |SetIcon|, the factory should return that |
@@ -233,15 +234,15 @@ |
gfx::Image icon = icon_factory.GetIcon(0); |
EXPECT_TRUE(ImageRepsAreEqual( |
- set_icon.ToImageSkia()->GetRepresentation(1.0f), |
- icon.ToImageSkia()->GetRepresentation(1.0f))); |
+ set_icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P), |
+ icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); |
// It should still return favicon for another tabs. |
icon = icon_factory.GetIcon(1); |
EXPECT_TRUE(ImageRepsAreEqual( |
- GetFavicon().GetRepresentation(1.0f), |
- icon.ToImageSkia()->GetRepresentation(1.0f))); |
+ GetFavicon().GetRepresentation(ui::SCALE_FACTOR_100P), |
+ icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); |
} |
// If there is a default icon, and the icon has not been set using |SetIcon|, |
@@ -276,8 +277,8 @@ |
// The icon should be loaded asynchronously. Initially a transparent icon |
// should be returned. |
EXPECT_TRUE(ImageRepsAreEqual( |
- CreateBlankRep(19, 1.0f), |
- icon.ToImageSkia()->GetRepresentation(1.0f))); |
+ CreateBlankRep(19, ui::SCALE_FACTOR_100P), |
+ icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); |
WaitForIconUpdate(); |
@@ -285,15 +286,15 @@ |
// The default icon representation should be loaded at this point. |
EXPECT_TRUE(ImageRepsAreEqual( |
- default_icon.ToImageSkia()->GetRepresentation(1.0f), |
- icon.ToImageSkia()->GetRepresentation(1.0f))); |
+ default_icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P), |
+ icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); |
// The same icon should be returned for the other tabs. |
icon = icon_factory.GetIcon(1); |
EXPECT_TRUE(ImageRepsAreEqual( |
- default_icon.ToImageSkia()->GetRepresentation(1.0f), |
- icon.ToImageSkia()->GetRepresentation(1.0f))); |
+ default_icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P), |
+ icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); |
} |