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