OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/image-decoders/png/PNGImageDecoder.h" | 5 #include "platform/image-decoders/png/PNGImageDecoder.h" |
6 | 6 |
7 #include "platform/image-decoders/ImageDecoderTestHelpers.h" | 7 #include "platform/image-decoders/ImageDecoderTestHelpers.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 std::unique_ptr<ImageDecoder> createDecoder( | 15 std::unique_ptr<ImageDecoder> createDecoder( |
16 ImageDecoder::AlphaOption alphaOption) { | 16 ImageDecoder::AlphaOption alphaOption) { |
17 return wrapUnique(new PNGImageDecoder( | 17 return WTF::wrapUnique(new PNGImageDecoder( |
18 alphaOption, ColorBehavior::transformToTargetForTesting(), | 18 alphaOption, ColorBehavior::transformToTargetForTesting(), |
19 ImageDecoder::noDecodedImageByteLimit)); | 19 ImageDecoder::noDecodedImageByteLimit)); |
20 } | 20 } |
21 | 21 |
22 std::unique_ptr<ImageDecoder> createDecoder() { | 22 std::unique_ptr<ImageDecoder> createDecoder() { |
23 return createDecoder(ImageDecoder::AlphaNotPremultiplied); | 23 return createDecoder(ImageDecoder::AlphaNotPremultiplied); |
24 } | 24 } |
25 | 25 |
26 std::unique_ptr<ImageDecoder> createDecoderWithPngData(const char* pngFile) { | 26 std::unique_ptr<ImageDecoder> createDecoderWithPngData(const char* pngFile) { |
27 auto decoder = createDecoder(); | 27 auto decoder = createDecoder(); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 auto decoder = | 169 auto decoder = |
170 createDecoderWithPngData("/LayoutTests/images/resources/png-simple.png"); | 170 createDecoderWithPngData("/LayoutTests/images/resources/png-simple.png"); |
171 EXPECT_EQ(1u, decoder->frameCount()); | 171 EXPECT_EQ(1u, decoder->frameCount()); |
172 EXPECT_FALSE(decoder->frameIsCompleteAtIndex(0)); | 172 EXPECT_FALSE(decoder->frameIsCompleteAtIndex(0)); |
173 EXPECT_EQ(ImageFrame::FrameComplete, | 173 EXPECT_EQ(ImageFrame::FrameComplete, |
174 decoder->frameBufferAtIndex(0)->getStatus()); | 174 decoder->frameBufferAtIndex(0)->getStatus()); |
175 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); | 175 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); |
176 } | 176 } |
177 | 177 |
178 }; // namespace blink | 178 }; // namespace blink |
OLD | NEW |