#include "chrome/browser/web_applications/isolated_web_apps/update_manifest/update_manifest.h"
#include <optional>
#include <string>
#include "base/json/json_reader.h"
#include "base/test/gmock_expected_support.h"
#include "base/types/expected.h"
#include "base/values.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/network/public/cpp/network_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace web_app {
namespace {
ErrorIs;
HasValue;
ValueIs;
ElementsAre;
Eq;
IsEmpty;
IsFalse;
IsTrue;
Not;
Optional;
Property;
TEST(UpdateChannelId, DefaultChannelId) { … }
UpdateChannelIdCreateInvalidTest;
TEST_P(UpdateChannelIdCreateInvalidTest, Check) { … }
INSTANTIATE_TEST_SUITE_P(…);
UpdateChannelIdCreateValidTest;
TEST_P(UpdateChannelIdCreateValidTest, Check) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST(UpdateManifestTest, FailsToParseManifestWithoutKeys) { … }
TEST(UpdateManifestTest, FailsToParseManifestWithoutVersions) { … }
TEST(UpdateManifestTest, FailsToParseManifestThatIsNotDict) { … }
TEST(UpdateManifestTest, ParsesManifestWithEmptyVersions) { … }
TEST(UpdateManifestTest, ParsesManifestWithAdditionalKeys) { … }
TEST(UpdateManifestTest, ParsesManifestWithVersion) { … }
TEST(UpdateManifestTest, ParsesManifestWithRelativeSrc) { … }
TEST(UpdateManifestTest, ParsesManifestWithRelativeSrc2) { … }
TEST(UpdateManifestTest, IgnoresVersionsWithoutUrl) { … }
TEST(UpdateManifestTest, IgnoresVersionsWithoutSrc) { … }
TEST(UpdateManifestTest, ParsesManifestWithAdditionalVersionKeys) { … }
TEST(UpdateManifestTest, ParsesManifestWithVersionChannels) { … }
TEST(UpdateManifestTest, IgnoresChannelOrder) { … }
TEST(UpdateManifestTest, DoesNotAllowEmptyChannels) { … }
TEST(UpdateManifestTest, ParsesManifestWithMultipleVersions) { … }
TEST(UpdateManifestTest, OverwritesRepeatedEntriesWithSameVersion) { … }
class UpdateManifestValidVersionTest
: public testing::TestWithParam<std::string> { … };
TEST_P(UpdateManifestValidVersionTest, ParsesValidVersion) { … }
INSTANTIATE_TEST_SUITE_P(…);
UpdateManifestInvalidVersionTest;
TEST_P(UpdateManifestInvalidVersionTest, IgnoresEntriesWithInvalidVersions) { … }
INSTANTIATE_TEST_SUITE_P(…);
UpdateManifestValidSrcTest;
TEST_P(UpdateManifestValidSrcTest, ParsesValidSrc) { … }
INSTANTIATE_TEST_SUITE_P(…);
UpdateManifestInvalidSrcTest;
TEST_P(UpdateManifestInvalidSrcTest, IgnoresEntriesWithInvalidSrc) { … }
INSTANTIATE_TEST_SUITE_P(…);
class UpdateManifestSecureOriginAllowlistTest : public ::testing::Test { … };
TEST_F(UpdateManifestSecureOriginAllowlistTest, CanSetHttpOriginsAsTrusted) { … }
TEST(GetLatestVersionTest, CalculatesLatestVersionCorrectly) { … }
TEST(GetLatestVersionTest, CalculatesLatestVersionForChannel) { … }
TEST(UpdateManifestParsesChannelMetadataTest, ChannelsMissing) { … }
TEST(UpdateManifestParsesChannelMetadataTest, EmptyChannelMetadata) { … }
TEST(UpdateManifestParsesChannelMetadataTest, ChannelsNotADict) { … }
TEST(UpdateManifestParsesChannelMetadataTest, ChannelNotADict) { … }
TEST(UpdateManifestParsesChannelMetadataTest, ChannelMetadataWithoutName) { … }
TEST(UpdateManifestParsesChannelMetadataTest,
ChannelMetadataWithAdditionalField) { … }
TEST(UpdateManifestParsesChannelMetadataTest, ChannelName) { … }
}
}