chromium/components/image_fetcher/core/cached_image_fetcher_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 "components/image_fetcher/core/cached_image_fetcher.h"

#include <map>
#include <memory>
#include <string>
#include <utility>

#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "components/image_fetcher/core/cache/image_cache.h"
#include "components/image_fetcher/core/cache/image_data_store_disk.h"
#include "components/image_fetcher/core/cache/image_metadata_store_leveldb.h"
#include "components/image_fetcher/core/cache/proto/cached_image_metadata.pb.h"
#include "components/image_fetcher/core/fake_image_decoder.h"
#include "components/image_fetcher/core/image_fetcher_impl.h"
#include "components/image_fetcher/core/image_fetcher_metrics_reporter.h"
#include "components/image_fetcher/core/image_fetcher_types.h"
#include "components/leveldb_proto/testing/fake_db.h"
#include "components/prefs/testing_pref_service.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_unittest_util.h"

_;
FakeDB;

namespace image_fetcher {

class FakeImageDecoder;

namespace {

constexpr char kUmaClientName[] =;
constexpr char kImageData[] =;
constexpr char kImageDataOther[] =;

const char kImageFetcherEventHistogramName[] =;
const char kCacheLoadHistogramName[] =;
const char kNetworkLoadHistogramName[] =;

}  // namespace

class CachedImageFetcherTest : public testing::Test {};

MATCHER(EmptyImage, "") {}

MATCHER(NonEmptyImage, "") {}

MATCHER(NonEmptyString, "") {}

// TODO(wylieb): Write a test that creates two CachedImageFetcher and tests
// that they both can use what's inside.
TEST_F(CachedImageFetcherTest, FetchImageFromCache) {}

TEST_F(CachedImageFetcherTest, FetchImageFromCacheNeedsTranscoding) {}

TEST_F(CachedImageFetcherTest, FetchImageFromCacheReadOnly) {}

TEST_F(CachedImageFetcherTest, FetchImagePopulatesCache) {}

TEST_F(CachedImageFetcherTest, FetchImagePopulatesCacheReadOnly) {}

TEST_F(CachedImageFetcherTest, FetchImageWithoutTranscodingDoesNotDecode) {}

TEST_F(CachedImageFetcherTest, FetchImageWithSkipDiskCache) {}

}  // namespace image_fetcher