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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp

Issue 2940933003: DO NOT SUBMIT results of new clang-format (Closed)
Patch Set: Created 3 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
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 414
415 namespace { 415 namespace {
416 // Needed to exercise ImageDecoder::SetMemoryAllocator, but still does the 416 // Needed to exercise ImageDecoder::SetMemoryAllocator, but still does the
417 // default allocation. 417 // default allocation.
418 class Allocator final : public SkBitmap::Allocator { 418 class Allocator final : public SkBitmap::Allocator {
419 bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) override { 419 bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) override {
420 return dst->tryAllocPixels(ctable); 420 return dst->tryAllocPixels(ctable);
421 } 421 }
422 }; 422 };
423 } 423 } // namespace
424 424
425 // Ensure that calling SetMemoryAllocator does not short-circuit 425 // Ensure that calling SetMemoryAllocator does not short-circuit
426 // InitializeNewFrame. 426 // InitializeNewFrame.
427 TEST(GIFImageDecoderTest, externalAllocator) { 427 TEST(GIFImageDecoderTest, externalAllocator) {
428 auto data = ReadFile(kLayoutTestResourcesDir, "boston.gif"); 428 auto data = ReadFile(kLayoutTestResourcesDir, "boston.gif");
429 ASSERT_TRUE(data.Get()); 429 ASSERT_TRUE(data.Get());
430 430
431 auto decoder = CreateDecoder(); 431 auto decoder = CreateDecoder();
432 decoder->SetData(data.Get(), true); 432 decoder->SetData(data.Get(), true);
433 433
434 Allocator allocator; 434 Allocator allocator;
435 decoder->SetMemoryAllocator(&allocator); 435 decoder->SetMemoryAllocator(&allocator);
436 EXPECT_EQ(1u, decoder->FrameCount()); 436 EXPECT_EQ(1u, decoder->FrameCount());
437 ImageFrame* frame = decoder->FrameBufferAtIndex(0); 437 ImageFrame* frame = decoder->FrameBufferAtIndex(0);
438 decoder->SetMemoryAllocator(nullptr); 438 decoder->SetMemoryAllocator(nullptr);
439 439
440 ASSERT_TRUE(frame); 440 ASSERT_TRUE(frame);
441 EXPECT_EQ(IntRect(IntPoint(), decoder->Size()), frame->OriginalFrameRect()); 441 EXPECT_EQ(IntRect(IntPoint(), decoder->Size()), frame->OriginalFrameRect());
442 EXPECT_FALSE(frame->HasAlpha()); 442 EXPECT_FALSE(frame->HasAlpha());
443 } 443 }
444 444
445 } // namespace blink 445 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698