Source release 16.2.0
This commit is contained in:
@@ -11,15 +11,15 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "cdm_engine.h"
|
||||
#include "config_test_env.h"
|
||||
#include "device_files.h"
|
||||
#include "initialization_data.h"
|
||||
#include "file_store.h"
|
||||
#include "initialization_data.h"
|
||||
#include "license_request.h"
|
||||
#include "log.h"
|
||||
#include "metrics.pb.h"
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "properties.h"
|
||||
#include "string_conversions.h"
|
||||
#include "test_base.h"
|
||||
@@ -63,11 +63,11 @@ class WvCdmEnginePreProvTest : public WvCdmTestBase {
|
||||
}
|
||||
|
||||
virtual void OpenSession() {
|
||||
CdmResponseType status =
|
||||
cdm_engine_.OpenSession(config_.key_system(), NULL, NULL, &session_id_);
|
||||
CdmResponseType status = cdm_engine_.OpenSession(
|
||||
config_.key_system(), nullptr, nullptr, &session_id_);
|
||||
if (status == NEED_PROVISIONING) {
|
||||
Provision();
|
||||
status = cdm_engine_.OpenSession(config_.key_system(), NULL, NULL,
|
||||
status = cdm_engine_.OpenSession(config_.key_system(), nullptr, nullptr,
|
||||
&session_id_);
|
||||
}
|
||||
ASSERT_EQ(status, NO_ERROR);
|
||||
@@ -177,12 +177,13 @@ class WvCdmEngineTest : public WvCdmEnginePreProvTest {
|
||||
CdmKeySetId key_set_id;
|
||||
|
||||
InitializationData init_data(init_data_type_string, key_id);
|
||||
if (g_cutoff >= LOG_DEBUG) init_data.DumpToLogs();
|
||||
|
||||
CdmKeyRequest key_request;
|
||||
|
||||
CdmResponseType result = cdm_engine_.GenerateKeyRequest(
|
||||
session_id_, key_set_id, init_data, license_type,
|
||||
app_parameters, &key_request);
|
||||
session_id_, key_set_id, init_data, license_type, app_parameters,
|
||||
&key_request);
|
||||
EXPECT_EQ(KEY_MESSAGE, result);
|
||||
|
||||
key_msg_ = key_request.message;
|
||||
@@ -261,16 +262,14 @@ class WvCdmEngineTest : public WvCdmEnginePreProvTest {
|
||||
|
||||
EXPECT_EQ(KEY_ADDED, status);
|
||||
EXPECT_EQ(expected_license_type, license_type);
|
||||
VerifyLicenseRequestLatency(kKeyRequestTypeInitial,
|
||||
*dummy_engine_metrics_);
|
||||
VerifyLicenseRequestLatency(kKeyRequestTypeInitial, *dummy_engine_metrics_);
|
||||
}
|
||||
|
||||
void VerifyRenewalKeyResponse(const std::string& server_url,
|
||||
const std::string& client_auth) {
|
||||
std::string resp = GetKeyRequestResponse(server_url, client_auth);
|
||||
EXPECT_EQ(KEY_ADDED, cdm_engine_.RenewKey(session_id_, resp));
|
||||
VerifyLicenseRequestLatency(kKeyRequestTypeRenewal,
|
||||
*dummy_engine_metrics_);
|
||||
VerifyLicenseRequestLatency(kKeyRequestTypeRenewal, *dummy_engine_metrics_);
|
||||
}
|
||||
|
||||
void VerifyLicenseRequestLatency(
|
||||
@@ -342,14 +341,10 @@ TEST_F(WvCdmEngineTest, SetLicensingServiceInvalidCertificate) {
|
||||
|
||||
TEST_F(WvCdmEnginePreProvTestStaging, ProvisioningTest) { Provision(); }
|
||||
|
||||
TEST_F(WvCdmEnginePreProvTestUatBinary, ProvisioningTest) {
|
||||
Provision();
|
||||
}
|
||||
TEST_F(WvCdmEnginePreProvTestUatBinary, ProvisioningTest) { Provision(); }
|
||||
|
||||
// Test that provisioning works.
|
||||
TEST_F(WvCdmEngineTest, ProvisioningTest) {
|
||||
Provision();
|
||||
}
|
||||
TEST_F(WvCdmEngineTest, ProvisioningTest) { Provision(); }
|
||||
|
||||
// Test that provisioning works, even if device is already provisioned.
|
||||
TEST_F(WvCdmEngineTest, ReprovisioningTest) {
|
||||
@@ -418,7 +413,6 @@ TEST_F(WvCdmEngineTest, LicenseRenewal) {
|
||||
}
|
||||
|
||||
TEST_F(WvCdmEngineTest, ParseDecryptHashStringTest) {
|
||||
|
||||
CdmSessionId session_id;
|
||||
uint32_t frame_number;
|
||||
std::string hash;
|
||||
@@ -428,13 +422,14 @@ TEST_F(WvCdmEngineTest, ParseDecryptHashStringTest) {
|
||||
const std::string test_frame_number_string =
|
||||
std::to_string(test_frame_number);
|
||||
const std::string test_invalid_hash = "an invalid hash";
|
||||
std::vector<uint8_t> binary_hash{ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0xFF };
|
||||
std::vector<uint8_t> binary_hash{0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0xFF};
|
||||
const std::string test_valid_decoded_hash(binary_hash.begin(),
|
||||
binary_hash.end());
|
||||
const std::string test_valid_hash = b2a_hex(binary_hash);
|
||||
const std::string test_invalid_hash_string = "sample hash string";
|
||||
const std::string test_valid_hash_string = test_session_id + kComma +
|
||||
test_frame_number_string + kComma + test_valid_hash;
|
||||
test_frame_number_string + kComma +
|
||||
test_valid_hash;
|
||||
|
||||
// invalid parameters
|
||||
EXPECT_EQ(PARAMETER_NULL,
|
||||
@@ -444,9 +439,8 @@ TEST_F(WvCdmEngineTest, ParseDecryptHashStringTest) {
|
||||
CdmEngine::ParseDecryptHashString(test_valid_hash_string,
|
||||
&session_id, nullptr, &hash));
|
||||
EXPECT_EQ(PARAMETER_NULL,
|
||||
CdmEngine::ParseDecryptHashString(test_valid_hash_string,
|
||||
&session_id, &frame_number,
|
||||
nullptr));
|
||||
CdmEngine::ParseDecryptHashString(
|
||||
test_valid_hash_string, &session_id, &frame_number, nullptr));
|
||||
|
||||
// Too few or too many parameters
|
||||
EXPECT_EQ(INVALID_DECRYPT_HASH_FORMAT,
|
||||
@@ -500,33 +494,31 @@ TEST_F(WvCdmEngineTest, ParseDecryptHashStringTest) {
|
||||
EXPECT_EQ(INVALID_DECRYPT_HASH_FORMAT,
|
||||
CdmEngine::ParseDecryptHashString(hash_data, &session_id,
|
||||
&frame_number, &hash));
|
||||
hash_data = test_session_id + kComma + test_frame_number_string + kComma +
|
||||
kComma;
|
||||
hash_data =
|
||||
test_session_id + kComma + test_frame_number_string + kComma + kComma;
|
||||
EXPECT_EQ(INVALID_DECRYPT_HASH_FORMAT,
|
||||
CdmEngine::ParseDecryptHashString(hash_data, &session_id,
|
||||
&frame_number, &hash));
|
||||
|
||||
// Invalid parameters (frame number, hash)
|
||||
hash_data = test_session_id + kComma + test_session_id + kComma +
|
||||
test_valid_hash;
|
||||
hash_data =
|
||||
test_session_id + kComma + test_session_id + kComma + test_valid_hash;
|
||||
EXPECT_EQ(INVALID_DECRYPT_HASH_FORMAT,
|
||||
CdmEngine::ParseDecryptHashString(hash_data, &session_id,
|
||||
&frame_number, &hash));
|
||||
hash_data = test_session_id + kComma + test_frame_number_string + kComma +
|
||||
test_invalid_hash;
|
||||
test_invalid_hash;
|
||||
EXPECT_EQ(INVALID_DECRYPT_HASH_FORMAT,
|
||||
CdmEngine::ParseDecryptHashString(hash_data, &session_id,
|
||||
&frame_number, &hash));
|
||||
|
||||
// valid data
|
||||
EXPECT_EQ(NO_ERROR,
|
||||
CdmEngine::ParseDecryptHashString(test_valid_hash_string,
|
||||
&session_id, &frame_number,
|
||||
&hash));
|
||||
CdmEngine::ParseDecryptHashString(
|
||||
test_valid_hash_string, &session_id, &frame_number, &hash));
|
||||
EXPECT_EQ(test_session_id, session_id);
|
||||
EXPECT_EQ(test_frame_number, frame_number);
|
||||
EXPECT_EQ(test_valid_decoded_hash, hash);
|
||||
}
|
||||
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
Reference in New Issue
Block a user