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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha()); | 397 EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha()); |
398 } | 398 } |
399 | 399 |
400 EXPECT_EQ(WTF_ARRAY_LENGTH(frameParameters), decoder->frameCount()); | 400 EXPECT_EQ(WTF_ARRAY_LENGTH(frameParameters), decoder->frameCount()); |
401 EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount()); | 401 EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount()); |
402 } | 402 } |
403 | 403 |
404 TEST(AnimatedWebPTests, parseAndDecodeByteByByte) | 404 TEST(AnimatedWebPTests, parseAndDecodeByteByByte) |
405 { | 405 { |
406 testByteByByteDecode(&createDecoder, "/LayoutTests/fast/images/resources/web
p-animated.webp", 3u, cAnimationLoopInfinite); | 406 testByteByByteDecode(&createDecoder, "/LayoutTests/fast/images/resources/web
p-animated.webp", 3u, cAnimationLoopInfinite); |
407 testByteByByteDecode(&createDecoder, "/LayoutTests/fast/images/resources/web
p-animated-icc-xmp.webp", 13u, 31999); | 407 testByteByByteDecode(&createDecoder, "/LayoutTests/fast/images/resources/web
p-animated-icc-xmp.webp", 13u, 32000); |
408 } | 408 } |
409 | 409 |
410 TEST(AnimatedWebPTests, invalidImages) | 410 TEST(AnimatedWebPTests, invalidImages) |
411 { | 411 { |
412 // ANMF chunk size is smaller than ANMF header size. | 412 // ANMF chunk size is smaller than ANMF header size. |
413 testInvalidImage("/LayoutTests/fast/images/resources/invalid-animated-webp.w
ebp", true); | 413 testInvalidImage("/LayoutTests/fast/images/resources/invalid-animated-webp.w
ebp", true); |
414 // One of the frame rectangles extends outside the image boundary. | 414 // One of the frame rectangles extends outside the image boundary. |
415 testInvalidImage("/LayoutTests/fast/images/resources/invalid-animated-webp3.
webp", true); | 415 testInvalidImage("/LayoutTests/fast/images/resources/invalid-animated-webp3.
webp", true); |
416 } | 416 } |
417 | 417 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent1.webp"); | 647 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent1.webp"); |
648 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent2.webp"); | 648 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent2.webp"); |
649 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent3.webp"); | 649 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent3.webp"); |
650 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent4.webp"); | 650 testAlphaBlending("/LayoutTests/fast/images/resources/webp-animated-semitran
sparent4.webp"); |
651 } | 651 } |
652 | 652 |
653 TEST(AnimatedWebPTests, isSizeAvailable) | 653 TEST(AnimatedWebPTests, isSizeAvailable) |
654 { | 654 { |
655 testByteByByteSizeAvailable("/LayoutTests/fast/images/resources/webp-animate
d.webp", 142u, false, cAnimationLoopInfinite); | 655 testByteByByteSizeAvailable("/LayoutTests/fast/images/resources/webp-animate
d.webp", 142u, false, cAnimationLoopInfinite); |
656 // FIXME: Add color profile support for animated webp images. | 656 // FIXME: Add color profile support for animated webp images. |
657 testByteByByteSizeAvailable("/LayoutTests/fast/images/resources/webp-animate
d-icc-xmp.webp", 1404u, false, 31999); | 657 testByteByByteSizeAvailable("/LayoutTests/fast/images/resources/webp-animate
d-icc-xmp.webp", 1404u, false, 32000); |
658 } | 658 } |
659 | 659 |
660 TEST(StaticWebPTests, truncatedImage) | 660 TEST(StaticWebPTests, truncatedImage) |
661 { | 661 { |
662 // VP8 data is truncated. | 662 // VP8 data is truncated. |
663 testInvalidImage("/LayoutTests/fast/images/resources/truncated.webp", false)
; | 663 testInvalidImage("/LayoutTests/fast/images/resources/truncated.webp", false)
; |
664 // Chunk size in RIFF header doesn't match the file size. | 664 // Chunk size in RIFF header doesn't match the file size. |
665 testInvalidImage("/LayoutTests/fast/images/resources/truncated2.webp", true)
; | 665 testInvalidImage("/LayoutTests/fast/images/resources/truncated2.webp", true)
; |
666 } | 666 } |
667 | 667 |
(...skipping 13 matching lines...) Expand all Loading... |
681 { | 681 { |
682 OwnPtr<ImageDecoder> decoder = createDecoder(); | 682 OwnPtr<ImageDecoder> decoder = createDecoder(); |
683 RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/web
p-color-profile-lossy.webp"); | 683 RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/web
p-color-profile-lossy.webp"); |
684 ASSERT_TRUE(data.get()); | 684 ASSERT_TRUE(data.get()); |
685 decoder->setData(data.get(), true); | 685 decoder->setData(data.get(), true); |
686 EXPECT_EQ(1u, decoder->frameCount()); | 686 EXPECT_EQ(1u, decoder->frameCount()); |
687 EXPECT_EQ(cAnimationNone, decoder->repetitionCount()); | 687 EXPECT_EQ(cAnimationNone, decoder->repetitionCount()); |
688 } | 688 } |
689 | 689 |
690 } // namespace blink | 690 } // namespace blink |
OLD | NEW |