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

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

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 28 matching lines...) Expand all
39 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
40 #include <memory> 40 #include <memory>
41 41
42 namespace blink { 42 namespace blink {
43 43
44 namespace { 44 namespace {
45 45
46 const char layoutTestResourcesDir[] = "LayoutTests/images/resources"; 46 const char layoutTestResourcesDir[] = "LayoutTests/images/resources";
47 47
48 std::unique_ptr<ImageDecoder> createDecoder() { 48 std::unique_ptr<ImageDecoder> createDecoder() {
49 return wrapUnique( 49 return WTF::wrapUnique(
50 new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied, 50 new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied,
51 ColorBehavior::transformToTargetForTesting(), 51 ColorBehavior::transformToTargetForTesting(),
52 ImageDecoder::noDecodedImageByteLimit)); 52 ImageDecoder::noDecodedImageByteLimit));
53 } 53 }
54 54
55 void testRepetitionCount(const char* dir, 55 void testRepetitionCount(const char* dir,
56 const char* file, 56 const char* file,
57 int expectedRepetitionCount) { 57 int expectedRepetitionCount) {
58 std::unique_ptr<ImageDecoder> decoder = createDecoder(); 58 std::unique_ptr<ImageDecoder> decoder = createDecoder();
59 RefPtr<SharedBuffer> data = readFile(dir, file); 59 RefPtr<SharedBuffer> data = readFile(dir, file);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 ASSERT_TRUE(fullData.get()); 360 ASSERT_TRUE(fullData.get());
361 361
362 // Empirically chosen truncation size: 362 // Empirically chosen truncation size:
363 // a) large enough to produce a partial frame && 363 // a) large enough to produce a partial frame &&
364 // b) small enough to not fully decode the frame 364 // b) small enough to not fully decode the frame
365 const size_t kTruncateSize = 800; 365 const size_t kTruncateSize = 800;
366 ASSERT_TRUE(kTruncateSize < fullData->size()); 366 ASSERT_TRUE(kTruncateSize < fullData->size());
367 RefPtr<SharedBuffer> partialData = 367 RefPtr<SharedBuffer> partialData =
368 SharedBuffer::create(fullData->data(), kTruncateSize); 368 SharedBuffer::create(fullData->data(), kTruncateSize);
369 369
370 std::unique_ptr<ImageDecoder> premulDecoder = wrapUnique( 370 std::unique_ptr<ImageDecoder> premulDecoder = WTF::wrapUnique(
371 new GIFImageDecoder(ImageDecoder::AlphaPremultiplied, 371 new GIFImageDecoder(ImageDecoder::AlphaPremultiplied,
372 ColorBehavior::transformToTargetForTesting(), 372 ColorBehavior::transformToTargetForTesting(),
373 ImageDecoder::noDecodedImageByteLimit)); 373 ImageDecoder::noDecodedImageByteLimit));
374 std::unique_ptr<ImageDecoder> unpremulDecoder = wrapUnique( 374 std::unique_ptr<ImageDecoder> unpremulDecoder = WTF::wrapUnique(
375 new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied, 375 new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied,
376 ColorBehavior::transformToTargetForTesting(), 376 ColorBehavior::transformToTargetForTesting(),
377 ImageDecoder::noDecodedImageByteLimit)); 377 ImageDecoder::noDecodedImageByteLimit));
378 378
379 // Partially decoded frame => the frame alpha type is unknown and should 379 // Partially decoded frame => the frame alpha type is unknown and should
380 // reflect the requested format. 380 // reflect the requested format.
381 premulDecoder->setData(partialData.get(), false); 381 premulDecoder->setData(partialData.get(), false);
382 ASSERT_TRUE(premulDecoder->frameCount()); 382 ASSERT_TRUE(premulDecoder->frameCount());
383 unpremulDecoder->setData(partialData.get(), false); 383 unpremulDecoder->setData(partialData.get(), false);
384 ASSERT_TRUE(unpremulDecoder->frameCount()); 384 ASSERT_TRUE(unpremulDecoder->frameCount());
(...skipping 15 matching lines...) Expand all
400 EXPECT_TRUE(premulFrame && 400 EXPECT_TRUE(premulFrame &&
401 premulFrame->getStatus() == ImageFrame::FrameComplete); 401 premulFrame->getStatus() == ImageFrame::FrameComplete);
402 EXPECT_EQ(premulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); 402 EXPECT_EQ(premulFrame->bitmap().alphaType(), kOpaque_SkAlphaType);
403 unpremulFrame = unpremulDecoder->frameBufferAtIndex(0); 403 unpremulFrame = unpremulDecoder->frameBufferAtIndex(0);
404 EXPECT_TRUE(unpremulFrame && 404 EXPECT_TRUE(unpremulFrame &&
405 unpremulFrame->getStatus() == ImageFrame::FrameComplete); 405 unpremulFrame->getStatus() == ImageFrame::FrameComplete);
406 EXPECT_EQ(unpremulFrame->bitmap().alphaType(), kOpaque_SkAlphaType); 406 EXPECT_EQ(unpremulFrame->bitmap().alphaType(), kOpaque_SkAlphaType);
407 } 407 }
408 408
409 } // namespace blink 409 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698