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

Side by Side Diff: Source/core/platform/image-decoders/gif/GIFImageDecoderTest.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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 // Give it data that is enough to parse but not decode in order to check the status 387 // Give it data that is enough to parse but not decode in order to check the status
388 // of requiredPreviousFrameIndex before decoding. 388 // of requiredPreviousFrameIndex before decoding.
389 size_t partialSize = 1; 389 size_t partialSize = 1;
390 do { 390 do {
391 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize); 391 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize);
392 decoder->setData(data.get(), false); 392 decoder->setData(data.get(), false);
393 ++partialSize; 393 ++partialSize;
394 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty); 394 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty);
395 395
396 EXPECT_EQ(notFound, decoder->frameBufferAtIndex(0)->requiredPreviousFrameInd ex()); 396 EXPECT_EQ(kNotFound, decoder->frameBufferAtIndex(0)->requiredPreviousFrameIn dex());
397 unsigned frameCount = decoder->frameCount(); 397 unsigned frameCount = decoder->frameCount();
398 for (size_t i = 1; i < frameCount; ++i) 398 for (size_t i = 1; i < frameCount; ++i)
399 EXPECT_EQ(i - 1, decoder->frameBufferAtIndex(i)->requiredPreviousFrameIn dex()); 399 EXPECT_EQ(i - 1, decoder->frameBufferAtIndex(i)->requiredPreviousFrameIn dex());
400 400
401 decoder->setData(fullData.get(), true); 401 decoder->setData(fullData.get(), true);
402 for (size_t i = 0; i < frameCount; ++i) 402 for (size_t i = 0; i < frameCount; ++i)
403 EXPECT_EQ(notFound, decoder->frameBufferAtIndex(i)->requiredPreviousFram eIndex()); 403 EXPECT_EQ(kNotFound, decoder->frameBufferAtIndex(i)->requiredPreviousFra meIndex());
404 } 404 }
405 405
406 TEST(GIFImageDecoderTest, randomFrameDecode) 406 TEST(GIFImageDecoderTest, randomFrameDecode)
407 { 407 {
408 // Single frame image. 408 // Single frame image.
409 testRandomFrameDecode("/Source/web/tests/data/radient.gif"); 409 testRandomFrameDecode("/Source/web/tests/data/radient.gif");
410 // Multiple frame images. 410 // Multiple frame images.
411 testRandomFrameDecode("/LayoutTests/fast/images/resources/animated-gif-with- offsets.gif"); 411 testRandomFrameDecode("/LayoutTests/fast/images/resources/animated-gif-with- offsets.gif");
412 testRandomFrameDecode("/LayoutTests/fast/images/resources/animated-10color.g if"); 412 testRandomFrameDecode("/LayoutTests/fast/images/resources/animated-10color.g if");
413 } 413 }
(...skipping 23 matching lines...) Expand all
437 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize); 437 RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), parti alSize);
438 decoder->setData(data.get(), false); 438 decoder->setData(data.get(), false);
439 ++partialSize; 439 ++partialSize;
440 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty); 440 } while (!decoder->frameCount() || decoder->frameBufferAtIndex(0)->status() == ImageFrame::FrameEmpty);
441 441
442 // Skip to the last frame and clear. 442 // Skip to the last frame and clear.
443 decoder->setData(fullData.get(), true); 443 decoder->setData(fullData.get(), true);
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(notFound); 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 }
OLDNEW
« no previous file with comments | « Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp ('k') | Source/core/platform/image-decoders/gif/GIFImageReader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698