Source release 18.1.0
This commit is contained in:
@@ -48,19 +48,27 @@ class WvCdmTestBase : public ::testing::Test {
|
||||
// Calls Provision() if not already provisioned.
|
||||
virtual void EnsureProvisioned();
|
||||
|
||||
// Fill a buffer with some nonconstant data of the given size. The first byte
|
||||
// will be set to <init> to help you find the buffer when debugging.
|
||||
// Locate the portion of the server's provisioning response message that is
|
||||
// between the strings jason_start_substr and json_end_substr. Returns the
|
||||
// string through *result. If the start substring match fails, assume the
|
||||
// entire string represents a serialized protobuf mesaage and return true with
|
||||
// the entire string. If the end_substring match fails, return false with an
|
||||
// empty *result.
|
||||
bool ExtractSignedMessage(const std::string& response, std::string* result);
|
||||
|
||||
// Fill a buffer with some nonconstant data of the given size. The first
|
||||
// byte will be set to <init> to help you find the buffer when debugging.
|
||||
static void StripeBuffer(std::vector<uint8_t>* buffer, size_t size,
|
||||
uint8_t init);
|
||||
|
||||
// Helper method for doing cryptography.
|
||||
static std::string Aes128CbcEncrypt(std::vector<uint8_t> key,
|
||||
const std::vector<uint8_t>& clear,
|
||||
const std::vector<uint8_t> iv);
|
||||
std::vector<uint8_t> iv);
|
||||
// Helper method for doing cryptography.
|
||||
static std::string Aes128CbcDecrypt(std::vector<uint8_t> key,
|
||||
const std::vector<uint8_t>& clear,
|
||||
const std::vector<uint8_t> iv);
|
||||
std::vector<uint8_t> iv);
|
||||
// Helper method for doing cryptography.
|
||||
static std::string SignHMAC(const std::string& message,
|
||||
const std::vector<uint8_t>& key);
|
||||
@@ -104,12 +112,28 @@ class WvCdmTestBaseWithEngine : public WvCdmTestBase {
|
||||
TestCdmEngine cdm_engine_;
|
||||
};
|
||||
|
||||
struct TestCryptoSessionConfig {
|
||||
// Disables newly created TestCryptoSession instances from installing
|
||||
// a test keybox.
|
||||
bool disable_test_keybox = false;
|
||||
};
|
||||
|
||||
class TestCryptoSession : public CryptoSession {
|
||||
public:
|
||||
explicit TestCryptoSession(metrics::CryptoMetrics* crypto_metrics);
|
||||
TestCryptoSession(metrics::CryptoMetrics* crypto_metrics,
|
||||
const TestCryptoSessionConfig* config);
|
||||
// This intercepts nonce flood errors, which is useful for tests that request
|
||||
// many nonces and are not time critical.
|
||||
CdmResponseType GenerateNonce(uint32_t* nonce) override;
|
||||
|
||||
private:
|
||||
// Called once when TestCryptoSession is constructed.
|
||||
void MaybeInstallTestKeybox();
|
||||
bool IsTestKeyboxNeeded();
|
||||
|
||||
// An un-owned pointer to the config.
|
||||
const TestCryptoSessionConfig* const config_ = nullptr;
|
||||
};
|
||||
|
||||
// Given a PSSH data structure, this makes a PSSH string for use in
|
||||
|
||||
Reference in New Issue
Block a user