| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 ASSERT_TRUE(data_buffer.Get()); | 345 ASSERT_TRUE(data_buffer.Get()); |
| 346 const Vector<char> data = data_buffer->Copy(); | 346 const Vector<char> data = data_buffer->Copy(); |
| 347 | 347 |
| 348 ASSERT_GE(data.size(), 10u); | 348 ASSERT_GE(data.size(), 10u); |
| 349 RefPtr<SharedBuffer> temp_data = | 349 RefPtr<SharedBuffer> temp_data = |
| 350 SharedBuffer::Create(data.data(), data.size() - 10); | 350 SharedBuffer::Create(data.data(), data.size() - 10); |
| 351 decoder->SetData(temp_data.Get(), false); | 351 decoder->SetData(temp_data.Get(), false); |
| 352 | 352 |
| 353 EXPECT_EQ(2u, decoder->FrameCount()); | 353 EXPECT_EQ(2u, decoder->FrameCount()); |
| 354 EXPECT_FALSE(decoder->Failed()); | 354 EXPECT_FALSE(decoder->Failed()); |
| 355 EXPECT_TRUE(decoder->FrameIsCompleteAtIndex(0)); | 355 EXPECT_TRUE(decoder->FrameIsReceivedAtIndex(0)); |
| 356 EXPECT_EQ(1000, decoder->FrameDurationAtIndex(0)); | 356 EXPECT_EQ(1000, decoder->FrameDurationAtIndex(0)); |
| 357 EXPECT_TRUE(decoder->FrameIsCompleteAtIndex(1)); | 357 EXPECT_TRUE(decoder->FrameIsReceivedAtIndex(1)); |
| 358 EXPECT_EQ(500, decoder->FrameDurationAtIndex(1)); | 358 EXPECT_EQ(500, decoder->FrameDurationAtIndex(1)); |
| 359 | 359 |
| 360 decoder->SetData(data_buffer.Get(), true); | 360 decoder->SetData(data_buffer.Get(), true); |
| 361 EXPECT_EQ(3u, decoder->FrameCount()); | 361 EXPECT_EQ(3u, decoder->FrameCount()); |
| 362 EXPECT_TRUE(decoder->FrameIsCompleteAtIndex(0)); | 362 EXPECT_TRUE(decoder->FrameIsReceivedAtIndex(0)); |
| 363 EXPECT_EQ(1000, decoder->FrameDurationAtIndex(0)); | 363 EXPECT_EQ(1000, decoder->FrameDurationAtIndex(0)); |
| 364 EXPECT_TRUE(decoder->FrameIsCompleteAtIndex(1)); | 364 EXPECT_TRUE(decoder->FrameIsReceivedAtIndex(1)); |
| 365 EXPECT_EQ(500, decoder->FrameDurationAtIndex(1)); | 365 EXPECT_EQ(500, decoder->FrameDurationAtIndex(1)); |
| 366 EXPECT_TRUE(decoder->FrameIsCompleteAtIndex(2)); | 366 EXPECT_TRUE(decoder->FrameIsReceivedAtIndex(2)); |
| 367 EXPECT_EQ(1000.0, decoder->FrameDurationAtIndex(2)); | 367 EXPECT_EQ(1000.0, decoder->FrameDurationAtIndex(2)); |
| 368 } | 368 } |
| 369 | 369 |
| 370 TEST(AnimatedWebPTests, updateRequiredPreviousFrameAfterFirstDecode) { | 370 TEST(AnimatedWebPTests, updateRequiredPreviousFrameAfterFirstDecode) { |
| 371 TestUpdateRequiredPreviousFrameAfterFirstDecode( | 371 TestUpdateRequiredPreviousFrameAfterFirstDecode( |
| 372 &CreateDecoder, "/LayoutTests/images/resources/webp-animated.webp"); | 372 &CreateDecoder, "/LayoutTests/images/resources/webp-animated.webp"); |
| 373 } | 373 } |
| 374 | 374 |
| 375 TEST(AnimatedWebPTests, randomFrameDecode) { | 375 TEST(AnimatedWebPTests, randomFrameDecode) { |
| 376 TestRandomFrameDecode(&CreateDecoder, | 376 TestRandomFrameDecode(&CreateDecoder, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 std::unique_ptr<ImageDecoder> decoder = CreateDecoder(); | 547 std::unique_ptr<ImageDecoder> decoder = CreateDecoder(); |
| 548 RefPtr<SharedBuffer> data = | 548 RefPtr<SharedBuffer> data = |
| 549 ReadFile("/LayoutTests/images/resources/webp-color-profile-lossy.webp"); | 549 ReadFile("/LayoutTests/images/resources/webp-color-profile-lossy.webp"); |
| 550 ASSERT_TRUE(data.Get()); | 550 ASSERT_TRUE(data.Get()); |
| 551 decoder->SetData(data.Get(), true); | 551 decoder->SetData(data.Get(), true); |
| 552 EXPECT_EQ(1u, decoder->FrameCount()); | 552 EXPECT_EQ(1u, decoder->FrameCount()); |
| 553 EXPECT_EQ(kAnimationNone, decoder->RepetitionCount()); | 553 EXPECT_EQ(kAnimationNone, decoder->RepetitionCount()); |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace blink | 556 } // namespace blink |
| OLD | NEW |