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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 kOpaque_SkAlphaType); 52 kOpaque_SkAlphaType);
53 } 53 }
54 54
55 } // namespace 55 } // namespace
56 56
57 class ImageFrameGeneratorTest : public ::testing::Test, 57 class ImageFrameGeneratorTest : public ::testing::Test,
58 public MockImageDecoderClient { 58 public MockImageDecoderClient {
59 public: 59 public:
60 void SetUp() override { 60 void SetUp() override {
61 ImageDecodingStore::instance().setCacheLimitInBytes(1024 * 1024); 61 ImageDecodingStore::instance().setCacheLimitInBytes(1024 * 1024);
62 m_generator = ImageFrameGenerator::create( 62 m_generator =
63 fullSize(), false, ImageDecoder::ColorSpaceIgnored, nullptr); 63 ImageFrameGenerator::create(fullSize(), false, ColorBehavior::ignore());
64 m_data = SharedBuffer::create(); 64 m_data = SharedBuffer::create();
65 m_segmentReader = SegmentReader::createFromSharedBuffer(m_data); 65 m_segmentReader = SegmentReader::createFromSharedBuffer(m_data);
66 useMockImageDecoderFactory(); 66 useMockImageDecoderFactory();
67 m_decodersDestroyed = 0; 67 m_decodersDestroyed = 0;
68 m_decodeRequestCount = 0; 68 m_decodeRequestCount = 0;
69 m_status = ImageFrame::FrameEmpty; 69 m_status = ImageFrame::FrameEmpty;
70 m_frameCount = 1; 70 m_frameCount = 1;
71 m_requestedClearExceptFrame = kNotFound; 71 m_requestedClearExceptFrame = kNotFound;
72 } 72 }
73 73
(...skipping 30 matching lines...) Expand all
104 void setFrameStatus(ImageFrame::Status status) { 104 void setFrameStatus(ImageFrame::Status status) {
105 m_status = m_nextFrameStatus = status; 105 m_status = m_nextFrameStatus = status;
106 } 106 }
107 void setNextFrameStatus(ImageFrame::Status status) { 107 void setNextFrameStatus(ImageFrame::Status status) {
108 m_nextFrameStatus = status; 108 m_nextFrameStatus = status;
109 } 109 }
110 void setFrameCount(size_t count) { 110 void setFrameCount(size_t count) {
111 m_frameCount = count; 111 m_frameCount = count;
112 if (count > 1) { 112 if (count > 1) {
113 m_generator.clear(); 113 m_generator.clear();
114 m_generator = ImageFrameGenerator::create( 114 m_generator = ImageFrameGenerator::create(fullSize(), true,
115 fullSize(), true, ImageDecoder::ColorSpaceIgnored, nullptr); 115 ColorBehavior::ignore());
116 useMockImageDecoderFactory(); 116 useMockImageDecoderFactory();
117 } 117 }
118 } 118 }
119 119
120 RefPtr<SharedBuffer> m_data; 120 RefPtr<SharedBuffer> m_data;
121 RefPtr<SegmentReader> m_segmentReader; 121 RefPtr<SegmentReader> m_segmentReader;
122 RefPtr<ImageFrameGenerator> m_generator; 122 RefPtr<ImageFrameGenerator> m_generator;
123 int m_decodersDestroyed; 123 int m_decodersDestroyed;
124 int m_decodeRequestCount; 124 int m_decodeRequestCount;
125 ImageFrame::Status m_status; 125 ImageFrame::Status m_status;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // all the frame data, but not destroying the decoder. See comments in 254 // all the frame data, but not destroying the decoder. See comments in
255 // ImageFrameGenerator::tryToResumeDecode(). 255 // ImageFrameGenerator::tryToResumeDecode().
256 m_generator->decodeAndScale(m_segmentReader.get(), true, 2, imageInfo(), 256 m_generator->decodeAndScale(m_segmentReader.get(), true, 2, imageInfo(),
257 buffer, 100 * 4); 257 buffer, 100 * 4);
258 EXPECT_EQ(3, m_decodeRequestCount); 258 EXPECT_EQ(3, m_decodeRequestCount);
259 EXPECT_EQ(0, m_decodersDestroyed); 259 EXPECT_EQ(0, m_decodersDestroyed);
260 EXPECT_EQ(kNotFound, m_requestedClearExceptFrame); 260 EXPECT_EQ(kNotFound, m_requestedClearExceptFrame);
261 } 261 }
262 262
263 } // namespace blink 263 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698