#include "media/base/key_systems.h"
#include <optional>
#include <string>
#include <vector>
#include "base/check.h"
#include "base/notreached.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "media/base/audio_parameters.h"
#include "media/base/decrypt_config.h"
#include "media/base/eme_constants.h"
#include "media/base/key_systems_impl.h"
#include "media/base/media.h"
#include "media/base/media_client.h"
#include "media/cdm/clear_key_cdm_common.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
namespace media {
namespace {
const char kUsesAes[] = …;
const char kExternal[] = …;
const char kAudioWebM[] = …;
const char kVideoWebM[] = …;
const char kAudioFoo[] = …;
const char kVideoFoo[] = …;
const char kRobustnessSupported[] = …;
const char kRobustnessSecureCodecsRequired[] = …;
const char kRobustnessNotSupported[] = …;
enum TestCodec : uint32_t { … };
static_assert …;
class TestKeySystemInfoBase : public KeySystemInfo { … };
class AesKeySystemInfo : public TestKeySystemInfoBase { … };
class ExternalKeySystemInfo : public TestKeySystemInfoBase { … };
class TestMediaClient : public MediaClient { … };
TestMediaClient::TestMediaClient() = default;
TestMediaClient::~TestMediaClient() = default;
std::unique_ptr<::media::KeySystemSupportRegistration>
TestMediaClient::GetSupportedKeySystems(GetSupportedKeySystemsCB cb) { … }
bool TestMediaClient::IsSupportedAudioType(const AudioType& type) { … }
bool TestMediaClient::IsSupportedVideoType(const VideoType& type) { … }
bool TestMediaClient::IsSupportedBitstreamAudioCodec(AudioCodec codec) { … }
ExternalMemoryAllocator* TestMediaClient::GetMediaAllocator() { … }
void TestMediaClient::DisableExternalKeySystemSupport() { … }
std::optional<AudioRendererAlgorithmParameters>
TestMediaClient::GetAudioRendererAlgorithmParameters(
AudioParameters audio_parameters) { … }
KeySystemInfos TestMediaClient::GetSupportedKeySystemsInternal() { … }
}
class KeySystemsTest : public testing::Test { … };
TEST_F(KeySystemsTest, EmptyKeySystem) { … }
TEST_F(KeySystemsTest, ClearKey) { … }
TEST_F(KeySystemsTest, ClearKeyWithInitDataType) { … }
TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { … }
TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) { … }
TEST_F(KeySystemsTest,
IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer1) { … }
TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { … }
TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { … }
TEST_F(KeySystemsTest,
IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer2) { … }
TEST_F(KeySystemsTest,
IsSupportedKeySystem_UsesAesDecryptor_EncryptionSchemes) { … }
TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { … }
TEST_F(
KeySystemsTest,
IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) { … }
TEST_F(
KeySystemsTest,
IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer2) { … }
TEST_F(KeySystemsTest,
IsSupportedKeySystem_ExternalDecryptor_EncryptionSchemes) { … }
TEST_F(KeySystemsTest, KeySystemNameForUMA) { … }
TEST_F(KeySystemsTest, KeySystemsUpdate) { … }
TEST_F(KeySystemsTest, GetContentTypeConfigRule) { … }
TEST_F(KeySystemsTest, HardwareSecureCodecs) { … }
}