OLD | NEW |
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 Loading... |
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(fullSize(), nullptr, false); | 62 m_generator = ImageFrameGenerator::create( |
| 63 fullSize(), false, ImageDecoder::ColorSpaceIgnored, nullptr); |
63 m_data = SharedBuffer::create(); | 64 m_data = SharedBuffer::create(); |
64 m_segmentReader = SegmentReader::createFromSharedBuffer(m_data); | 65 m_segmentReader = SegmentReader::createFromSharedBuffer(m_data); |
65 useMockImageDecoderFactory(); | 66 useMockImageDecoderFactory(); |
66 m_decodersDestroyed = 0; | 67 m_decodersDestroyed = 0; |
67 m_decodeRequestCount = 0; | 68 m_decodeRequestCount = 0; |
68 m_status = ImageFrame::FrameEmpty; | 69 m_status = ImageFrame::FrameEmpty; |
69 m_frameCount = 1; | 70 m_frameCount = 1; |
70 m_requestedClearExceptFrame = kNotFound; | 71 m_requestedClearExceptFrame = kNotFound; |
71 } | 72 } |
72 | 73 |
(...skipping 30 matching lines...) Expand all Loading... |
103 void setFrameStatus(ImageFrame::Status status) { | 104 void setFrameStatus(ImageFrame::Status status) { |
104 m_status = m_nextFrameStatus = status; | 105 m_status = m_nextFrameStatus = status; |
105 } | 106 } |
106 void setNextFrameStatus(ImageFrame::Status status) { | 107 void setNextFrameStatus(ImageFrame::Status status) { |
107 m_nextFrameStatus = status; | 108 m_nextFrameStatus = status; |
108 } | 109 } |
109 void setFrameCount(size_t count) { | 110 void setFrameCount(size_t count) { |
110 m_frameCount = count; | 111 m_frameCount = count; |
111 if (count > 1) { | 112 if (count > 1) { |
112 m_generator.clear(); | 113 m_generator.clear(); |
113 m_generator = ImageFrameGenerator::create(fullSize(), nullptr, true); | 114 m_generator = ImageFrameGenerator::create( |
| 115 fullSize(), true, ImageDecoder::ColorSpaceIgnored, nullptr); |
114 useMockImageDecoderFactory(); | 116 useMockImageDecoderFactory(); |
115 } | 117 } |
116 } | 118 } |
117 | 119 |
118 RefPtr<SharedBuffer> m_data; | 120 RefPtr<SharedBuffer> m_data; |
119 RefPtr<SegmentReader> m_segmentReader; | 121 RefPtr<SegmentReader> m_segmentReader; |
120 RefPtr<ImageFrameGenerator> m_generator; | 122 RefPtr<ImageFrameGenerator> m_generator; |
121 int m_decodersDestroyed; | 123 int m_decodersDestroyed; |
122 int m_decodeRequestCount; | 124 int m_decodeRequestCount; |
123 ImageFrame::Status m_status; | 125 ImageFrame::Status m_status; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // 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 |
253 // ImageFrameGenerator::tryToResumeDecode(). | 255 // ImageFrameGenerator::tryToResumeDecode(). |
254 m_generator->decodeAndScale(m_segmentReader.get(), true, 2, imageInfo(), | 256 m_generator->decodeAndScale(m_segmentReader.get(), true, 2, imageInfo(), |
255 buffer, 100 * 4); | 257 buffer, 100 * 4); |
256 EXPECT_EQ(3, m_decodeRequestCount); | 258 EXPECT_EQ(3, m_decodeRequestCount); |
257 EXPECT_EQ(0, m_decodersDestroyed); | 259 EXPECT_EQ(0, m_decodersDestroyed); |
258 EXPECT_EQ(kNotFound, m_requestedClearExceptFrame); | 260 EXPECT_EQ(kNotFound, m_requestedClearExceptFrame); |
259 } | 261 } |
260 | 262 |
261 } // namespace blink | 263 } // namespace blink |
OLD | NEW |