Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp

Issue 2523943002: Explicitly specify target color space to ImageDecoder at creation (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(new BMPImageDecoder(ImageDecoder::AlphaNotPremultiplied, 18 return wrapUnique(new BMPImageDecoder(
19 ImageDecoder::ColorSpaceApplied, 19 ImageDecoder::AlphaNotPremultiplied, ImageDecoder::ColorSpaceTransformed,
20 ImageDecoder::noDecodedImageByteLimit)); 20 ImageDecoder::targetColorSpaceForTesting(),
21 ImageDecoder::noDecodedImageByteLimit));
21 } 22 }
22 23
23 } // anonymous namespace 24 } // anonymous namespace
24 25
25 TEST(BMPImageDecoderTest, isSizeAvailable) { 26 TEST(BMPImageDecoderTest, isSizeAvailable) {
26 const char* bmpFile = "/LayoutTests/images/resources/lenna.bmp"; // 256x256 27 const char* bmpFile = "/LayoutTests/images/resources/lenna.bmp"; // 256x256
27 RefPtr<SharedBuffer> data = readFile(bmpFile); 28 RefPtr<SharedBuffer> data = readFile(bmpFile);
28 ASSERT_TRUE(data.get()); 29 ASSERT_TRUE(data.get());
29 30
30 std::unique_ptr<ImageDecoder> decoder = createDecoder(); 31 std::unique_ptr<ImageDecoder> decoder = createDecoder();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does 80 // This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does
80 // not break BMP decoding at a critical point: in between a call to decode the 81 // not break BMP decoding at a critical point: in between a call to decode the
81 // size (when BMPImageDecoder stops while it may still have input data to 82 // size (when BMPImageDecoder stops while it may still have input data to
82 // read) and a call to do a full decode. 83 // read) and a call to do a full decode.
83 TEST(BMPImageDecoderTest, mergeBuffer) { 84 TEST(BMPImageDecoderTest, mergeBuffer) {
84 const char* bmpFile = "/LayoutTests/images/resources/lenna.bmp"; 85 const char* bmpFile = "/LayoutTests/images/resources/lenna.bmp";
85 testMergeBuffer(&createDecoder, bmpFile); 86 testMergeBuffer(&createDecoder, bmpFile);
86 } 87 }
87 88
88 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698