#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/web_applications/web_app_install_utils.h"
#include <stddef.h>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/web_applications/os_integration/os_integration_manager.h"
#include "chrome/browser/web_applications/os_integration/web_app_file_handler_manager.h"
#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_icon_generator.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "components/services/app_service/public/cpp/icon_info.h"
#include "components/services/app_service/public/cpp/protocol_handler_info.h"
#include "components/services/app_service/public/cpp/share_target.h"
#include "components/services/app_service/public/cpp/url_handler_info.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/blink/public/common/permissions_policy/origin_with_possible_wildcards.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-shared.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-shared.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_unittest_util.h"
#include "ui/gfx/skia_util.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace web_app {
Purpose;
namespace {
const char16_t kAppTestShortName[] = …;
const char16_t kAppTestTitle[] = …;
const char16_t kAlternativeAppTestTitle[] = …;
const char16_t kShortcutItemTestName[] = …;
constexpr SquareSizePx kIconSize = …;
constexpr unsigned int kNumTestIcons = …;
IconPurpose IconInfoPurposeToManifestPurpose(
apps::IconInfo::Purpose icon_info_purpose) { … }
GURL StartUrl() { … }
WebAppInstallInfo CreateWebAppInstallInfo() { … }
WebAppInstallInfo CreateWebAppInstallInfoFromStartUrl(const GURL& start_url) { … }
}
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_EmptyName) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_MaskableIcon) { … }
TEST(WebAppInstallUtils,
UpdateWebAppInfoFromManifest_MaskableIconOnly_UsesManifestIcons) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_ShareTarget) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifestWithShortcuts) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifestTooManyShortcuts) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifestTooManyIcons) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifestTooManyShortcutIcons) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifestIconsTooLarge) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifestShortcutIconsTooLarge) { … }
TEST(WebAppInstallUtils,
UpdateWebAppInfoFromManifest_CrossOriginUrls_DropsFields) { … }
TEST(WebAppInstallUtils,
UpdateWebAppInfoFromManifest_WithoutLockscreenFlag_DropsField) { … }
TEST(WebAppInstallUtils, PopulateShortcutItemIcons) { … }
TEST(WebAppInstallUtils, PopulateShortcutItemIconsNoShortcutIcons) { … }
TEST(WebAppInstallUtils, PopulateProductIcons_MaskableIcons) { … }
TEST(WebAppInstallUtils, PopulateProductIcons_MaskableIconsOnly) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_InvalidManifestUrl) { … }
TEST(WebAppInstallUtils, PopulateProductIconsNoWebAppIconData_WithShortcuts) { … }
TEST(WebAppInstallUtils, PopulateProductIcons_IsGeneratedIcon) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_Translations) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest_TabStrip) { … }
TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifestHomeTabIcons_TabStrip) { … }
TEST(WebAppInstallUtils, PopulateHomeTabIconsNoHomeTabIcons_TabStrip) { … }
TEST(WebAppInstallUtils, PopulateHomeTabIcons_TabStrip) { … }
TEST(WebAppInstallUtils, PopulateAnyIconsCorrectlyManifestParsingSVGOnly) { … }
class FileHandlersFromManifestTest : public ::testing::TestWithParam<bool> { … };
TEST_P(FileHandlersFromManifestTest, Basic) { … }
TEST_P(FileHandlersFromManifestTest, PopulateFileHandlerIcons) { … }
TEST_P(FileHandlersFromManifestTest, PopulateFileHandlingAndHomeTabIcons) { … }
TEST(WebAppInstallUtils, DuplicateIconDownloadURLs) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST(WebAppInstallUtils, SetWebAppManifestFields_Summary) { … }
TEST(WebAppInstallUtils, SetWebAppManifestFields_ShareTarget) { … }
}