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

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

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 // Give it data that is enough to parse but not decode in order to check the status 436 // Give it data that is enough to parse but not decode in order to check the status
437 // of requiredPreviousFrameIndex before decoding. 437 // of requiredPreviousFrameIndex before decoding.
438 size_t partialSize = 1; 438 size_t partialSize = 1;
439 do { 439 do {
440 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize); 440 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize);
441 decoder->setData(data.get(), false); 441 decoder->setData(data.get(), false);
442 ++partialSize; 442 ++partialSize;
443 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty); 443 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty);
444 444
445 EXPECT_EQ(notFound, decoder->frameBufferAtIndex(0)->requiredPreviousFrameInd ex()); 445 EXPECT_EQ(kNotFound, decoder->frameBufferAtIndex(0)->requiredPreviousFrameIn dex());
446 unsigned frameCount = decoder->frameCount(); 446 unsigned frameCount = decoder->frameCount();
447 for (size_t i = 1; i < frameCount; ++i) 447 for (size_t i = 1; i < frameCount; ++i)
448 EXPECT_EQ(i - 1, decoder->frameBufferAtIndex(i)->requiredPreviousFrameIn dex()); 448 EXPECT_EQ(i - 1, decoder->frameBufferAtIndex(i)->requiredPreviousFrameIn dex());
449 449
450 decoder->setData(fullData.get(), true); 450 decoder->setData(fullData.get(), true);
451 for (size_t i = 0; i < frameCount; ++i) 451 for (size_t i = 0; i < frameCount; ++i)
452 EXPECT_EQ(notFound, decoder->frameBufferAtIndex(i)->requiredPreviousFram eIndex()); 452 EXPECT_EQ(kNotFound, decoder->frameBufferAtIndex(i)->requiredPreviousFra meIndex());
453 } 453 }
454 454
455 TEST_F(AnimatedWebPTests, randomFrameDecode) 455 TEST_F(AnimatedWebPTests, randomFrameDecode)
456 { 456 {
457 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated.webp "); 457 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated.webp ");
458 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-opaq ue.webp"); 458 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-opaq ue.webp");
459 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-larg e.webp"); 459 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-larg e.webp");
460 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-icc- xmp.webp"); 460 testRandomFrameDecode("/LayoutTests/fast/images/resources/webp-animated-icc- xmp.webp");
461 } 461 }
462 462
(...skipping 21 matching lines...) Expand all
484 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize); 484 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize);
485 decoder->setData(data.get(), false); 485 decoder->setData(data.get(), false);
486 ++partialSize; 486 ++partialSize;
487 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty); 487 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty);
488 488
489 // Skip to the last frame and clear. 489 // Skip to the last frame and clear.
490 decoder->setData(fullData.get(), true); 490 decoder->setData(fullData.get(), true);
491 EXPECT_EQ(frameCount, decoder->frameCount()); 491 EXPECT_EQ(frameCount, decoder->frameCount());
492 ImageFrame* lastFrame = decoder->frameBufferAtIndex(frameCount - 1); 492 ImageFrame* lastFrame = decoder->frameBufferAtIndex(frameCount - 1);
493 EXPECT_EQ(baselineHashes[frameCount - 1], hashSkBitmap(lastFrame->getSkBitma p())); 493 EXPECT_EQ(baselineHashes[frameCount - 1], hashSkBitmap(lastFrame->getSkBitma p()));
494 decoder->clearCacheExceptFrame(notFound); 494 decoder->clearCacheExceptFrame(kNotFound);
495 495
496 // Resume decoding of the first frame. 496 // Resume decoding of the first frame.
497 ImageFrame* firstFrame = decoder->frameBufferAtIndex(0); 497 ImageFrame* firstFrame = decoder->frameBufferAtIndex(0);
498 EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status()); 498 EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status());
499 EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap())); 499 EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap()));
500 } 500 }
501 501
502 TEST_F(AnimatedWebPTests, decodeAfterReallocatingData) 502 TEST_F(AnimatedWebPTests, decodeAfterReallocatingData)
503 { 503 {
504 testDecodeAfterReallocatingData("/LayoutTests/fast/images/resources/webp-ani mated.webp"); 504 testDecodeAfterReallocatingData("/LayoutTests/fast/images/resources/webp-ani mated.webp");
505 testDecodeAfterReallocatingData("/LayoutTests/fast/images/resources/webp-ani mated-icc-xmp.webp"); 505 testDecodeAfterReallocatingData("/LayoutTests/fast/images/resources/webp-ani mated-icc-xmp.webp");
506 } 506 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698