| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 EXPECT_EQ(frameCount, decoder->frameCount()); | 444 EXPECT_EQ(frameCount, decoder->frameCount()); |
| 445 ImageFrame* lastFrame = decoder->frameBufferAtIndex(frameCount - 1); | 445 ImageFrame* lastFrame = decoder->frameBufferAtIndex(frameCount - 1); |
| 446 EXPECT_EQ(baselineHashes[frameCount - 1], hashSkBitmap(lastFrame->getSkBitma
p())); | 446 EXPECT_EQ(baselineHashes[frameCount - 1], hashSkBitmap(lastFrame->getSkBitma
p())); |
| 447 decoder->clearCacheExceptFrame(kNotFound); | 447 decoder->clearCacheExceptFrame(kNotFound); |
| 448 | 448 |
| 449 // Resume decoding of the first frame. | 449 // Resume decoding of the first frame. |
| 450 ImageFrame* firstFrame = decoder->frameBufferAtIndex(0); | 450 ImageFrame* firstFrame = decoder->frameBufferAtIndex(0); |
| 451 EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status()); | 451 EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status()); |
| 452 EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap())); | 452 EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap())); |
| 453 } | 453 } |
| 454 |
| 455 TEST(GIFImageDecoderTest, invalidDisposalMethod) |
| 456 { |
| 457 OwnPtr<GIFImageDecoder> decoder = createDecoder(); |
| 458 |
| 459 // The image has 2 frames, with disposal method 4 and 5, respectively. |
| 460 RefPtr<SharedBuffer> data = readFile("/Source/web/tests/data/invalid-disposa
l-method.gif"); |
| 461 ASSERT_TRUE(data.get()); |
| 462 decoder->setData(data.get(), true); |
| 463 |
| 464 EXPECT_EQ(2u, decoder->frameCount()); |
| 465 // Disposal method 4 is converted to ImageFrame::DisposeOverwritePrevious. |
| 466 EXPECT_EQ(ImageFrame::DisposeOverwritePrevious, decoder->frameBufferAtIndex(
0)->disposalMethod()); |
| 467 // Disposal method 5 is ignored. |
| 468 EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->d
isposalMethod()); |
| 469 } |
| OLD | NEW |