Merge "Address CDM request license unit test failures" into lmp-dev
This commit is contained in:
@@ -586,9 +586,17 @@ class WvCdmRequestLicenseTest : public testing::Test {
|
|||||||
EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL3));
|
EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Provision() {
|
void Provision(SecurityLevel level) {
|
||||||
|
TestWvCdmClientPropertySet property_set_L3;
|
||||||
|
TestWvCdmClientPropertySet* property_set = NULL;
|
||||||
|
|
||||||
|
if (kLevel3 == level) {
|
||||||
|
property_set_L3.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
|
||||||
|
property_set = &property_set_L3;
|
||||||
|
}
|
||||||
|
|
||||||
CdmResponseType status =
|
CdmResponseType status =
|
||||||
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
decryptor_.OpenSession(g_key_system, property_set, &session_id_);
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case NO_ERROR:
|
case NO_ERROR:
|
||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
@@ -906,7 +914,7 @@ TEST_F(WvCdmRequestLicenseTest, AddStreamingKeyTest) {
|
|||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, AddKeyOfflineTest) {
|
TEST_F(WvCdmRequestLicenseTest, AddKeyOfflineTest) {
|
||||||
Unprovision();
|
Unprovision();
|
||||||
Provision();
|
Provision(kLevelDefault);
|
||||||
|
|
||||||
// override default settings unless configured through the command line
|
// override default settings unless configured through the command line
|
||||||
std::string key_id;
|
std::string key_id;
|
||||||
@@ -921,7 +929,7 @@ TEST_F(WvCdmRequestLicenseTest, AddKeyOfflineTest) {
|
|||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, RestoreOfflineKeyTest) {
|
TEST_F(WvCdmRequestLicenseTest, RestoreOfflineKeyTest) {
|
||||||
Unprovision();
|
Unprovision();
|
||||||
Provision();
|
Provision(kLevelDefault);
|
||||||
|
|
||||||
// override default settings unless configured through the command line
|
// override default settings unless configured through the command line
|
||||||
std::string key_id;
|
std::string key_id;
|
||||||
@@ -944,7 +952,7 @@ TEST_F(WvCdmRequestLicenseTest, RestoreOfflineKeyTest) {
|
|||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeyTest) {
|
TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeyTest) {
|
||||||
Unprovision();
|
Unprovision();
|
||||||
Provision();
|
Provision(kLevelDefault);
|
||||||
|
|
||||||
// override default settings unless configured through the command line
|
// override default settings unless configured through the command line
|
||||||
std::string key_id;
|
std::string key_id;
|
||||||
@@ -974,7 +982,7 @@ TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeyTest) {
|
|||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, ReleaseRetryOfflineKeyTest) {
|
TEST_F(WvCdmRequestLicenseTest, ReleaseRetryOfflineKeyTest) {
|
||||||
Unprovision();
|
Unprovision();
|
||||||
Provision();
|
Provision(kLevelDefault);
|
||||||
|
|
||||||
// override default settings unless configured through the command line
|
// override default settings unless configured through the command line
|
||||||
std::string key_id;
|
std::string key_id;
|
||||||
@@ -1013,7 +1021,7 @@ TEST_F(WvCdmRequestLicenseTest, ReleaseRetryOfflineKeyTest) {
|
|||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, ExpiryOnReleaseOfflineKeyTest) {
|
TEST_F(WvCdmRequestLicenseTest, ExpiryOnReleaseOfflineKeyTest) {
|
||||||
Unprovision();
|
Unprovision();
|
||||||
Provision();
|
Provision(kLevelDefault);
|
||||||
|
|
||||||
// override default settings unless configured through the command line
|
// override default settings unless configured through the command line
|
||||||
std::string key_id;
|
std::string key_id;
|
||||||
@@ -1091,6 +1099,8 @@ class WvCdmUsageInfoTest
|
|||||||
public ::testing::WithParamInterface<UsageInfoSubSampleInfo*> {};
|
public ::testing::WithParamInterface<UsageInfoSubSampleInfo*> {};
|
||||||
|
|
||||||
TEST_P(WvCdmUsageInfoTest, UsageInfo) {
|
TEST_P(WvCdmUsageInfoTest, UsageInfo) {
|
||||||
|
Unprovision();
|
||||||
|
Provision(kLevelDefault);
|
||||||
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
|
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
|
||||||
DeviceFiles handle;
|
DeviceFiles handle;
|
||||||
EXPECT_TRUE(handle.Init(security_level));
|
EXPECT_TRUE(handle.Init(security_level));
|
||||||
@@ -1167,6 +1177,7 @@ TEST_F(WvCdmRequestLicenseTest, QueryUnmodifiedSessionStatus) {
|
|||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, QueryModifiedSessionStatus) {
|
TEST_F(WvCdmRequestLicenseTest, QueryModifiedSessionStatus) {
|
||||||
// Test that L3 is returned when properties downgrade security.
|
// Test that L3 is returned when properties downgrade security.
|
||||||
|
Provision(kLevel3);
|
||||||
TestWvCdmClientPropertySet property_set_L3;
|
TestWvCdmClientPropertySet property_set_L3;
|
||||||
property_set_L3.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
|
property_set_L3.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
|
||||||
|
|
||||||
@@ -1264,15 +1275,14 @@ TEST_F(WvCdmRequestLicenseTest, QueryKeyControlInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WvCdmRequestLicenseTest, SecurityLevelPathBackwardCompatibility) {
|
TEST_F(WvCdmRequestLicenseTest, SecurityLevelPathBackwardCompatibility) {
|
||||||
// override default settings unless configured through the command line
|
Unprovision();
|
||||||
std::string key_id = g_key_id;
|
Provision(kLevelDefault);
|
||||||
std::string client_auth = g_client_auth;
|
|
||||||
|
|
||||||
ConfigTestEnv config(g_license_server_id, false);
|
// override default settings unless configured through the command line
|
||||||
if (g_key_id.compare(a2bs_hex(g_config->key_id())) == 0)
|
std::string key_id;
|
||||||
key_id.assign(wvcdm::a2bs_hex(config.key_id()));
|
std::string client_auth;
|
||||||
if (g_client_auth.compare(g_config->client_auth()) == 0)
|
|
||||||
client_auth.assign(config.client_auth());
|
GetOfflineConfiguration(&key_id, &client_auth);
|
||||||
|
|
||||||
CdmQueryMap query_info;
|
CdmQueryMap query_info;
|
||||||
CdmQueryMap::iterator itr;
|
CdmQueryMap::iterator itr;
|
||||||
@@ -1322,6 +1332,10 @@ TEST_F(WvCdmRequestLicenseTest, SecurityLevelPathBackwardCompatibility) {
|
|||||||
response, &cert, &wrapped_key));
|
response, &cert, &wrapped_key));
|
||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
|
|
||||||
|
std::vector<std::string> files;
|
||||||
|
EXPECT_TRUE(file.List(base_path, &files));
|
||||||
|
size_t number_of_files = files.size();
|
||||||
|
|
||||||
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
||||||
GenerateKeyRequest(key_id, kLicenseTypeOffline);
|
GenerateKeyRequest(key_id, kLicenseTypeOffline);
|
||||||
VerifyKeyRequestResponse(g_license_server, client_auth, false);
|
VerifyKeyRequestResponse(g_license_server, client_auth, false);
|
||||||
@@ -1329,9 +1343,10 @@ TEST_F(WvCdmRequestLicenseTest, SecurityLevelPathBackwardCompatibility) {
|
|||||||
EXPECT_FALSE(key_set_id_.empty());
|
EXPECT_FALSE(key_set_id_.empty());
|
||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
|
|
||||||
std::vector<std::string> files;
|
|
||||||
EXPECT_TRUE(file.List(base_path, &files));
|
EXPECT_TRUE(file.List(base_path, &files));
|
||||||
EXPECT_TRUE(2u == files.size() || 3u == files.size());
|
int number_of_new_files = files.size() - number_of_files;
|
||||||
|
EXPECT_LE(1, number_of_new_files);
|
||||||
|
EXPECT_GE(2, number_of_new_files);
|
||||||
|
|
||||||
for (size_t i = 0; i < files.size(); ++i) {
|
for (size_t i = 0; i < files.size(); ++i) {
|
||||||
std::string from = base_path + files[i];
|
std::string from = base_path + files[i];
|
||||||
@@ -1350,7 +1365,7 @@ TEST_F(WvCdmRequestLicenseTest, SecurityLevelPathBackwardCompatibility) {
|
|||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
|
|
||||||
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
decryptor_.OpenSession(g_key_system, NULL, &session_id_);
|
||||||
GenerateKeyRequest(key_id, kLicenseTypeStreaming);
|
GenerateKeyRequest(g_key_id, kLicenseTypeStreaming);
|
||||||
VerifyKeyRequestResponse(g_license_server, client_auth, false);
|
VerifyKeyRequestResponse(g_license_server, client_auth, false);
|
||||||
decryptor_.CloseSession(session_id_);
|
decryptor_.CloseSession(session_id_);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user