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

Side by Side Diff: ui/gfx/image/image_unittest_util.cc

Issue 10828052: Makes ui::GetSupportedScaleFactors available on platforms other than Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/image/image_unittest_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Because the unit tests for gfx::Image are spread across multiple 5 // Because the unit tests for gfx::Image are spread across multiple
6 // implementation files, this header contains the reusable components. 6 // implementation files, this header contains the reusable components.
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/base/layout.h" 9 #include "ui/base/layout.h"
10 #include "ui/gfx/image/image_unittest_util.h" 10 #include "ui/gfx/image/image_unittest_util.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 13
14 #if defined(TOOLKIT_GTK) 14 #if defined(TOOLKIT_GTK)
15 #include <gtk/gtk.h> 15 #include <gtk/gtk.h>
16 #include "ui/gfx/gtk_util.h" 16 #include "ui/gfx/gtk_util.h"
17 #elif defined(OS_MACOSX) 17 #elif defined(OS_MACOSX)
18 #include "base/mac/mac_util.h" 18 #include "base/mac/mac_util.h"
19 #include "skia/ext/skia_utils_mac.h" 19 #include "skia/ext/skia_utils_mac.h"
20 #endif 20 #endif
21 21
22 namespace gfx { 22 namespace gfx {
23 namespace test { 23 namespace test {
24 24
25 #if defined(OS_MACOSX)
26
27 void SetSupportedScaleFactorsTo1xAnd2x() { 25 void SetSupportedScaleFactorsTo1xAnd2x() {
28 std::vector<ui::ScaleFactor> supported_scale_factors; 26 std::vector<ui::ScaleFactor> supported_scale_factors;
29 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P); 27 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P);
30 supported_scale_factors.push_back(ui::SCALE_FACTOR_200P); 28 supported_scale_factors.push_back(ui::SCALE_FACTOR_200P);
31 ui::test::SetSupportedScaleFactors(supported_scale_factors); 29 ui::test::SetSupportedScaleFactors(supported_scale_factors);
32 } 30 }
33 31
34 #endif // OS_MACOSX
35
36 const SkBitmap CreateBitmap(int width, int height) { 32 const SkBitmap CreateBitmap(int width, int height) {
37 SkBitmap bitmap; 33 SkBitmap bitmap;
38 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); 34 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
39 bitmap.allocPixels(); 35 bitmap.allocPixels();
40 bitmap.eraseRGB(0, 255, 0); 36 bitmap.eraseRGB(0, 255, 0);
41 return bitmap; 37 return bitmap;
42 } 38 }
43 39
44 gfx::Image CreateImage() { 40 gfx::Image CreateImage() {
45 return CreateImage(100, 50); 41 return CreateImage(100, 50);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { 159 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) {
164 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK) 160 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK)
165 return image1 == image2; 161 return image1 == image2;
166 #else 162 #else
167 return image1.getPixels() == image2.getPixels(); 163 return image1.getPixels() == image2.getPixels();
168 #endif 164 #endif
169 } 165 }
170 166
171 } // namespace test 167 } // namespace test
172 } // namespace gfx 168 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/image_unittest_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698