chromium/components/ntp_tiles/icon_cacher_impl_unittest.cc

// Copyright 2016 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/ntp_tiles/icon_cacher_impl.h"

#include <memory>
#include <utility>

#include "base/containers/flat_set.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/test/test_simple_task_runner.h"
#include "build/build_config.h"
#include "components/favicon/core/favicon_client.h"
#include "components/favicon/core/favicon_service_impl.h"
#include "components/favicon/core/favicon_util.h"
#include "components/favicon/core/large_icon_service_impl.h"
#include "components/favicon_base/favicon_types.h"
#include "components/history/core/browser/history_database_params.h"
#include "components/history/core/browser/history_service.h"
#include "components/image_fetcher/core/fake_image_decoder.h"
#include "components/image_fetcher/core/image_decoder.h"
#include "components/image_fetcher/core/image_fetcher.h"
#include "components/image_fetcher/core/mock_image_fetcher.h"
#include "components/image_fetcher/core/request_metadata.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/resource/mock_resource_bundle_delegate.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "ui/gfx/image/image_unittest_util.h"

Bucket;
ImageFetcherParams;
MockImageFetcher;
_;
ElementsAre;
Eq;
InSequence;
Invoke;
IsEmpty;
NiceMock;
Return;
ReturnArg;

namespace ntp_tiles {
namespace {

const int kTestDipForServerRequests =;
const favicon_base::IconType kTestIconTypeForServerRequests =;
const char kTestGoogleServerClientParam[] =;

ACTION(FailFetch) {}

ACTION_P2(PassFetch, width, height) {}

ACTION_P(Quit, run_loop) {}

// TODO(jkrcal): Split off large_icon_service.h and large_icon_service_impl.h.
// Use then mocks of FaviconService and LargeIconService instead of the real
// things.
class IconCacherTestBase : public ::testing::Test {};

class IconCacherTestPopularSites : public IconCacherTestBase {};

TEST_F(IconCacherTestPopularSites, LargeCached) {}

TEST_F(IconCacherTestPopularSites, LargeNotCachedAndFetchSucceeded) {}

TEST_F(IconCacherTestPopularSites, SmallNotCachedAndFetchSucceeded) {}

TEST_F(IconCacherTestPopularSites, LargeNotCachedAndFetchFailed) {}

TEST_F(IconCacherTestPopularSites, HandlesEmptyCallbacksNicely) {}

TEST_F(IconCacherTestPopularSites, ProvidesDefaultIconAndSucceedsWithFetching) {}

TEST_F(IconCacherTestPopularSites, LargeNotCachedAndFetchPerformedOnlyOnce) {}

class IconCacherTestMostLikely : public IconCacherTestBase {};

TEST_F(IconCacherTestMostLikely, Cached) {}

TEST_F(IconCacherTestMostLikely, NotCachedAndFetchSucceeded) {}

TEST_F(IconCacherTestMostLikely, NotCachedAndFetchFailed) {}

TEST_F(IconCacherTestMostLikely, HandlesEmptyCallbacksNicely) {}

TEST_F(IconCacherTestMostLikely, NotCachedAndFetchPerformedOnlyOnce) {}

}  // namespace
}  // namespace ntp_tiles