chromium/extensions/browser/image_sanitizer_unittest.cc

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

#include "extensions/browser/image_sanitizer.h"

#include <map>
#include <memory>

#include "base/base64.h"
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "content/public/test/browser_task_environment.h"
#include "extensions/browser/extension_file_task_runner.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace extensions {

namespace {

constexpr char kBase64edValidPng[] =;

constexpr char kBase64edInvalidPng[] =;

class TestClient : public ImageSanitizer::Client {};

class ImageSanitizerTest : public testing::Test {};

}  // namespace

TEST_F(ImageSanitizerTest, NoImagesProvided) {}

TEST_F(ImageSanitizerTest, InvalidPathAbsolute) {}

TEST_F(ImageSanitizerTest, InvalidPathReferenceParent) {}

TEST_F(ImageSanitizerTest, ValidCase) {}

TEST_F(ImageSanitizerTest, MissingImage) {}

TEST_F(ImageSanitizerTest, InvalidImage) {}

TEST_F(ImageSanitizerTest, NoCallbackAfterDelete) {}

// Ensures the sanitizer does not keep a reference to the callbacks to prevent
// memory leaks. (it's typical to have a ref counted object A own an
// ImageSanitizer which is given callbacks bound to A, creating a circular
// reference)
TEST_F(ImageSanitizerTest, DontHoldOnToCallbacksOnFailure) {}

TEST_F(ImageSanitizerTest, DontHoldOnToCallbacksOnSuccess) {}

// Tests that the callback is invoked if the data decoder service crashes.
TEST_F(ImageSanitizerTest, DataDecoderServiceCrashes) {}

}  // namespace extensions