Merge "Fix tests for devices that don't have drm@1.2 services"
This commit is contained in:
commit
ac16446bd2
2 changed files with 18 additions and 1 deletions
|
@ -118,7 +118,7 @@ void DrmHalTest::SetUp() {
|
|||
}
|
||||
|
||||
// If drm scheme not installed skip subsequent tests
|
||||
if (!drmFactory->isCryptoSchemeSupported(getVendorUUID())) {
|
||||
if (drmFactory.get() == nullptr || !drmFactory->isCryptoSchemeSupported(getVendorUUID())) {
|
||||
vendorModule->setInstalled(false);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ static const SecurityLevel kSwSecureCrypto = SecurityLevel::SW_SECURE_CRYPTO;
|
|||
* Ensure drm factory supports module UUID Scheme
|
||||
*/
|
||||
TEST_P(DrmHalTest, VendorUuidSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kVideoMp4, kSwSecureCrypto);
|
||||
ALOGI("kVideoMp4 = %s res %d", kVideoMp4, (bool)res);
|
||||
EXPECT_TRUE(res);
|
||||
|
@ -61,6 +62,7 @@ TEST_P(DrmHalTest, VendorUuidSupported) {
|
|||
* Ensure drm factory doesn't support an invalid scheme UUID
|
||||
*/
|
||||
TEST_P(DrmHalTest, InvalidPluginNotSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
const uint8_t kInvalidUUID[16] = {
|
||||
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
|
||||
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
|
||||
|
@ -71,6 +73,7 @@ TEST_P(DrmHalTest, InvalidPluginNotSupported) {
|
|||
* Ensure drm factory doesn't support an empty UUID
|
||||
*/
|
||||
TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_array<uint8_t, 16> emptyUUID;
|
||||
memset(emptyUUID.data(), 0, 16);
|
||||
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(emptyUUID, kVideoMp4, kSwSecureCrypto));
|
||||
|
@ -80,6 +83,7 @@ TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) {
|
|||
* Ensure drm factory doesn't support an invalid mime type
|
||||
*/
|
||||
TEST_P(DrmHalTest, BadMimeNotSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kBadMime, kSwSecureCrypto));
|
||||
}
|
||||
|
||||
|
@ -133,6 +137,7 @@ TEST_P(DrmHalTest, DoProvisioning) {
|
|||
* A get key request should fail if no sessionId is provided
|
||||
*/
|
||||
TEST_P(DrmHalTest, GetKeyRequestNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId invalidSessionId;
|
||||
hidl_vec<uint8_t> initData;
|
||||
KeyedVector optionalParameters;
|
||||
|
@ -150,6 +155,7 @@ TEST_P(DrmHalTest, GetKeyRequestNoSession) {
|
|||
* invalid mime type
|
||||
*/
|
||||
TEST_P(DrmHalTest, GetKeyRequestBadMime) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
hidl_vec<uint8_t> initData;
|
||||
KeyedVector optionalParameters;
|
||||
|
@ -186,6 +192,7 @@ void checkKeySetIdState(Status status, OfflineLicenseState state) {
|
|||
* Test drm plugin offline key support
|
||||
*/
|
||||
TEST_P(DrmHalTest, OfflineLicenseTest) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, KeyType::OFFLINE);
|
||||
|
||||
|
@ -225,6 +232,7 @@ TEST_P(DrmHalTest, OfflineLicenseTest) {
|
|||
* Test drm plugin offline key state
|
||||
*/
|
||||
TEST_P(DrmHalTest, OfflineLicenseStateTest) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
DrmHalVTSVendorModule_V1::ContentConfiguration content = getContent(KeyType::OFFLINE);
|
||||
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, content, KeyType::OFFLINE);
|
||||
|
@ -249,6 +257,7 @@ TEST_P(DrmHalTest, OfflineLicenseStateTest) {
|
|||
* Negative offline license test. Remove empty keySetId
|
||||
*/
|
||||
TEST_P(DrmHalTest, RemoveEmptyKeySetId) {
|
||||
RETURN_IF_SKIPPED;
|
||||
KeySetId emptyKeySetId;
|
||||
Status err = drmPlugin->removeOfflineLicense(emptyKeySetId);
|
||||
EXPECT_EQ(Status::BAD_VALUE, err);
|
||||
|
@ -258,6 +267,7 @@ TEST_P(DrmHalTest, RemoveEmptyKeySetId) {
|
|||
* Negative offline license test. Get empty keySetId state
|
||||
*/
|
||||
TEST_P(DrmHalTest, GetEmptyKeySetIdState) {
|
||||
RETURN_IF_SKIPPED;
|
||||
KeySetId emptyKeySetId;
|
||||
auto res = drmPlugin->getOfflineLicenseState(emptyKeySetId, checkKeySetIdState<Status::BAD_VALUE, OfflineLicenseState::UNKNOWN>);
|
||||
EXPECT_OK(res);
|
||||
|
@ -267,6 +277,7 @@ TEST_P(DrmHalTest, GetEmptyKeySetIdState) {
|
|||
* Test that the plugin returns valid connected and max HDCP levels
|
||||
*/
|
||||
TEST_P(DrmHalTest, GetHdcpLevels) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getHdcpLevels_1_2(
|
||||
[&](StatusV1_2 status, const HdcpLevel &connectedLevel,
|
||||
const HdcpLevel &maxLevel) {
|
||||
|
@ -421,6 +432,7 @@ TEST_P(DrmHalTest, EncryptedAesCtrSegmentTestNoKeys) {
|
|||
* Ensure clearkey drm factory doesn't support security level higher than supported
|
||||
*/
|
||||
TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
const SecurityLevel kHwSecureAll = SecurityLevel::HW_SECURE_ALL;
|
||||
EXPECT_FALSE(drmFactory->isCryptoSchemeSupported_1_2(getVendorUUID(), kVideoMp4, kHwSecureAll));
|
||||
}
|
||||
|
@ -429,6 +441,7 @@ TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) {
|
|||
* Test resource contention during attempt to generate key request
|
||||
*/
|
||||
TEST_P(DrmHalClearkeyTest, GetKeyRequestResourceContention) {
|
||||
RETURN_IF_SKIPPED;
|
||||
Status status = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorResourceContention);
|
||||
EXPECT_EQ(Status::OK, status);
|
||||
auto sessionId = openSession();
|
||||
|
@ -450,6 +463,7 @@ TEST_P(DrmHalClearkeyTest, GetKeyRequestResourceContention) {
|
|||
* Test clearkey plugin offline key with mock error
|
||||
*/
|
||||
TEST_P(DrmHalClearkeyTest, OfflineLicenseInvalidState) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, KeyType::OFFLINE);
|
||||
Status status = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorInvalidState);
|
||||
|
@ -471,6 +485,7 @@ TEST_P(DrmHalClearkeyTest, OfflineLicenseInvalidState) {
|
|||
* Test SessionLostState is triggered on error
|
||||
*/
|
||||
TEST_P(DrmHalClearkeyTest, SessionLostState) {
|
||||
RETURN_IF_SKIPPED;
|
||||
sp<DrmHalPluginListener> listener = new DrmHalPluginListener();
|
||||
auto res = drmPlugin->setListener(listener);
|
||||
EXPECT_OK(res);
|
||||
|
@ -491,6 +506,7 @@ TEST_P(DrmHalClearkeyTest, SessionLostState) {
|
|||
* Negative decrypt test. Decrypt with invalid key.
|
||||
*/
|
||||
TEST_P(DrmHalClearkeyTest, DecryptWithEmptyKey) {
|
||||
RETURN_IF_SKIPPED;
|
||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||
const Pattern noPattern = {0, 0};
|
||||
const uint32_t kClearBytes = 512;
|
||||
|
@ -528,6 +544,7 @@ TEST_P(DrmHalClearkeyTest, DecryptWithEmptyKey) {
|
|||
* Negative decrypt test. Decrypt with a key exceeds AES_BLOCK_SIZE.
|
||||
*/
|
||||
TEST_P(DrmHalClearkeyTest, DecryptWithKeyTooLong) {
|
||||
RETURN_IF_SKIPPED;
|
||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||
const Pattern noPattern = {0, 0};
|
||||
const uint32_t kClearBytes = 512;
|
||||
|
|
Loading…
Reference in a new issue