Address compilation warnings

[ Merge of http://go/wvgerrit/90350 ]

Bug: 145244554
Test: wv android unit/integration tests
Change-Id: I5cd8a132836ce097a7b539fffdcef574f64cbdcf
This commit is contained in:
Rahul Frias
2019-11-26 16:47:41 -08:00
parent 176096a2d3
commit b8a6035298
5 changed files with 56 additions and 58 deletions

View File

@@ -260,7 +260,7 @@ void WvCdmTestBase::InstallTestRootOfTrust() {
}
}
void WvCdmTestBase::Provision(size_t max_attempts) {
void WvCdmTestBase::Provision() {
CdmProvisioningRequest prov_request;
CdmProvisioningRequest binary_prov_request;
std::string provisioning_server_url;
@@ -271,8 +271,6 @@ void WvCdmTestBase::Provision(size_t max_attempts) {
CdmSessionId session_id;
FileSystem file_system;
ASSERT_GE(max_attempts, 1lu) << "|max_attempts| must be at least 1";
// TODO(fredgc): provision for different SPOIDs.
CdmEngine cdm_engine(&file_system,
std::shared_ptr<EngineMetrics>(new EngineMetrics));
@@ -294,8 +292,6 @@ void WvCdmTestBase::Provision(size_t max_attempts) {
// for test vs. production server.
provisioning_server_url.assign(config_.provisioning_server());
// Attempt to provision using the same requests a maximum of |max_attempts|
// times.
// TODO(b/139361531): Remove loop once provisioning service is stable.
std::string http_message;
size_t attempt_num = 0;
@@ -363,7 +359,8 @@ void WvCdmTestBase::Provision(size_t max_attempts) {
}
}
provision_success = true;
} while (attempt_num <= max_attempts && !provision_success);
} while (attempt_num <= kDefaultMaxProvisioningAttempts &&
!provision_success);
if (attempt_num > 1) {
LOGW("Provisioning request failed at least once: attempts = %zu",

View File

@@ -35,7 +35,7 @@ class WvCdmTestBase : public ::testing::Test {
static void InstallTestRootOfTrust();
// Send provisioning request to the server and handle response.
virtual void Provision(size_t max_attempts = kDefaultMaxProvisioningAttempts);
virtual void Provision();
// Calls Provision() if not already provisioned.
virtual void EnsureProvisioned();

View File

@@ -2004,9 +2004,7 @@ class WvCdmRequestLicenseTest : public WvCdmTestBase {
decryptor_->Unprovision(kSecurityLevelL3, kDefaultCdmIdentifier));
}
void Provision(SecurityLevel level) {
Provision(kDefaultCdmIdentifier, level);
}
void Provision() { Provision(kDefaultCdmIdentifier, kLevelDefault); }
void Provision(const CdmIdentifier& identifier, SecurityLevel level,
CdmProvisioningResponse* provisioning_response = nullptr) {
@@ -2494,7 +2492,7 @@ TEST_F(WvCdmRequestLicenseTest, PropertySetTest) {
CdmSessionId session_id_Ln;
Unprovision();
Provision(kLevelDefault);
Provision();
property_set_L1.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L1);
property_set_L1.set_use_privacy_mode(true);
@@ -2659,7 +2657,7 @@ TEST_F(WvCdmRequestLicenseTest, AddStreamingKeyTest) {
TEST_F(WvCdmRequestLicenseTest, AddKeyOfflineTest) {
Unprovision();
Provision(kLevelDefault);
Provision();
// override default settings unless configured through the command line
std::string key_id;
@@ -2675,7 +2673,7 @@ TEST_F(WvCdmRequestLicenseTest, AddKeyOfflineTest) {
TEST_F(WvCdmRequestLicenseTest, RestoreOfflineKeyTest) {
Unprovision();
Provision(kLevelDefault);
Provision();
// override default settings unless configured through the command line
std::string key_id;
@@ -2700,7 +2698,7 @@ TEST_F(WvCdmRequestLicenseTest, RestoreOfflineKeyTest) {
TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeyTest) {
Unprovision();
Provision(kLevelDefault);
Provision();
// override default settings unless configured through the command line
std::string key_id;
@@ -2732,7 +2730,7 @@ TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeyTest) {
TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeySessionUsageDisabledTest) {
Unprovision();
Provision(kLevelDefault);
Provision();
// The default offline asset "offline_clip2" has the session usage table
// entry enabled in the replay control portion of the key control block.
@@ -2791,7 +2789,7 @@ TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeySessionUsageDisabledTest) {
TEST_F(WvCdmRequestLicenseTest, ReleaseRetryOfflineKeyTest) {
Unprovision();
Provision(kLevelDefault);
Provision();
// override default settings unless configured through the command line
std::string key_id;
@@ -2984,7 +2982,7 @@ TEST_F(WvCdmRequestLicenseTest,
// deallocated (rather than leaked) and a new one allocated.
TEST_F(WvCdmRequestLicenseTest, AutomatedOfflineSessionReleaseTest) {
Unprovision();
Provision(kLevelDefault);
Provision();
// override default settings unless configured through the command line
std::string key_id;
@@ -3073,7 +3071,7 @@ TEST_F(WvCdmRequestLicenseTest, StreamingLicenseRenewalProhibited) {
TEST_F(WvCdmRequestLicenseTest, OfflineLicenseRenewal) {
Unprovision();
Provision(kLevelDefault);
Provision();
// override default settings unless configured through the command line
std::string key_id;
@@ -3094,7 +3092,7 @@ TEST_F(WvCdmRequestLicenseTest, OfflineLicenseRenewal) {
TEST_F(WvCdmRequestLicenseTest, OfflineLicenseRenewalAndRelease) {
Unprovision();
Provision(kLevelDefault);
Provision();
// override default settings unless configured through the command line
std::string key_id;
@@ -3366,7 +3364,7 @@ class WvCdmOfflineLicenseReleaseTest
TEST_P(WvCdmOfflineLicenseReleaseTest, WithClientId) {
Unprovision();
Provision(kLevelDefault);
Provision();
RenewWithClientIdTestConfiguration* config = GetParam();
std::string key_id;
@@ -3511,7 +3509,7 @@ class WvCdmUsageTest : public WvCdmRequestLicenseTest,
TEST_P(WvCdmUsageTest, WithClientId) {
Unprovision();
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
std::string app_id = "";
@@ -3633,7 +3631,7 @@ INSTANTIATE_TEST_CASE_P(
TEST_F(WvCdmRequestLicenseTest, UsageInfoRetryTest) {
Unprovision();
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
std::string app_id = "";
@@ -3710,7 +3708,7 @@ TEST_F(WvCdmRequestLicenseTest, UsageInfoRetryTest) {
TEST_F(WvCdmRequestLicenseTest, UsageInfo_ReleaseThreeRecords) {
Unprovision();
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
std::string app_id = "";
@@ -3810,10 +3808,10 @@ TEST_P(WvCdmUsageInfoTest, UsageInfo) {
if (kLevel3 == usage_info_data->security_level) {
client_property_set.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
property_set = &client_property_set;
Provision(kLevel3);
Provision(kLevelDefault);
Provision(kDefaultCdmIdentifier, kLevel3);
Provision();
} else {
Provision(kLevelDefault);
Provision();
}
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
@@ -3901,7 +3899,7 @@ TEST_F(WvCdmRequestLicenseTest, UsageRemoveAllTest) {
std::string app_id_not_empty = "not empty";
TestWvCdmClientPropertySet property_set;
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
FileSystem file_system;
@@ -3989,7 +3987,7 @@ TEST_F(WvCdmRequestLicenseTest, RemoveCorruptedUsageInfoTest) {
std::string app_id_not_empty = "not empty";
TestWvCdmClientPropertySet property_set;
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
FileSystem file_system;
@@ -4125,7 +4123,7 @@ TEST_F(WvCdmRequestLicenseTest, RemoveCorruptedUsageInfoTest2) {
std::string app_id_not_empty = "not empty";
TestWvCdmClientPropertySet property_set;
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
FileSystem file_system;
@@ -4274,7 +4272,7 @@ TEST_F(WvCdmRequestLicenseTest, GetSecureStopIdsTest) {
std::string app_id_empty = "";
TestWvCdmClientPropertySet property_set;
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
FileSystem file_system;
@@ -4424,7 +4422,7 @@ TEST_F(WvCdmRequestLicenseTest, UsageRecoveryTest) {
std::string app_id_empty = "";
TestWvCdmClientPropertySet property_set;
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
FileSystem file_system;
@@ -4534,7 +4532,7 @@ TEST_F(WvCdmRequestLicenseTest, UsageRemoveSecureStopTest) {
std::string app_id_empty = "";
TestWvCdmClientPropertySet property_set;
Provision(kLevelDefault);
Provision();
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
FileSystem file_system;
@@ -4645,7 +4643,7 @@ TEST_F(WvCdmRequestLicenseTest, UsageRemoveSecureStopTest) {
// TODO(rfrias): Enable when b/123370099 has been addressed
TEST_F(WvCdmRequestLicenseTest, VerifyProviderClientToken) {
Unprovision();
Provision(kLevelDefault);
Provision();
// The default offline asset "offline_clip2" does not include a
// provider session token but "offline_clip5" does, so replace the last
@@ -4763,7 +4761,7 @@ TEST_F(WvCdmRequestLicenseTest, QueryUnmodifiedSessionStatus) {
TEST_F(WvCdmRequestLicenseTest, QueryModifiedSessionStatus) {
// Test that L3 is returned when properties downgrade security.
Unprovision();
Provision(kLevel3);
Provision(kDefaultCdmIdentifier, kLevel3);
TestWvCdmClientPropertySet property_set_L3;
property_set_L3.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
@@ -4772,7 +4770,7 @@ TEST_F(WvCdmRequestLicenseTest, QueryModifiedSessionStatus) {
TEST_F(WvCdmRequestLicenseTest, QueryKeyStatus) {
Unprovision();
Provision(kLevelDefault);
Provision();
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
@@ -5054,7 +5052,7 @@ TEST_F(WvCdmRequestLicenseTest, QueryStatusL3) {
TEST_F(WvCdmRequestLicenseTest, QueryOemCryptoSessionId) {
Unprovision();
Provision(kLevelDefault);
Provision();
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
@@ -5080,8 +5078,7 @@ TEST_F(WvCdmRequestLicenseTest, QueryOemCryptoSessionId) {
TEST_F(WvCdmRequestLicenseTest, IsSecurityLevelSupported) {
// Level 1 may either be or not be supported. Invoking the method without
// imposing any expecations to make sure it completes.
bool is_supported = WvContentDecryptionModule::IsSecurityLevelSupported(
wvcdm::kSecurityLevelL1);
WvContentDecryptionModule::IsSecurityLevelSupported(wvcdm::kSecurityLevelL1);
EXPECT_FALSE(WvContentDecryptionModule::IsSecurityLevelSupported(
wvcdm::kSecurityLevelL2));
EXPECT_TRUE(WvContentDecryptionModule::IsSecurityLevelSupported(
@@ -5683,7 +5680,7 @@ class WvHlsDecryptionTest
public ::testing::WithParamInterface<HlsDecryptionInfo*> {};
TEST_P(WvHlsDecryptionTest, HlsDecryptionTest) {
Provision(kLevel3);
Provision(kDefaultCdmIdentifier, kLevel3);
TestWvCdmClientPropertySet client_property_set;
client_property_set.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
HlsDecryptionInfo* info = GetParam();
@@ -5737,7 +5734,7 @@ class WvHlsFourCCBackwardCompatibilityTest
public ::testing::WithParamInterface<HlsDecryptionInfo*> {};
TEST_P(WvHlsFourCCBackwardCompatibilityTest, HlsDecryptionTest) {
Provision(kLevel3);
Provision(kDefaultCdmIdentifier, kLevel3);
TestWvCdmClientPropertySet client_property_set;
client_property_set.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
HlsDecryptionInfo* info = GetParam();
@@ -5792,7 +5789,7 @@ class WvCenc30Test
public ::testing::WithParamInterface<SingleSampleDecryptionInfo*> {};
TEST_P(WvCenc30Test, DecryptionTest) {
Provision(kLevel3);
Provision(kDefaultCdmIdentifier, kLevel3);
TestWvCdmClientPropertySet client_property_set;
client_property_set.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
@@ -5855,7 +5852,7 @@ class WvCenc30SwitchCipherModeTest
public ::testing::WithParamInterface<FourSampleDecryptionInfo*> {};
TEST_P(WvCenc30SwitchCipherModeTest, DecryptionTest) {
Provision(kLevel3);
Provision(kDefaultCdmIdentifier, kLevel3);
TestWvCdmClientPropertySet client_property_set;
client_property_set.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
@@ -5961,7 +5958,7 @@ TEST_F(WvCdmRequestLicenseTest, CloseCdmReleaseResourcesTest) {
// Enable when OEMCrypto v15 has been deployed. Currently setting a decrypt
// hash returns OEMCrypto_ERROR_NOT_IMPLEMENTED
TEST_F(WvCdmRequestLicenseTest, DISABLED_DecryptPathTest) {
Provision(kDefaultCdmIdentifier, kLevelDefault);
Provision();
// Retrieve a streaming license
EXPECT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
@@ -6084,7 +6081,7 @@ class WvCdmRequestLicenseRollbackTest
TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireAfterRollback) {
Unprovision();
Provision(kLevelDefault);
Provision();
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
kDefaultCdmIdentifier, nullptr,
@@ -6111,7 +6108,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireAfterRollback) {
TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireBeforeRollback) {
Unprovision();
Provision(kLevelDefault);
Provision();
ASSERT_EQ(NO_ERROR, decryptor_->OpenSession(config_.key_system(), nullptr,
kDefaultCdmIdentifier, nullptr,
@@ -6137,7 +6134,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireBeforeRollback) {
TEST_F(WvCdmRequestLicenseRollbackTest, Offline_RollbackBeforeRestoreKey) {
Unprovision();
Provision(kLevelDefault);
Provision();
std::string unused_key_id;
std::string client_auth;
@@ -6184,7 +6181,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Offline_RollbackBeforeRestoreKey) {
TEST_F(WvCdmRequestLicenseRollbackTest,
Offline_RollbackAndExpireAfterRestoreKey) {
Unprovision();
Provision(kLevelDefault);
Provision();
std::string unused_key_id;
std::string client_auth;
@@ -6222,7 +6219,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest,
TEST_F(WvCdmRequestLicenseRollbackTest,
Offline_ExpireAndRollbackAfterRestoreKey) {
Unprovision();
Provision(kLevelDefault);
Provision();
std::string unused_key_id;
std::string client_auth;

View File

@@ -197,14 +197,16 @@ class CDPMatcherFactory {
// time.
class CDPMatcher {
public:
// TODO b/35259313: Uncomment out parameters when addressed
CDPMatcher(bool isSecure, CdmCipherMode cipherMode, uint8_t* keyId,
void* out, size_t outLen, bool isEncrypted, uint8_t* in,
size_t inLen, uint8_t* iv, size_t blockOffset,
size_t outOffset, uint8_t flags, bool isVideo,
void* /* out */, size_t outLen, bool isEncrypted,
uint8_t* /* in */, size_t inLen, uint8_t* iv,
size_t blockOffset, size_t outOffset, uint8_t flags,
bool isVideo,
CdmCencPatternEncryptionDescriptor& cdmPatternDesc)
: mIsSecure(isSecure), mCipherMode(cipherMode), mKeyId(keyId),
mOut(out), mOutLen(outLen), mIsEncrypted(isEncrypted), mIn(in),
mInLen(inLen), mIv(iv), mBlockOffset(blockOffset),
/* mOut(out), */ mOutLen(outLen), mIsEncrypted(isEncrypted),
/* mIn(in), */ mInLen(inLen), mIv(iv), mBlockOffset(blockOffset),
mOutOffset(outOffset), mFlags(flags), mIsVideo(isVideo),
mCdmPatternDesc(cdmPatternDesc) {}
@@ -232,10 +234,12 @@ class CDPMatcherFactory {
bool mIsSecure;
CdmCipherMode mCipherMode;
uint8_t* mKeyId;
void* mOut;
// TODO b/35259313
//void* mOut;
size_t mOutLen;
bool mIsEncrypted;
uint8_t* mIn;
// TODO b/35259313
//uint8_t* mIn;
size_t mInLen;
uint8_t* mIv;
size_t mBlockOffset;

View File

@@ -94,13 +94,13 @@ bool HasMetric(const DrmMetricGroup::Metric& expected,
if (expected.values == it->values) {
ALOGE("values match.");
} else {
ALOGE("values length match? %d, %d",
ALOGE("values length match? %zu, %zu",
expected.values.size(), it->values.size());
if (expected.values.size() == it->values.size()) {
for (unsigned int i = 0; i < expected.values.size(); i++) {
ALOGE("value %d match? %d", i, expected.values[i] == it->values[i]);
ALOGE("value %u match? %d", i, expected.values[i] == it->values[i]);
if (expected.values[i] != it->values[i]) {
ALOGE("value component mismatch. %d. %s, %s",
ALOGE("value component mismatch. %u. %s, %s",
i, expected.values[i].componentName.c_str(),
it->values[i].componentName.c_str());
}