| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "wtf/Vector.h" | 5 #include "wtf/Vector.h" |
| 6 #include <memory> | 6 #include <memory> |
| 7 | 7 |
| 8 class SkBitmap; | 8 class SkBitmap; |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 class ImageDecoder; | 11 class ImageDecoder; |
| 12 class SharedBuffer; | 12 class SharedBuffer; |
| 13 | 13 |
| 14 const char decodersTestingDir[] = "Source/platform/image-decoders/testing"; | 14 const char decodersTestingDir[] = "Source/platform/image-decoders/testing"; |
| 15 | 15 |
| 16 using DecoderCreator = std::unique_ptr<ImageDecoder> (*)(); | 16 using DecoderCreator = std::unique_ptr<ImageDecoder> (*)(); |
| 17 PassRefPtr<SharedBuffer> readFile(const char* fileName); | 17 PassRefPtr<SharedBuffer> readFile(const char* fileName); |
| 18 PassRefPtr<SharedBuffer> readFile(const char* dir, const char* fileName); | 18 PassRefPtr<SharedBuffer> readFile(const char* dir, const char* fileName); |
| 19 unsigned hashBitmap(const SkBitmap&); | 19 unsigned hashBitmap(const SkBitmap&); |
| 20 void createDecodingBaseline(DecoderCreator, | 20 void createDecodingBaseline(DecoderCreator, |
| 21 SharedBuffer*, | 21 SharedBuffer*, |
| 22 Vector<unsigned>* baselineHashes); | 22 Vector<unsigned>* baselineHashes); |
| 23 |
| 23 void testByteByByteDecode(DecoderCreator createDecoder, | 24 void testByteByByteDecode(DecoderCreator createDecoder, |
| 24 const char* file, | 25 const char* file, |
| 25 size_t expectedFrameCount, | 26 size_t expectedFrameCount, |
| 26 int expectedRepetitionCount); | 27 int expectedRepetitionCount); |
| 28 void testByteByByteDecode(DecoderCreator createDecoder, |
| 29 const char* dir, |
| 30 const char* file, |
| 31 size_t expectedFrameCount, |
| 32 int expectedRepetitionCount); |
| 33 |
| 27 void testMergeBuffer(DecoderCreator createDecoder, const char* file); | 34 void testMergeBuffer(DecoderCreator createDecoder, const char* file); |
| 35 void testMergeBuffer(DecoderCreator createDecoder, |
| 36 const char* dir, |
| 37 const char* file); |
| 38 |
| 39 // |skippingStep| is used to randomize the decoding order. For images with |
| 40 // a small number of frames (e.g. < 10), this value should be smaller, on the |
| 41 // order of (number of frames) / 2. |
| 42 void testRandomFrameDecode(DecoderCreator, |
| 43 const char* file, |
| 44 size_t skippingStep = 5); |
| 45 void testRandomFrameDecode(DecoderCreator, |
| 46 const char* dir, |
| 47 const char* file, |
| 48 size_t skippingStep = 5); |
| 49 |
| 50 // |skippingStep| is used to randomize the decoding order. For images with |
| 51 // a small number of frames (e.g. < 10), this value should be smaller, on the |
| 52 // order of (number of frames) / 2. |
| 53 void testRandomDecodeAfterClearFrameBufferCache(DecoderCreator, |
| 54 const char* file, |
| 55 size_t skippingStep = 5); |
| 56 void testRandomDecodeAfterClearFrameBufferCache(DecoderCreator, |
| 57 const char* dir, |
| 58 const char* file, |
| 59 size_t skippingStep = 5); |
| 60 |
| 61 void testDecodeAfterReallocatingData(DecoderCreator, const char* file); |
| 62 void testDecodeAfterReallocatingData(DecoderCreator, |
| 63 const char* dir, |
| 64 const char* file); |
| 65 void testByteByByteSizeAvailable(DecoderCreator, |
| 66 const char* file, |
| 67 size_t frameOffset, |
| 68 bool hasColorSpace, |
| 69 int expectedRepetitionCount); |
| 70 void testByteByByteSizeAvailable(DecoderCreator, |
| 71 const char* dir, |
| 72 const char* file, |
| 73 size_t frameOffset, |
| 74 bool hasColorSpace, |
| 75 int expectedRepetitionCount); |
| 76 |
| 77 // Data is provided in chunks of length |increment| to the decoder. This value |
| 78 // can be increased to reduce processing time. |
| 79 void testProgressiveDecoding(DecoderCreator, |
| 80 const char* file, |
| 81 size_t increment = 1); |
| 82 void testProgressiveDecoding(DecoderCreator, |
| 83 const char* dir, |
| 84 const char* file, |
| 85 size_t increment = 1); |
| 28 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |