summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2016-02-16 11:40:23 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-16 19:41:59 +0000
commitc876a9212076d63ae1af93d6c1feaf289e3fab09 (patch)
treefb758f56c4b46bdab8e489dc258968dae70edc12 /ui/gfx
parent47a728652bd829f25edff357b5a640f9c78c328f (diff)
downloadchromium_src-c876a9212076d63ae1af93d6c1feaf289e3fab09.zip
chromium_src-c876a9212076d63ae1af93d6c1feaf289e3fab09.tar.gz
chromium_src-c876a9212076d63ae1af93d6c1feaf289e3fab09.tar.bz2
Upstream iOS forks to ui/gfx/ unit tests and test support.
Disable MultiResolutionPNGToPlatform and PNGEncodeFromSkiaDecodeToPlatform tests on iOS as they fail on retina devices. Fix CreatePlatformImage() test utility function to always create a 25x25 pt image independently of the scale factor (and not a 25x25 px image). BUG=153782 Review URL: https://codereview.chromium.org/1699873002 Cr-Commit-Position: refs/heads/master@{#375630}
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/image/image_unittest.cc20
-rw-r--r--ui/gfx/image/image_unittest_util.cc8
2 files changed, 25 insertions, 3 deletions
diff --git a/ui/gfx/image/image_unittest.cc b/ui/gfx/image/image_unittest.cc
index d39adac..641ccfa 100644
--- a/ui/gfx/image/image_unittest.cc
+++ b/ui/gfx/image/image_unittest.cc
@@ -269,7 +269,15 @@ TEST_F(ImageTest, MultiResolutionPNGToImageSkia) {
#endif
}
-TEST_F(ImageTest, MultiResolutionPNGToPlatform) {
+// TODO(crbug.com/153782): disable this test as it fails on iOS retina devices.
+#if defined(OS_IOS)
+#define MAYBE_MultiResolutionPNGToPlatform \
+ DISABLED_MultiResolutionPNGToPlatform
+#else
+#define MAYBE_MultiResolutionPNGToPlatform \
+ MultiResolutionPNGToPlatform
+#endif
+TEST_F(ImageTest, MAYBE_MultiResolutionPNGToPlatform) {
const int kSize1x = 25;
const int kSize2x = 50;
@@ -319,7 +327,15 @@ TEST_F(ImageTest, PlatformToPNGEncodeAndDecode) {
// The platform types use the platform provided encoding/decoding of PNGs. Make
// sure these work with the Skia Encode/Decode.
-TEST_F(ImageTest, PNGEncodeFromSkiaDecodeToPlatform) {
+// TODO(crbug.com/153782): disable this test as it fails on iOS retina devices.
+#if defined(OS_IOS)
+#define MAYBE_PNGEncodeFromSkiaDecodeToPlatform \
+ DISABLED_PNGEncodeFromSkiaDecodeToPlatform
+#else
+#define MAYBE_PNGEncodeFromSkiaDecodeToPlatform \
+ PNGEncodeFromSkiaDecodeToPlatform
+#endif
+TEST_F(ImageTest, MAYBE_PNGEncodeFromSkiaDecodeToPlatform) {
// Force the conversion sequence skia to png to platform_type.
gfx::Image from_bitmap = gfx::Image::CreateFrom1xBitmap(
gt::CreateBitmap(25, 25));
diff --git a/ui/gfx/image/image_unittest_util.cc b/ui/gfx/image/image_unittest_util.cc
index 2e150a8..182826f 100644
--- a/ui/gfx/image/image_unittest_util.cc
+++ b/ui/gfx/image/image_unittest_util.cc
@@ -211,10 +211,16 @@ bool IsEmpty(const gfx::Image& image) {
}
PlatformImage CreatePlatformImage() {
- const SkBitmap bitmap(CreateBitmap(25, 25));
+ SkBitmap bitmap(CreateBitmap(25, 25));
#if defined(OS_IOS)
float scale = ImageSkia::GetMaxSupportedScale();
+ if (scale > 1.0) {
+ // Always create a 25pt x 25pt image.
+ int size = static_cast<int>(25 * scale);
+ bitmap = CreateBitmap(size, size);
+ }
+
base::ScopedCFTypeRef<CGColorSpaceRef> color_space(
CGColorSpaceCreateDeviceRGB());
UIImage* image =