OLD | NEW |
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 <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 for (int i = 0; i < width * height * 3; ++i) | 71 for (int i = 0; i < width * height * 3; ++i) |
72 image_rep_data[i] = 255; | 72 image_rep_data[i] = 255; |
73 } | 73 } |
74 | 74 |
75 class ImageMacTest : public testing::Test { | 75 class ImageMacTest : public testing::Test { |
76 public: | 76 public: |
77 ImageMacTest() | 77 ImageMacTest() |
78 : supported_scale_factors_(gfx::test::Get1xAnd2xScaleFactors()) { | 78 : supported_scale_factors_(gfx::test::Get1xAnd2xScaleFactors()) { |
79 } | 79 } |
80 | 80 |
81 ~ImageMacTest() { | 81 virtual ~ImageMacTest() { |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 ui::test::ScopedSetSupportedScaleFactors supported_scale_factors_; | 85 ui::test::ScopedSetSupportedScaleFactors supported_scale_factors_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(ImageMacTest); | 87 DISALLOW_COPY_AND_ASSIGN(ImageMacTest); |
88 }; | 88 }; |
89 | 89 |
90 namespace gt = gfx::test; | 90 namespace gt = gfx::test; |
91 | 91 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 // Convert to ImageSkia to check pixel contents of NSImageReps. | 205 // Convert to ImageSkia to check pixel contents of NSImageReps. |
206 gfx::ImageSkia image_skia = gfx::ImageSkiaFromNSImage(ns_image); | 206 gfx::ImageSkia image_skia = gfx::ImageSkiaFromNSImage(ns_image); |
207 EXPECT_TRUE(gt::IsEqual(bytes1x, | 207 EXPECT_TRUE(gt::IsEqual(bytes1x, |
208 image_skia.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap())); | 208 image_skia.GetRepresentation(ui::SCALE_FACTOR_100P).sk_bitmap())); |
209 EXPECT_TRUE(gt::IsEqual(bytes2x, | 209 EXPECT_TRUE(gt::IsEqual(bytes2x, |
210 image_skia.GetRepresentation(ui::SCALE_FACTOR_200P).sk_bitmap())); | 210 image_skia.GetRepresentation(ui::SCALE_FACTOR_200P).sk_bitmap())); |
211 } | 211 } |
212 | 212 |
213 } // namespace | 213 } // namespace |
OLD | NEW |