#include "chrome/browser/ui/webui/favicon_source.h"
#include <memory>
#include <utility>
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/strcat.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/favicon/history_ui_favicon_request_handler_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "components/favicon/core/history_ui_favicon_request_handler.h"
#include "components/favicon/core/test/mock_favicon_service.h"
#include "components/favicon_base/favicon_url_parser.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/manifest.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/native_theme/test_native_theme.h"
#include "ui/resources/grit/ui_resources.h"
GotDataCallback;
WebContentsGetter;
_;
NiceMock;
Return;
ReturnArg;
namespace {
const int kDummyTaskId = …;
const char kDummyPrefix[] = …;
}
class MockHistoryUiFaviconRequestHandler
: public favicon::HistoryUiFaviconRequestHandler { … };
class TestFaviconSource : public FaviconSource { … };
class FaviconSourceTestBase : public testing::Test { … };
class FaviconSourceTestWithLegacyFormat : public FaviconSourceTestBase { … };
class FaviconSourceTestWithFavicon2Format : public FaviconSourceTestBase { … };
TEST_F(FaviconSourceTestWithLegacyFormat, DarkDefault) { … }
TEST_F(FaviconSourceTestWithLegacyFormat, LightDefault) { … }
TEST_F(FaviconSourceTestWithLegacyFormat,
ShouldNotQueryHistoryUiFaviconRequestHandler) { … }
TEST_F(FaviconSourceTestWithLegacyFormat, ShouldNotQueryIfDesiredSizeTooLarge) { … }
TEST_F(FaviconSourceTestWithLegacyFormat, ShouldNotQueryIfInvalidScaleFactor) { … }
TEST_F(FaviconSourceTestWithFavicon2Format,
ShouldNotRecordFaviconResourceHistogram) { … }
TEST_F(FaviconSourceTestWithFavicon2Format, DarkDefault) { … }
TEST_F(FaviconSourceTestWithFavicon2Format, LightDefault) { … }
TEST_F(FaviconSourceTestWithFavicon2Format, LightOverride) { … }
TEST_F(FaviconSourceTestWithFavicon2Format,
ShouldNotQueryHistoryUiFaviconRequestHandlerIfNotAllowed) { … }
TEST_F(FaviconSourceTestWithFavicon2Format,
ShouldNotQueryHistoryUiFaviconRequestHandlerIfHasNotHistoryUiOrigin) { … }
TEST_F(
FaviconSourceTestWithFavicon2Format,
ShouldQueryHistoryUiFaviconRequestHandlerIfHasHistoryUiOriginAndAllowed) { … }
TEST_F(FaviconSourceTestWithFavicon2Format,
ShouldNotQueryIfDesiredSizeTooLarge) { … }
TEST_F(FaviconSourceTestWithFavicon2Format,
ShouldNotQueryIfInvalidScaleFactor) { … }