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

Unified Diff: trunk/src/chrome/browser/themes/browser_theme_pack_unittest.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/themes/browser_theme_pack_unittest.cc
===================================================================
--- trunk/src/chrome/browser/themes/browser_theme_pack_unittest.cc (revision 224498)
+++ trunk/src/chrome/browser/themes/browser_theme_pack_unittest.cc (working copy)
@@ -36,13 +36,8 @@
BrowserThemePackTest()
: message_loop(),
fake_ui_thread(BrowserThread::UI, &message_loop),
- fake_file_thread(BrowserThread::FILE, &message_loop) {
- std::vector<ui::ScaleFactor> scale_factors;
- scale_factors.push_back(ui::SCALE_FACTOR_100P);
- scale_factors.push_back(ui::SCALE_FACTOR_200P);
- scoped_set_supported_scale_factors_.reset(
- new ui::test::ScopedSetSupportedScaleFactors(scale_factors));
- theme_pack_ = new BrowserThemePack();
+ fake_file_thread(BrowserThread::FILE, &message_loop),
+ theme_pack_(new BrowserThemePack) {
}
// Transformation for link underline colors.
@@ -275,7 +270,8 @@
const gfx::ImageSkia* image_skia = image.ToImageSkia();
ASSERT_TRUE(image_skia);
// Scale 100%.
- const gfx::ImageSkiaRep& rep1 = image_skia->GetRepresentation(1.0f);
+ const gfx::ImageSkiaRep& rep1 = image_skia->GetRepresentation(
+ ui::SCALE_FACTOR_100P);
ASSERT_FALSE(rep1.is_null());
EXPECT_EQ(80, rep1.sk_bitmap().width());
EXPECT_EQ(80, rep1.sk_bitmap().height());
@@ -287,7 +283,8 @@
EXPECT_EQ(SkColorSetRGB( 0, 241, 237), rep1.sk_bitmap().getColor(32, 32));
rep1.sk_bitmap().unlockPixels();
// Scale 200%.
- const gfx::ImageSkiaRep& rep2 = image_skia->GetRepresentation(2.0f);
+ const gfx::ImageSkiaRep& rep2 = image_skia->GetRepresentation(
+ ui::SCALE_FACTOR_200P);
ASSERT_FALSE(rep2.is_null());
EXPECT_EQ(160, rep2.sk_bitmap().width());
EXPECT_EQ(160, rep2.sk_bitmap().height());
@@ -315,7 +312,8 @@
image_skia = image.ToImageSkia();
ASSERT_TRUE(image_skia);
// Scale 100%.
- const gfx::ImageSkiaRep& rep3 = image_skia->GetRepresentation(1.0f);
+ const gfx::ImageSkiaRep& rep3 = image_skia->GetRepresentation(
+ ui::SCALE_FACTOR_100P);
ASSERT_FALSE(rep3.is_null());
EXPECT_EQ(80, rep3.sk_bitmap().width());
EXPECT_EQ(80, rep3.sk_bitmap().height());
@@ -337,7 +335,8 @@
EXPECT_EQ(static_cast<size_t>(9), normal.size());
rep3.sk_bitmap().unlockPixels();
// Scale 200%.
- const gfx::ImageSkiaRep& rep4 = image_skia->GetRepresentation(2.0f);
+ const gfx::ImageSkiaRep& rep4 = image_skia->GetRepresentation(
+ ui::SCALE_FACTOR_200P);
ASSERT_FALSE(rep4.is_null());
EXPECT_EQ(160, rep4.sk_bitmap().width());
EXPECT_EQ(160, rep4.sk_bitmap().height());
@@ -356,9 +355,6 @@
content::TestBrowserThread fake_ui_thread;
content::TestBrowserThread fake_file_thread;
- typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors>
- ScopedSetSupportedScaleFactors;
- ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_;
scoped_refptr<BrowserThemePack> theme_pack_;
};
@@ -588,6 +584,10 @@
}
TEST_F(BrowserThemePackTest, HiDpiThemeTest) {
+ std::vector<ui::ScaleFactor> scale_factors;
+ scale_factors.push_back(ui::SCALE_FACTOR_100P);
+ scale_factors.push_back(ui::SCALE_FACTOR_200P);
+ ui::test::ScopedSetSupportedScaleFactors test_scale_factors(scale_factors);
base::ScopedTempDir dir;
ASSERT_TRUE(dir.CreateUniqueTempDir());
base::FilePath file = dir.path().AppendASCII("theme_data.pak");

Powered by Google App Engine
This is Rietveld 408576698