#include "chrome/browser/ui/views/autofill/popup/password_favicon_loader.h"
#include <memory>
#include "base/memory/ref_counted_memory.h"
#include "base/test/mock_callback.h"
#include "chrome/test/base/testing_profile.h"
#include "components/autofill/core/browser/ui/suggestion.h"
#include "components/favicon/core/large_icon_service.h"
#include "components/favicon_base/favicon_types.h"
#include "components/image_fetcher/core/image_fetcher.h"
#include "components/image_fetcher/core/image_fetcher_types.h"
#include "components/image_fetcher/core/mock_image_fetcher.h"
#include "components/image_fetcher/core/request_metadata.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_unittest_util.h"
#include "ui/resources/grit/ui_resources.h"
namespace autofill {
namespace {
class MockLargeIconService : public favicon::LargeIconService { … };
MATCHER_P(ImagesAreEqual, img, "") { … }
favicon_base::LargeIconResult GetFaviconResult(const gfx::Image& image) { … }
auto MockGetLargeIcon(
testing::OnceAction<void(favicon_base::LargeIconCallback callback)>
callback_handler) { … }
auto MockFetchImageAndData(
testing::OnceAction<void(image_fetcher::ImageFetcherCallback* callback)>
callback_handler) { … }
}
class PasswordFaviconLoaderTest : public testing::Test { … };
TEST_F(PasswordFaviconLoaderTest, LoadsImagesFromFaviconService) { … }
TEST_F(PasswordFaviconLoaderTest, FailsWithInvalidResponseFromFaviconService) { … }
TEST_F(PasswordFaviconLoaderTest, LoadsImagesFromImageFetcher) { … }
TEST_F(PasswordFaviconLoaderTest, FailsWithInvalidResponseFromImageFetcher) { … }
TEST_F(PasswordFaviconLoaderTest, ImagesFromFaviconServiceAreCached) { … }
TEST_F(PasswordFaviconLoaderTest, ImagesFromImageFetcherAreCached) { … }
}