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/ico/ICOImageDecoder.h" | 5 #include "platform/image-decoders/ico/ICOImageDecoder.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 "wtf/PtrUtil.h" | 9 #include "wtf/PtrUtil.h" |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 std::unique_ptr<ImageDecoder> createDecoder() { | 16 std::unique_ptr<ImageDecoder> createDecoder() { |
17 return wrapUnique( | 17 return wrapUnique(new ICOImageDecoder(ImageDecoder::AlphaNotPremultiplied, |
18 new ICOImageDecoder(ImageDecoder::AlphaNotPremultiplied, | 18 ImageDecoder::ColorSpaceApplied, |
19 ImageDecoder::GammaAndColorProfileApplied, | 19 ImageDecoder::noDecodedImageByteLimit)); |
20 ImageDecoder::noDecodedImageByteLimit)); | |
21 } | 20 } |
22 } | 21 } |
23 | 22 |
24 TEST(ICOImageDecoderTests, parseAndDecodeByteByByte) { | 23 TEST(ICOImageDecoderTests, parseAndDecodeByteByByte) { |
25 testByteByByteDecode(&createDecoder, | 24 testByteByByteDecode(&createDecoder, |
26 "/LayoutTests/fast/images/resources/2entries.ico", 2u, | 25 "/LayoutTests/fast/images/resources/2entries.ico", 2u, |
27 cAnimationNone); | 26 cAnimationNone); |
28 testByteByByteDecode( | 27 testByteByByteDecode( |
29 &createDecoder, "/LayoutTests/fast/images/resources/greenbox-3frames.cur", | 28 &createDecoder, "/LayoutTests/fast/images/resources/greenbox-3frames.cur", |
30 3u, cAnimationNone); | 29 3u, cAnimationNone); |
31 testByteByByteDecode( | 30 testByteByByteDecode( |
32 &createDecoder, | 31 &createDecoder, |
33 "/LayoutTests/fast/images/resources/icon-without-and-bitmap.ico", 1u, | 32 "/LayoutTests/fast/images/resources/icon-without-and-bitmap.ico", 1u, |
34 cAnimationNone); | 33 cAnimationNone); |
35 testByteByByteDecode(&createDecoder, | 34 testByteByByteDecode(&createDecoder, |
36 "/LayoutTests/fast/images/resources/1bit.ico", 1u, | 35 "/LayoutTests/fast/images/resources/1bit.ico", 1u, |
37 cAnimationNone); | 36 cAnimationNone); |
38 testByteByByteDecode(&createDecoder, | 37 testByteByByteDecode(&createDecoder, |
39 "/LayoutTests/fast/images/resources/bug653075.ico", 2u, | 38 "/LayoutTests/fast/images/resources/bug653075.ico", 2u, |
40 cAnimationNone); | 39 cAnimationNone); |
41 } | 40 } |
42 | 41 |
43 } // namespace blink | 42 } // namespace blink |
OLD | NEW |