#include "chrome/browser/apps/app_service/app_icon/app_icon_test_util.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "chrome/browser/apps/app_service/app_icon/app_icon_factory.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/resource/resource_scale_factor.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/image/image_unittest_util.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/test/base/testing_profile.h"
#endif
namespace apps {
void EnsureRepresentationsLoaded(gfx::ImageSkia& output_image_skia) { … }
void LoadDefaultIcon(gfx::ImageSkia& output_image_skia, int resource_id) { … }
void VerifyIcon(const gfx::ImageSkia& src, const gfx::ImageSkia& dst) { … }
void VerifyCompressedIcon(const std::vector<uint8_t>& src_data,
const apps::IconValue& icon) { … }
gfx::ImageSkia CreateSquareIconImageSkia(int size_dp, SkColor solid_color) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
FakeIconLoader::FakeIconLoader(apps::AppServiceProxy* proxy) : proxy_(proxy) {}
std::unique_ptr<apps::IconLoader::Releaser> FakeIconLoader::LoadIconFromIconKey(
const std::string& id,
const apps::IconKey& icon_key,
apps::IconType icon_type,
int32_t size_in_dip,
bool allow_placeholder_icon,
apps::LoadIconCallback callback) {
if (proxy_) {
proxy_->ReadIconsForTesting(proxy_->AppRegistryCache().GetAppType(id), id,
size_in_dip, icon_key, icon_type,
std::move(callback));
}
return nullptr;
}
FakePublisherForIconTest::FakePublisherForIconTest(apps::AppServiceProxy* proxy,
apps::AppType app_type)
: AppPublisher(proxy) {
RegisterPublisher(app_type);
}
void FakePublisherForIconTest::GetCompressedIconData(
const std::string& app_id,
int32_t size_in_dip,
ui::ResourceScaleFactor scale_factor,
apps::LoadIconCallback callback) {
apps::GetWebAppCompressedIconData(proxy()->profile(), app_id, size_in_dip,
scale_factor, std::move(callback));
}
#endif
}