| Index: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
|
| index 8c4e988b4ca6653476eb4df645c89a6ac8288843..300c717f5df9fb92b37c9f30c5470cb039a95b10 100644
|
| --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
|
| @@ -406,4 +406,24 @@ TEST(GIFImageDecoderTest, bitmapAlphaType) {
|
| EXPECT_EQ(unpremulFrame->bitmap().alphaType(), kOpaque_SkAlphaType);
|
| }
|
|
|
| +// Ensure that calling setMemoryAllocator does not short-circuit
|
| +// initializeNewFrame.
|
| +TEST(GIFImageDecoderTest, externalAllocator) {
|
| + auto data = readFile(layoutTestResourcesDir, "boston.gif");
|
| + ASSERT_TRUE(data.get());
|
| +
|
| + auto decoder = createDecoder();
|
| + decoder->setData(data.get(), true);
|
| +
|
| + SkBitmap::HeapAllocator allocator;
|
| + decoder->setMemoryAllocator(&allocator);
|
| + EXPECT_EQ(1u, decoder->frameCount());
|
| + ImageFrame* frame = decoder->frameBufferAtIndex(0);
|
| + decoder->setMemoryAllocator(nullptr);
|
| +
|
| + ASSERT_TRUE(frame);
|
| + EXPECT_EQ(IntRect(IntPoint(), decoder->size()), frame->originalFrameRect());
|
| + EXPECT_FALSE(frame->hasAlpha());
|
| +}
|
| +
|
| } // namespace blink
|
|
|