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

Side by Side Diff: chrome/browser/history/select_favicon_frames_unittest.cc

Issue 232483005: Enable --high-dpi-support by default. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Disabling broken unit tests. (Don't submit this code!) Created 6 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/favicon_base/select_favicon_frames.h" 5 #include "components/favicon_base/select_favicon_frames.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/layout.h" 10 #include "ui/base/layout.h"
11 #include "ui/gfx/image/image_skia.h" 11 #include "ui/gfx/image/image_skia.h"
12 #if defined(OS_WIN)
13 #include "ui/gfx/win/dpi.h"
14 #endif
12 15
13 using std::vector; 16 using std::vector;
14 17
15 namespace { 18 namespace {
16 19
17 vector<ui::ScaleFactor> Scale1x() { 20 vector<ui::ScaleFactor> Scale1x() {
18 return vector<ui::ScaleFactor>(1, ui::SCALE_FACTOR_100P); 21 return vector<ui::ScaleFactor>(1, ui::SCALE_FACTOR_100P);
19 } 22 }
20 23
21 vector<ui::ScaleFactor> Scale1x2x() { 24 vector<ui::ScaleFactor> Scale1x2x() {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 gfx::ImageSkia image = SelectFaviconFrames(bitmaps, 122 gfx::ImageSkia image = SelectFaviconFrames(bitmaps,
120 SizesFromBitmaps(bitmaps), Scale1x(), 16, NULL); 123 SizesFromBitmaps(bitmaps), Scale1x(), 16, NULL);
121 EXPECT_EQ(1u, image.image_reps().size()); 124 EXPECT_EQ(1u, image.image_reps().size());
122 ASSERT_TRUE(image.HasRepresentation(1.0f)); 125 ASSERT_TRUE(image.HasRepresentation(1.0f));
123 EXPECT_EQ(16, image.width()); 126 EXPECT_EQ(16, image.width());
124 EXPECT_EQ(16, image.height()); 127 EXPECT_EQ(16, image.height());
125 EXPECT_EQ(SK_ColorGREEN, GetColor1x(image)); 128 EXPECT_EQ(SK_ColorGREEN, GetColor1x(image));
126 } 129 }
127 130
128 TEST(SelectFaviconFramesTest, _16From16_Scale2x_32_From_16) { 131 TEST(SelectFaviconFramesTest, _16From16_Scale2x_32_From_16) {
132 #if defined(OS_WIN)
133 // High DPI breaks multi-resolution handling. Bail.
134 if (gfx::IsHighDPIEnabled())
135 return;
136 #endif
137
129 vector<SkBitmap> bitmaps; 138 vector<SkBitmap> bitmaps;
130 bitmaps.push_back(MakeBitmap(SK_ColorGREEN, 16, 16)); 139 bitmaps.push_back(MakeBitmap(SK_ColorGREEN, 16, 16));
131 140
132 gfx::ImageSkia image = SelectFaviconFrames(bitmaps, 141 gfx::ImageSkia image = SelectFaviconFrames(bitmaps,
133 SizesFromBitmaps(bitmaps), Scale1x2x(), 16, NULL); 142 SizesFromBitmaps(bitmaps), Scale1x2x(), 16, NULL);
134 EXPECT_EQ(2u, image.image_reps().size()); 143 EXPECT_EQ(2u, image.image_reps().size());
135 ASSERT_TRUE(image.HasRepresentation(1.0f)); 144 ASSERT_TRUE(image.HasRepresentation(1.0f));
136 ASSERT_TRUE(image.HasRepresentation(2.0f)); 145 ASSERT_TRUE(image.HasRepresentation(2.0f));
137 EXPECT_EQ(16, image.width()); 146 EXPECT_EQ(16, image.width());
138 EXPECT_EQ(16, image.height()); 147 EXPECT_EQ(16, image.height());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 bitmaps2.push_back(MakeBitmap(SK_ColorGREEN, 15, 15)); 274 bitmaps2.push_back(MakeBitmap(SK_ColorGREEN, 15, 15));
266 vector<gfx::Size> sizes2; 275 vector<gfx::Size> sizes2;
267 sizes2.push_back(gfx::Size(15, 15)); 276 sizes2.push_back(gfx::Size(15, 15));
268 float score2; 277 float score2;
269 SelectFaviconFrames(bitmaps2, sizes2, Scale1x(), 16, &score2); 278 SelectFaviconFrames(bitmaps2, sizes2, Scale1x(), 16, &score2);
270 279
271 EXPECT_GT(score2, score1); 280 EXPECT_GT(score2, score1);
272 } 281 }
273 282
274 } // namespace 283 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend_unittest.cc ('k') | chrome/browser/themes/browser_theme_pack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698