#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h"
#include <memory>
#include "base/strings/strcat.h"
#include "base/test/metrics/histogram_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/image-decoders/image_frame.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hasher.h"
namespace blink {
Vector<char> ReadFile(StringView file_name) { … }
Vector<char> ReadFile(const char* dir, const char* file_name) { … }
scoped_refptr<SharedBuffer> ReadFileToSharedBuffer(StringView file_name) { … }
scoped_refptr<SharedBuffer> ReadFileToSharedBuffer(const char* dir,
const char* file_name) { … }
unsigned HashBitmap(const SkBitmap& bitmap) { … }
void CreateDecodingBaseline(DecoderCreator create_decoder,
SharedBuffer* data,
Vector<unsigned>* baseline_hashes) { … }
void TestByteByByteDecode(DecoderCreator create_decoder,
SharedBuffer* shared_data,
size_t expected_frame_count,
int expected_repetition_count) { … }
static void TestRandomFrameDecode(DecoderCreator create_decoder,
SharedBuffer* full_data,
size_t skipping_step) { … }
static void TestRandomDecodeAfterClearFrameBufferCache(
DecoderCreator create_decoder,
SharedBuffer* data,
size_t skipping_step) { … }
static void TestDecodeAfterReallocatingData(DecoderCreator create_decoder,
SharedBuffer* data) { … }
static void TestByteByByteSizeAvailable(DecoderCreator create_decoder,
SharedBuffer* data,
size_t frame_offset,
bool has_color_space,
int expected_repetition_count) { … }
static void TestProgressiveDecoding(DecoderCreator create_decoder,
SharedBuffer* full_buffer,
size_t increment) { … }
void TestUpdateRequiredPreviousFrameAfterFirstDecode(
DecoderCreator create_decoder,
SharedBuffer* full_buffer) { … }
void TestByteByByteDecode(DecoderCreator create_decoder,
const char* file,
size_t expected_frame_count,
int expected_repetition_count) { … }
void TestByteByByteDecode(DecoderCreator create_decoder,
const char* dir,
const char* file,
size_t expected_frame_count,
int expected_repetition_count) { … }
void TestRandomFrameDecode(DecoderCreator create_decoder,
const char* file,
size_t skipping_step) { … }
void TestRandomFrameDecode(DecoderCreator create_decoder,
const char* dir,
const char* file,
size_t skipping_step) { … }
void TestRandomDecodeAfterClearFrameBufferCache(DecoderCreator create_decoder,
const char* file,
size_t skipping_step) { … }
void TestRandomDecodeAfterClearFrameBufferCache(DecoderCreator create_decoder,
const char* dir,
const char* file,
size_t skipping_step) { … }
void TestDecodeAfterReallocatingData(DecoderCreator create_decoder,
const char* file) { … }
void TestDecodeAfterReallocatingData(DecoderCreator create_decoder,
const char* dir,
const char* file) { … }
void TestByteByByteSizeAvailable(DecoderCreator create_decoder,
const char* file,
size_t frame_offset,
bool has_color_space,
int expected_repetition_count) { … }
void TestByteByByteSizeAvailable(DecoderCreator create_decoder,
const char* dir,
const char* file,
size_t frame_offset,
bool has_color_space,
int expected_repetition_count) { … }
void TestProgressiveDecoding(DecoderCreator create_decoder,
const char* file,
size_t increment) { … }
void TestProgressiveDecoding(DecoderCreator create_decoder,
const char* dir,
const char* file,
size_t increment) { … }
void TestUpdateRequiredPreviousFrameAfterFirstDecode(
DecoderCreator create_decoder,
const char* dir,
const char* file) { … }
void TestUpdateRequiredPreviousFrameAfterFirstDecode(
DecoderCreator create_decoder,
const char* file) { … }
static uint32_t PremultiplyColor(uint32_t c) { … }
static void VerifyFramesMatch(const char* file,
const ImageFrame* const a,
const ImageFrame* const b) { … }
void TestAlphaBlending(DecoderCreatorWithAlpha create_decoder,
const char* file) { … }
void TestBppHistogram(DecoderCreator create_decoder,
const char* image_type,
const char* image_name,
const char* histogram_name,
base::HistogramBase::Sample sample) { … }
}