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

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

Issue 2556723003: Merge color options into ColorBehavior (Closed)
Patch Set: Feedback 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 29 matching lines...) Expand all
40 #include "wtf/Vector.h" 40 #include "wtf/Vector.h"
41 #include "wtf/dtoa/utils.h" 41 #include "wtf/dtoa/utils.h"
42 #include <memory> 42 #include <memory>
43 43
44 namespace blink { 44 namespace blink {
45 45
46 namespace { 46 namespace {
47 47
48 std::unique_ptr<ImageDecoder> createDecoder( 48 std::unique_ptr<ImageDecoder> createDecoder(
49 ImageDecoder::AlphaOption alphaOption) { 49 ImageDecoder::AlphaOption alphaOption) {
50 return wrapUnique( 50 return wrapUnique(new WEBPImageDecoder(
51 new WEBPImageDecoder(alphaOption, ImageDecoder::ColorSpaceTransformed, 51 alphaOption, ColorBehavior::transformToTargetForTesting(),
52 ImageDecoder::targetColorSpaceForTesting(), 52 ImageDecoder::noDecodedImageByteLimit));
53 ImageDecoder::noDecodedImageByteLimit));
54 } 53 }
55 54
56 std::unique_ptr<ImageDecoder> createDecoder() { 55 std::unique_ptr<ImageDecoder> createDecoder() {
57 return createDecoder(ImageDecoder::AlphaNotPremultiplied); 56 return createDecoder(ImageDecoder::AlphaNotPremultiplied);
58 } 57 }
59 58
60 // If 'parseErrorExpected' is true, error is expected during parse (frameCount() 59 // If 'parseErrorExpected' is true, error is expected during parse (frameCount()
61 // call); else error is expected during decode (frameBufferAtIndex() call). 60 // call); else error is expected during decode (frameBufferAtIndex() call).
62 void testInvalidImage(const char* webpFile, bool parseErrorExpected) { 61 void testInvalidImage(const char* webpFile, bool parseErrorExpected) {
63 std::unique_ptr<ImageDecoder> decoder = createDecoder(); 62 std::unique_ptr<ImageDecoder> decoder = createDecoder();
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 std::unique_ptr<ImageDecoder> decoder = createDecoder(); 543 std::unique_ptr<ImageDecoder> decoder = createDecoder();
545 RefPtr<SharedBuffer> data = 544 RefPtr<SharedBuffer> data =
546 readFile("/LayoutTests/images/resources/webp-color-profile-lossy.webp"); 545 readFile("/LayoutTests/images/resources/webp-color-profile-lossy.webp");
547 ASSERT_TRUE(data.get()); 546 ASSERT_TRUE(data.get());
548 decoder->setData(data.get(), true); 547 decoder->setData(data.get(), true);
549 EXPECT_EQ(1u, decoder->frameCount()); 548 EXPECT_EQ(1u, decoder->frameCount());
550 EXPECT_EQ(cAnimationNone, decoder->repetitionCount()); 549 EXPECT_EQ(cAnimationNone, decoder->repetitionCount());
551 } 550 }
552 551
553 } // namespace blink 552 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698