#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/data_decoder/image_decoder_impl.h"
#include <memory>
#include <vector>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/memory/raw_ptr.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
#include "mojo/public/cpp/bindings/binder_map.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "tools/v8_context_snapshot/buildflags.h"
#include "ui/gfx/codec/jpeg_codec.h"
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
#include "gin/v8_initializer.h"
#endif
namespace data_decoder {
namespace {
const int64_t kTestMaxImageSize = …;
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
#if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
constexpr gin::V8SnapshotFileType kSnapshotType = …;
#else
constexpr gin::V8SnapshotFileType kSnapshotType =
gin::V8SnapshotFileType::kDefault;
#endif
#endif
bool CreateJPEGImage(int width,
int height,
SkColor color,
std::vector<unsigned char>* output) { … }
class Request { … };
class BlinkInitializer : public blink::Platform { … };
base::LazyInstance<BlinkInitializer>::Leaky g_blink_initializer = …;
class ImageDecoderImplTest : public testing::Test { … };
}
TEST_F(ImageDecoderImplTest, DecodeImageSizeLimit) { … }
TEST_F(ImageDecoderImplTest, DecodeImageFailed) { … }
TEST_F(ImageDecoderImplTest, DecodeAnimationFailed) { … }
}