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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months 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
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 540
541 RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/web p-animated.webp"); 541 RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/web p-animated.webp");
542 ASSERT_TRUE(data.get()); 542 ASSERT_TRUE(data.get());
543 543
544 ASSERT_GE(data->size(), 10u); 544 ASSERT_GE(data->size(), 10u);
545 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->siz e() - 10); 545 RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->siz e() - 10);
546 decoder->setData(tempData.get(), false); 546 decoder->setData(tempData.get(), false);
547 547
548 EXPECT_EQ(2u, decoder->frameCount()); 548 EXPECT_EQ(2u, decoder->frameCount());
549 EXPECT_FALSE(decoder->failed()); 549 EXPECT_FALSE(decoder->failed());
550 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); 550 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(0));
551 EXPECT_EQ(1000, decoder->frameDurationAtIndex(0)); 551 EXPECT_EQ(1000, decoder->frameDurationAtIndex(0));
552 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1)); 552 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(1));
553 EXPECT_EQ(500, decoder->frameDurationAtIndex(1)); 553 EXPECT_EQ(500, decoder->frameDurationAtIndex(1));
554 554
555 decoder->setData(data.get(), true); 555 decoder->setData(data.get(), true);
556 EXPECT_EQ(3u, decoder->frameCount()); 556 EXPECT_EQ(3u, decoder->frameCount());
557 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(0)); 557 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(0));
558 EXPECT_EQ(1000, decoder->frameDurationAtIndex(0)); 558 EXPECT_EQ(1000, decoder->frameDurationAtIndex(0));
559 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1)); 559 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(1));
560 EXPECT_EQ(500, decoder->frameDurationAtIndex(1)); 560 EXPECT_EQ(500, decoder->frameDurationAtIndex(1));
561 EXPECT_TRUE(decoder->frameIsCompleteAtIndex(2)); 561 EXPECT_TRUE(decoder->frameIsFullyReceivedAtIndex(2));
562 EXPECT_EQ(1000.0, decoder->frameDurationAtIndex(2)); 562 EXPECT_EQ(1000.0, decoder->frameDurationAtIndex(2));
563 } 563 }
564 564
565 TEST(AnimatedWebPTests, updateRequiredPreviousFrameAfterFirstDecode) 565 TEST(AnimatedWebPTests, updateRequiredPreviousFrameAfterFirstDecode)
566 { 566 {
567 OwnPtr<ImageDecoder> decoder = createDecoder(); 567 OwnPtr<ImageDecoder> decoder = createDecoder();
568 568
569 RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources /webp-animated.webp"); 569 RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources /webp-animated.webp");
570 ASSERT_TRUE(fullData.get()); 570 ASSERT_TRUE(fullData.get());
571 571
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698