#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_validator.h"
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include "base/containers/span.h"
#include "base/containers/to_vector.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/test/gmock_expected_support.h"
#include "base/test/test_future.h"
#include "base/types/expected.h"
#include "chrome/browser/web_applications/isolated_web_apps/error/unusable_swbn_file_error.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_trust_checker.h"
#include "chrome/browser/web_applications/test/signed_web_bundle_utils.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
#include "components/web_package/mojom/web_bundle_parser.mojom.h"
#include "components/web_package/signed_web_bundles/ed25519_public_key.h"
#include "components/web_package/signed_web_bundles/ed25519_signature.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_id.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_integrity_block.h"
#include "components/web_package/test_support/signed_web_bundles/signature_verifier_test_utils.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace web_app {
namespace {
ErrorIs;
HasValue;
_;
Eq;
HasSubstr;
const char kSignedWebBundleId[] = …;
const char kAnotherSignedWebBundleId[] = …;
const std::string kUrl = …;
const std::string kUrlFromAnotherIsolatedWebApp = …;
constexpr std::array<uint8_t, 32> kPublicKeyBytes1 = …;
constexpr std::array<uint8_t, 32> kPublicKeyBytes2 = …;
}
class IsolatedWebAppValidatorTest : public ::testing::Test { … };
IsolatedWebAppValidatorIntegrityBlockTest;
TEST_F(IsolatedWebAppValidatorIntegrityBlockTest,
WebBundleIdAndPublicKeyDiffer) { … }
TEST_F(IsolatedWebAppValidatorIntegrityBlockTest, IWAIsTrusted) { … }
TEST_F(IsolatedWebAppValidatorIntegrityBlockTest, IWAIsUntrusted) { … }
class IsolatedWebAppValidatorMetadataTest
: public IsolatedWebAppValidatorTest,
public ::testing::WithParamInterface<
std::tuple<std::optional<std::string>,
std::vector<std::string>,
base::expected<void, UnusableSwbnFileError>>> { … };
TEST_P(IsolatedWebAppValidatorMetadataTest, Validate) { … }
INSTANTIATE_TEST_SUITE_P(…);
}