#include "media/cdm/cbcs_decryptor.h"
#include <algorithm>
#include <array>
#include <memory>
#include <optional>
#include "base/containers/span.h"
#include "base/containers/to_vector.h"
#include "base/time/time.h"
#include "crypto/encryptor.h"
#include "crypto/symmetric_key.h"
#include "media/base/decoder_buffer.h"
#include "media/base/decrypt_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
namespace {
constexpr size_t kBlockSize = …;
const std::array<uint8_t, 16> kKey = …;
const std::array<uint8_t, 16> kIv = …;
const std::array<uint8_t, kBlockSize> kOneBlock = …;
const std::array<uint8_t, 6> kPartialBlock = …;
static_assert …;
std::string MakeString(const std::vector<uint8_t>& chars) { … }
std::vector<uint8_t> Combine(const std::vector<std::vector<uint8_t>>& inputs) { … }
std::vector<uint8_t> GetBlock(size_t n, const std::vector<uint8_t>& input) { … }
std::vector<uint8_t> Repeat(const std::vector<uint8_t>& input, size_t count) { … }
}
class CbcsDecryptorTest : public testing::Test { … };
TEST_F(CbcsDecryptorTest, OneBlock) { … }
TEST_F(CbcsDecryptorTest, AdditionalData) { … }
TEST_F(CbcsDecryptorTest, DifferentPattern) { … }
TEST_F(CbcsDecryptorTest, EmptyPattern) { … }
TEST_F(CbcsDecryptorTest, PatternTooLarge) { … }
TEST_F(CbcsDecryptorTest, NoSubsamples) { … }
TEST_F(CbcsDecryptorTest, BadSubsamples) { … }
TEST_F(CbcsDecryptorTest, InvalidIv) { … }
TEST_F(CbcsDecryptorTest, InvalidKey) { … }
TEST_F(CbcsDecryptorTest, PartialBlock) { … }
TEST_F(CbcsDecryptorTest, SingleBlockWithExtraData) { … }
TEST_F(CbcsDecryptorTest, SkipBlock) { … }
TEST_F(CbcsDecryptorTest, MultipleBlocks) { … }
TEST_F(CbcsDecryptorTest, PartialPattern) { … }
TEST_F(CbcsDecryptorTest, SkipBlocks) { … }
TEST_F(CbcsDecryptorTest, MultipleSubsamples) { … }
TEST_F(CbcsDecryptorTest, MultipleSubsamplesWithClearBytes) { … }
}