chromium/third_party/blink/renderer/platform/image-decoders/image_decoder_base_test.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/image-decoders/image_decoder_base_test.h"

#include <stddef.h>

#include <memory>

#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/hash/md5.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/platform/image-decoders/image_decoder.h"

// Uncomment this to recalculate the MD5 sums; see header comments.
// #define CALCULATE_MD5_SUMS

namespace {

const int kFirstFrameIndex =;

// Determine if we should test with file specified by |path| based
// on |file_selection| and the |threshold| for the file size.
bool ShouldSkipFile(const base::FilePath& path,
                    blink::ImageDecoderBaseTest::FileSelection file_selection,
                    const int64_t threshold) {}

void ReadFileToVector(const base::FilePath& path, Vector<char>* contents) {}

base::MD5Digest ComputeMD5Sum(const blink::ImageFrame& frame_buffer) {}

#if defined(CALCULATE_MD5_SUMS)
void SaveMD5Sum(const base::FilePath& path,
                const blink::ImageFrame* frame_buffer) {
  // Calculate MD5 sum.
  ASSERT_TRUE(frame_buffer);
  base::MD5Digest digest = ComputeMD5Sum(*frame_buffer);

  // Write sum to disk.
  ASSERT_TRUE(base::WriteFile(path, base::byte_span_from_ref(digest)));
}
#endif

#if !defined(CALCULATE_MD5_SUMS)
void VerifyImage(blink::ImageDecoder& decoder,
                 const base::FilePath& path,
                 const base::FilePath& md5_sum_path,
                 size_t frame_index) {}
#endif

}  // namespace

namespace blink {

void ImageDecoderBaseTest::SetUp() {}

base::FilePath ImageDecoderBaseTest::GetMD5SumPath(const base::FilePath& path) {}

Vector<base::FilePath> ImageDecoderBaseTest::GetImageFiles() const {}

bool ImageDecoderBaseTest::ShouldImageFail(const base::FilePath& path) const {}

void ImageDecoderBaseTest::TestDecoding(
    blink::ImageDecoderBaseTest::FileSelection file_selection,
    const int64_t threshold) {}

void ImageDecoderBaseTest::TestImageDecoder(const base::FilePath& image_path,
                                            const base::FilePath& md5_sum_path,
                                            int desired_frame_index) const {}

}  // namespace blink