| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 TEST(GIFImageDecoderTest, frameIsComplete) | 301 TEST(GIFImageDecoderTest, frameIsComplete) |
| 302 { | 302 { |
| 303 OwnPtr<ImageDecoder> decoder = createDecoder(); | 303 OwnPtr<ImageDecoder> decoder = createDecoder(); |
| 304 | 304 |
| 305 RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif")
; | 305 RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif")
; |
| 306 ASSERT_TRUE(data.get()); | 306 ASSERT_TRUE(data.get()); |
| 307 decoder->setData(data.get(), true); | 307 decoder->setData(data.get(), true); |
| 308 | 308 |
| 309 EXPECT_EQ(2u, decoder->frameCount()); | 309 EXPECT_EQ(2u, decoder->frameCount()); |
| 310 EXPECT_FALSE(decoder->failed()); | 310 EXPECT_FALSE(decoder->failed()); |
| 311 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); | 311 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(0)); |
| 312 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1)); | 312 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(1)); |
| 313 EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount()); | 313 EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 TEST(GIFImageDecoderTest, frameIsCompleteLoading) | 316 TEST(GIFImageDecoderTest, frameIsCompleteLoading) |
| 317 { | 317 { |
| 318 OwnPtr<ImageDecoder> decoder = createDecoder(); | 318 OwnPtr<ImageDecoder> decoder = createDecoder(); |
| 319 | 319 |
| 320 RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif")
; | 320 RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif")
; |
| 321 ASSERT_TRUE(data.get()); | 321 ASSERT_TRUE(data.get()); |
| 322 | 322 |
| 323 ASSERT_GE(data->size(), 10u); | 323 ASSERT_GE(data->size(), 10u); |
| 324 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->siz
e() - 10); | 324 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->siz
e() - 10); |
| 325 decoder->setData(tempData.get(), false); | 325 decoder->setData(tempData.get(), false); |
| 326 | 326 |
| 327 EXPECT_EQ(2u, decoder->frameCount()); | 327 EXPECT_EQ(2u, decoder->frameCount()); |
| 328 EXPECT_FALSE(decoder->failed()); | 328 EXPECT_FALSE(decoder->failed()); |
| 329 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); | 329 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(0)); |
| 330 EXPECT_FALSE(decoder->frameIsCompleteAtIndex(1)); | 330 EXPECT_FALSE(decoder->frameIsFullyReceivedAtIndex(1)); |
| 331 | 331 |
| 332 decoder->setData(data.get(), true); | 332 decoder->setData(data.get(), true); |
| 333 EXPECT_EQ(2u, decoder->frameCount()); | 333 EXPECT_EQ(2u, decoder->frameCount()); |
| 334 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); | 334 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(0)); |
| 335 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1)); | 335 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(1)); |
| 336 } | 336 } |
| 337 | 337 |
| 338 TEST(GIFImageDecoderTest, badTerminator) | 338 TEST(GIFImageDecoderTest, badTerminator) |
| 339 { | 339 { |
| 340 RefPtr<SharedBuffer> referenceData = readFile(decodersTestingDir, "radient.g
if"); | 340 RefPtr<SharedBuffer> referenceData = readFile(decodersTestingDir, "radient.g
if"); |
| 341 RefPtr<SharedBuffer> testData = readFile(decodersTestingDir, "radient-bad-te
rminator.gif"); | 341 RefPtr<SharedBuffer> testData = readFile(decodersTestingDir, "radient-bad-te
rminator.gif"); |
| 342 ASSERT_TRUE(referenceData.get()); | 342 ASSERT_TRUE(referenceData.get()); |
| 343 ASSERT_TRUE(testData.get()); | 343 ASSERT_TRUE(testData.get()); |
| 344 | 344 |
| 345 OwnPtr<ImageDecoder> referenceDecoder = createDecoder(); | 345 OwnPtr<ImageDecoder> referenceDecoder = createDecoder(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 ASSERT_TRUE(unpremulDecoder->frameCount()); | 556 ASSERT_TRUE(unpremulDecoder->frameCount()); |
| 557 premulFrame = premulDecoder->frameBufferAtIndex(0); | 557 premulFrame = premulDecoder->frameBufferAtIndex(0); |
| 558 EXPECT_TRUE(premulFrame && premulFrame->getStatus() == ImageFrame::FrameComp
lete); | 558 EXPECT_TRUE(premulFrame && premulFrame->getStatus() == ImageFrame::FrameComp
lete); |
| 559 EXPECT_EQ(premulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); | 559 EXPECT_EQ(premulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); |
| 560 unpremulFrame = unpremulDecoder->frameBufferAtIndex(0); | 560 unpremulFrame = unpremulDecoder->frameBufferAtIndex(0); |
| 561 EXPECT_TRUE(unpremulFrame && unpremulFrame->getStatus() == ImageFrame::Frame
Complete); | 561 EXPECT_TRUE(unpremulFrame && unpremulFrame->getStatus() == ImageFrame::Frame
Complete); |
| 562 EXPECT_EQ(unpremulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); | 562 EXPECT_EQ(unpremulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); |
| 563 } | 563 } |
| 564 | 564 |
| 565 } // namespace blink | 565 } // namespace blink |
| OLD | NEW |