OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bmp/BMPImageDecoder.h" | 5 #include "platform/image-decoders/bmp/BMPImageDecoder.h" |
6 | 6 |
7 #include "platform/SharedBuffer.h" | 7 #include "platform/SharedBuffer.h" |
8 #include "platform/image-decoders/ImageDecoderTestHelpers.h" | 8 #include "platform/image-decoders/ImageDecoderTestHelpers.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "wtf/PtrUtil.h" | 10 #include "wtf/PtrUtil.h" |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 std::unique_ptr<ImageDecoder> createDecoder() { | 17 std::unique_ptr<ImageDecoder> createDecoder() { |
18 return wrapUnique( | 18 return wrapUnique(new BMPImageDecoder(ImageDecoder::AlphaNotPremultiplied, |
19 new BMPImageDecoder(ImageDecoder::AlphaNotPremultiplied, | 19 ImageDecoder::ColorSpaceApplied, |
20 ImageDecoder::GammaAndColorProfileApplied, | 20 ImageDecoder::noDecodedImageByteLimit)); |
21 ImageDecoder::noDecodedImageByteLimit)); | |
22 } | 21 } |
23 | 22 |
24 } // anonymous namespace | 23 } // anonymous namespace |
25 | 24 |
26 TEST(BMPImageDecoderTest, isSizeAvailable) { | 25 TEST(BMPImageDecoderTest, isSizeAvailable) { |
27 const char* bmpFile = | 26 const char* bmpFile = |
28 "/LayoutTests/fast/images/resources/lenna.bmp"; // 256x256 | 27 "/LayoutTests/fast/images/resources/lenna.bmp"; // 256x256 |
29 RefPtr<SharedBuffer> data = readFile(bmpFile); | 28 RefPtr<SharedBuffer> data = readFile(bmpFile); |
30 ASSERT_TRUE(data.get()); | 29 ASSERT_TRUE(data.get()); |
31 | 30 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does | 81 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does |
83 // not break BMP decoding at a critical point: in between a call to decode the | 82 // not break BMP decoding at a critical point: in between a call to decode the |
84 // size (when BMPImageDecoder stops while it may still have input data to | 83 // size (when BMPImageDecoder stops while it may still have input data to |
85 // read) and a call to do a full decode. | 84 // read) and a call to do a full decode. |
86 TEST(BMPImageDecoderTest, mergeBuffer) { | 85 TEST(BMPImageDecoderTest, mergeBuffer) { |
87 const char* bmpFile = "/LayoutTests/fast/images/resources/lenna.bmp"; | 86 const char* bmpFile = "/LayoutTests/fast/images/resources/lenna.bmp"; |
88 testMergeBuffer(&createDecoder, bmpFile); | 87 testMergeBuffer(&createDecoder, bmpFile); |
89 } | 88 } |
90 | 89 |
91 } // namespace blink | 90 } // namespace blink |
OLD | NEW |