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

Unified Diff: trunk/src/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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
Index: trunk/src/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
===================================================================
--- trunk/src/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc (revision 224497)
+++ trunk/src/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc (working copy)
@@ -59,9 +59,9 @@
bool ImagesAreEqualAtScale(const gfx::ImageSkia& i1,
const gfx::ImageSkia& i2,
- float scale) {
- SkBitmap bitmap1 = i1.GetRepresentation(scale).sk_bitmap();
- SkBitmap bitmap2 = i2.GetRepresentation(scale).sk_bitmap();
+ ui::ScaleFactor scale_factor) {
+ SkBitmap bitmap1 = i1.GetRepresentation(scale_factor).sk_bitmap();
+ SkBitmap bitmap2 = i2.GetRepresentation(scale_factor).sk_bitmap();
return gfx::BitmapsAreEqual(bitmap1, bitmap2);
}
@@ -136,7 +136,7 @@
std::vector<ui::ScaleFactor> supported_scale_factors;
supported_scale_factors.push_back(ui::SCALE_FACTOR_100P);
supported_scale_factors.push_back(ui::SCALE_FACTOR_200P);
- ui::SetSupportedScaleFactors(supported_scale_factors);
+ ui::test::SetSupportedScaleFactors(supported_scale_factors);
#endif
// We should not be creating icons asynchronously, so we don't need an
@@ -171,12 +171,13 @@
EXPECT_GT(action_icon_current_id, action_icon_last_id);
action_icon_last_id = action_icon_current_id;
- EXPECT_FALSE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
+ EXPECT_FALSE(
+ action_icon.ToImageSkia()->HasRepresentation(ui::SCALE_FACTOR_200P));
EXPECT_TRUE(ImagesAreEqualAtScale(
AddBackgroundForViews(*action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 1.0f));
+ ui::SCALE_FACTOR_100P));
// Tell the extension to update the icon using path.
GetBrowserActionsBar().Press(0);
@@ -189,12 +190,12 @@
action_icon_last_id = action_icon_current_id;
EXPECT_FALSE(
- action_icon.ToImageSkia()->HasRepresentation(2.0f));
+ action_icon.ToImageSkia()->HasRepresentation(ui::SCALE_FACTOR_200P));
EXPECT_TRUE(ImagesAreEqualAtScale(
AddBackgroundForViews(*action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 1.0f));
+ ui::SCALE_FACTOR_100P));
// Tell the extension to update the icon using dictionary of ImageData
// objects.
@@ -207,12 +208,13 @@
EXPECT_GT(action_icon_current_id, action_icon_last_id);
action_icon_last_id = action_icon_current_id;
- EXPECT_TRUE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
+ EXPECT_TRUE(
+ action_icon.ToImageSkia()->HasRepresentation(ui::SCALE_FACTOR_200P));
EXPECT_TRUE(ImagesAreEqualAtScale(
AddBackgroundForViews(*action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 1.0f));
+ ui::SCALE_FACTOR_100P));
// Tell the extension to update the icon using dictionary of paths.
GetBrowserActionsBar().Press(0);
@@ -224,12 +226,13 @@
EXPECT_GT(action_icon_current_id, action_icon_last_id);
action_icon_last_id = action_icon_current_id;
- EXPECT_TRUE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
+ EXPECT_TRUE(
+ action_icon.ToImageSkia()->HasRepresentation(ui::SCALE_FACTOR_200P));
EXPECT_TRUE(ImagesAreEqualAtScale(
AddBackgroundForViews(*action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 1.0f));
+ ui::SCALE_FACTOR_100P));
// Tell the extension to update the icon using dictionary of ImageData
// objects, but setting only size 19.
@@ -242,12 +245,13 @@
EXPECT_GT(action_icon_current_id, action_icon_last_id);
action_icon_last_id = action_icon_current_id;
- EXPECT_FALSE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
+ EXPECT_FALSE(
+ action_icon.ToImageSkia()->HasRepresentation(ui::SCALE_FACTOR_200P));
EXPECT_TRUE(ImagesAreEqualAtScale(
AddBackgroundForViews(*action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 1.0f));
+ ui::SCALE_FACTOR_100P));
// Tell the extension to update the icon using dictionary of paths, but
// setting only size 19.
@@ -260,12 +264,13 @@
EXPECT_GT(action_icon_current_id, action_icon_last_id);
action_icon_last_id = action_icon_current_id;
- EXPECT_FALSE(action_icon.ToImageSkia()->HasRepresentation(2.0f));
+ EXPECT_FALSE(
+ action_icon.ToImageSkia()->HasRepresentation(ui::SCALE_FACTOR_200P));
EXPECT_TRUE(ImagesAreEqualAtScale(
AddBackgroundForViews(*action_icon.ToImageSkia()),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 1.0f));
+ ui::SCALE_FACTOR_100P));
// Tell the extension to update the icon using dictionary of ImageData
// objects, but setting only size 38.
@@ -276,8 +281,8 @@
const gfx::ImageSkia* action_icon_skia = action_icon.ToImageSkia();
- EXPECT_FALSE(action_icon_skia->HasRepresentation(1.0f));
- EXPECT_TRUE(action_icon_skia->HasRepresentation(2.0f));
+ EXPECT_FALSE(action_icon_skia->HasRepresentation(ui::SCALE_FACTOR_100P));
+ EXPECT_TRUE(action_icon_skia->HasRepresentation(ui::SCALE_FACTOR_200P));
action_icon_current_id = action_icon.ToSkBitmap()->getGenerationID();
EXPECT_GT(action_icon_current_id, action_icon_last_id);
@@ -285,12 +290,12 @@
EXPECT_TRUE(gfx::BitmapsAreEqual(
*action_icon.ToSkBitmap(),
- action_icon_skia->GetRepresentation(2.0f).sk_bitmap()));
+ action_icon_skia->GetRepresentation(ui::SCALE_FACTOR_200P).sk_bitmap()));
EXPECT_TRUE(ImagesAreEqualAtScale(
AddBackgroundForViews(*action_icon_skia),
*GetBrowserActionsBar().GetIcon(0).ToImageSkia(),
- 2.0f));
+ ui::SCALE_FACTOR_200P));
// Try setting icon with empty dictionary of ImageData objects.
GetBrowserActionsBar().Press(0);

Powered by Google App Engine
This is Rietveld 408576698