#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/cdm/cdm_adapter.h"
#include <stdint.h>
#include <memory>
#include "base/check.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
#include "media/base/cdm_callback_promise.h"
#include "media/base/cdm_factory.h"
#include "media/base/cdm_key_information.h"
#include "media/base/content_decryption_module.h"
#include "media/base/media_switches.h"
#include "media/base/mock_filters.h"
#include "media/cdm/api/content_decryption_module.h"
#include "media/cdm/cdm_module.h"
#include "media/cdm/external_clear_key_test_helper.h"
#include "media/cdm/library_cdm/cdm_host_proxy.h"
#include "media/cdm/library_cdm/mock_library_cdm.h"
#include "media/cdm/mock_helpers.h"
#include "media/cdm/simple_cdm_allocator.h"
#include "media/media_buildflags.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
Invoke;
IsNull;
NotNull;
Return;
Values;
SaveArg;
StrictMock;
_;
MATCHER(IsNotEmpty, "") { … }
MATCHER(IsNullTime, "") { … }
MATCHER(IsNullPlatformChallengeResponse, "") { … }
namespace media {
namespace {
const uint8_t kKeyId[] = …;
const char kKeyIdAsJWK[] = …;
const uint8_t kKeyIdAsPssh[] = …;
const char kKeyAsJWK[] = …;
class MockFileIOClient : public cdm::FileIOClient { … };
}
class CdmAdapterTestBase : public testing::Test,
public testing::WithParamInterface<int> { … };
class CdmAdapterTestWithClearKeyCdm : public CdmAdapterTestBase { … };
class CdmAdapterTestWithMockCdm : public CdmAdapterTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(CdmAdapterTestWithClearKeyCdm, Initialize) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, BadLibraryPath) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, CreateWebmSession) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, CreateKeyIdsSession) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, CreateCencSession) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, CreateSessionWithBadData) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, LoadSession) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, UpdateSession) { … }
TEST_P(CdmAdapterTestWithClearKeyCdm, UpdateSessionWithBadData) { … }
TEST_P(CdmAdapterTestWithMockCdm, ChallengePlatform) { … }
TEST_P(CdmAdapterTestWithMockCdm,
ChallengePlatform_DistinctiveIdentifierNotAllowed) { … }
TEST_P(CdmAdapterTestWithMockCdm, CreateFileIO) { … }
TEST_P(CdmAdapterTestWithMockCdm, CreateFileIO_PersistentStateNotAllowed) { … }
TEST_P(CdmAdapterTestWithMockCdm, RequestStorageId_Version_0) { … }
TEST_P(CdmAdapterTestWithMockCdm, RequestStorageId_Version_1) { … }
TEST_P(CdmAdapterTestWithMockCdm, RequestStorageId_Version_2) { … }
TEST_P(CdmAdapterTestWithMockCdm, RequestStorageId_PersistentStateNotAllowed) { … }
TEST_P(CdmAdapterTestWithMockCdm, GetDecryptor) { … }
}