Merge "Skip tests when the drm scheme is not installed" into oc-dev
This commit is contained in:
commit
fdde895c34
2 changed files with 88 additions and 3 deletions
|
@ -65,7 +65,7 @@ DrmHalVTSVendorModule* vendorModuleFactory();
|
|||
|
||||
class DrmHalVTSVendorModule {
|
||||
public:
|
||||
DrmHalVTSVendorModule() {}
|
||||
DrmHalVTSVendorModule() : installed(true) {}
|
||||
virtual ~DrmHalVTSVendorModule() {}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +89,15 @@ class DrmHalVTSVendorModule {
|
|||
*/
|
||||
virtual std::string getServiceName() const = 0;
|
||||
|
||||
/**
|
||||
* Set a flag in the vendor module to indicate whether or not the drm
|
||||
* scheme corresponding to this module is installed on the device.
|
||||
*/
|
||||
void setInstalled(bool flag) {installed = flag;}
|
||||
bool isInstalled() const {return installed;}
|
||||
|
||||
private:
|
||||
bool installed;
|
||||
DrmHalVTSVendorModule(const DrmHalVTSVendorModule&) = delete;
|
||||
void operator=(const DrmHalVTSVendorModule&) = delete;
|
||||
};
|
||||
|
|
|
@ -83,6 +83,14 @@ using VtsTestBase = ::testing::VtsHalHidlTargetTestBase;
|
|||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
|
||||
|
||||
#define RETURN_IF_SKIPPED \
|
||||
if (!vendorModule->isInstalled()) { \
|
||||
std::cout << "[ SKIPPED ] This drm scheme not supported." << \
|
||||
" library:" << GetParam() << " service-name:" << \
|
||||
vendorModule->getServiceName() << std::endl; \
|
||||
return; \
|
||||
}
|
||||
|
||||
static const uint8_t kInvalidUUID[16] = {
|
||||
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
|
||||
0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
|
||||
|
@ -124,6 +132,12 @@ class DrmHalVendorFactoryTest : public testing::TestWithParam<std::string> {
|
|||
VtsTestBase::getService<ICryptoFactory>();
|
||||
}
|
||||
ASSERT_NE(cryptoFactory, nullptr);
|
||||
|
||||
// If drm scheme not installed skip subsequent tests
|
||||
if (!drmFactory->isCryptoSchemeSupported(getVendorUUID())) {
|
||||
vendorModule->setInstalled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void TearDown() override {}
|
||||
|
@ -181,9 +195,10 @@ TEST_P(DrmHalVendorFactoryTest, EmptyPluginUUIDNotSupported) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensure the factory supports the scheme uuid in the config
|
||||
* Check if the factory supports the scheme uuid in the config.
|
||||
*/
|
||||
TEST_P(DrmHalVendorFactoryTest, EmptyPluginConfigUUIDSupported) {
|
||||
TEST_P(DrmHalVendorFactoryTest, PluginConfigUUIDSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
EXPECT_TRUE(drmFactory->isCryptoSchemeSupported(getVendorUUID()));
|
||||
EXPECT_TRUE(cryptoFactory->isCryptoSchemeSupported(getVendorUUID()));
|
||||
}
|
||||
|
@ -208,6 +223,7 @@ TEST_P(DrmHalVendorFactoryTest, InvalidContentTypeNotSupported) {
|
|||
* Ensure valid content types in the configs are supported
|
||||
*/
|
||||
TEST_P(DrmHalVendorFactoryTest, ValidContentTypeSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
EXPECT_TRUE(drmFactory->isContentTypeSupported(config.mimeType));
|
||||
}
|
||||
|
@ -217,6 +233,7 @@ TEST_P(DrmHalVendorFactoryTest, ValidContentTypeSupported) {
|
|||
* Ensure vendor drm plugin can be created
|
||||
*/
|
||||
TEST_P(DrmHalVendorFactoryTest, CreateVendorDrmPlugin) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_string packageName("android.hardware.drm.test");
|
||||
auto res = drmFactory->createPlugin(
|
||||
getVendorUUID(), packageName,
|
||||
|
@ -231,6 +248,7 @@ TEST_P(DrmHalVendorFactoryTest, CreateVendorDrmPlugin) {
|
|||
* Ensure vendor crypto plugin can be created
|
||||
*/
|
||||
TEST_P(DrmHalVendorFactoryTest, CreateVendorCryptoPlugin) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_vec<uint8_t> initVec;
|
||||
auto res = cryptoFactory->createPlugin(
|
||||
getVendorUUID(), initVec,
|
||||
|
@ -245,6 +263,7 @@ TEST_P(DrmHalVendorFactoryTest, CreateVendorCryptoPlugin) {
|
|||
* Ensure invalid drm plugin can't be created
|
||||
*/
|
||||
TEST_P(DrmHalVendorFactoryTest, CreateInvalidDrmPlugin) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_string packageName("android.hardware.drm.test");
|
||||
auto res = drmFactory->createPlugin(
|
||||
kInvalidUUID, packageName,
|
||||
|
@ -259,6 +278,7 @@ TEST_P(DrmHalVendorFactoryTest, CreateInvalidDrmPlugin) {
|
|||
* Ensure invalid crypto plugin can't be created
|
||||
*/
|
||||
TEST_P(DrmHalVendorFactoryTest, CreateInvalidCryptoPlugin) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_vec<uint8_t> initVec;
|
||||
auto res = cryptoFactory->createPlugin(
|
||||
kInvalidUUID, initVec,
|
||||
|
@ -275,6 +295,7 @@ class DrmHalVendorPluginTest : public DrmHalVendorFactoryTest {
|
|||
virtual void SetUp() override {
|
||||
// Create factories
|
||||
DrmHalVendorFactoryTest::SetUp();
|
||||
RETURN_IF_SKIPPED;
|
||||
|
||||
hidl_string packageName("android.hardware.drm.test");
|
||||
auto res = drmFactory->createPlugin(
|
||||
|
@ -326,6 +347,7 @@ class DrmHalVendorPluginTest : public DrmHalVendorFactoryTest {
|
|||
*/
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, DoProvisioning) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_string certificateType;
|
||||
hidl_string certificateAuthority;
|
||||
hidl_vec<uint8_t> provisionRequest;
|
||||
|
@ -363,6 +385,7 @@ TEST_P(DrmHalVendorPluginTest, DoProvisioning) {
|
|||
* response is provided.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ProvideEmptyProvisionResponse) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_vec<uint8_t> response;
|
||||
auto res = drmPlugin->provideProvisionResponse(
|
||||
response, [&](Status status, const hidl_vec<uint8_t>&,
|
||||
|
@ -458,6 +481,7 @@ hidl_vec<uint8_t> DrmHalVendorPluginTest::loadKeys(
|
|||
* Test that a session can be opened and closed
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, OpenCloseSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
closeSession(sessionId);
|
||||
}
|
||||
|
@ -467,6 +491,7 @@ TEST_P(DrmHalVendorPluginTest, OpenCloseSession) {
|
|||
* is prohibited with the documented error code.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, CloseInvalidSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId invalidSessionId;
|
||||
Status status = drmPlugin->closeSession(invalidSessionId);
|
||||
EXPECT_EQ(Status::BAD_VALUE, status);
|
||||
|
@ -477,6 +502,7 @@ TEST_P(DrmHalVendorPluginTest, CloseInvalidSession) {
|
|||
* is prohibited with the documented error code.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, CloseClosedSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
closeSession(sessionId);
|
||||
Status status = drmPlugin->closeSession(sessionId);
|
||||
|
@ -487,6 +513,7 @@ TEST_P(DrmHalVendorPluginTest, CloseClosedSession) {
|
|||
* A get key request should fail if no sessionId is provided
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, GetKeyRequestNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId invalidSessionId;
|
||||
hidl_vec<uint8_t> initData;
|
||||
hidl_string mimeType = "video/mp4";
|
||||
|
@ -503,6 +530,7 @@ TEST_P(DrmHalVendorPluginTest, GetKeyRequestNoSession) {
|
|||
* Test that an empty sessionID returns BAD_VALUE
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptySessionId) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
|
||||
hidl_vec<uint8_t> keyResponse = {0x7b, 0x22, 0x6b, 0x65,
|
||||
|
@ -520,6 +548,7 @@ TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptySessionId) {
|
|||
* Test that an empty key response returns BAD_VALUE
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptyResponse) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session = openSession();
|
||||
hidl_vec<uint8_t> emptyResponse;
|
||||
auto res = drmPlugin->provideKeyResponse(
|
||||
|
@ -536,6 +565,7 @@ TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptyResponse) {
|
|||
* Test that a removeKeys on an empty sessionID returns BAD_VALUE
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RemoveKeysEmptySessionId) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId sessionId;
|
||||
Status status = drmPlugin->removeKeys(sessionId);
|
||||
EXPECT_TRUE(status == Status::BAD_VALUE);
|
||||
|
@ -546,6 +576,7 @@ TEST_P(DrmHalVendorPluginTest, RemoveKeysEmptySessionId) {
|
|||
* that has no keys.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RemoveKeysNewSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId sessionId = openSession();
|
||||
Status status = drmPlugin->removeKeys(sessionId);
|
||||
EXPECT_TRUE(status == Status::OK);
|
||||
|
@ -557,6 +588,7 @@ TEST_P(DrmHalVendorPluginTest, RemoveKeysNewSession) {
|
|||
* for all content having a policy that allows offline use.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RestoreKeys) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
if (config.policy.allowOffline) {
|
||||
auto sessionId = openSession();
|
||||
|
@ -577,6 +609,7 @@ TEST_P(DrmHalVendorPluginTest, RestoreKeys) {
|
|||
* Error message is expected to be Status::BAD_VALUE.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RestoreKeysNull) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId sessionId = openSession();
|
||||
hidl_vec<uint8_t> nullKeySetId;
|
||||
Status status = drmPlugin->restoreKeys(sessionId, nullKeySetId);
|
||||
|
@ -590,6 +623,7 @@ TEST_P(DrmHalVendorPluginTest, RestoreKeysNull) {
|
|||
* Status::ERROR_DRM_SESSION_NOT_OPENED.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RestoreKeysClosedSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
auto sessionId = openSession();
|
||||
hidl_vec<uint8_t> keySetId = loadKeys(sessionId, config);
|
||||
|
@ -608,6 +642,7 @@ TEST_P(DrmHalVendorPluginTest, RestoreKeysClosedSession) {
|
|||
* clearing them.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, GetSecureStops) {
|
||||
RETURN_IF_SKIPPED;
|
||||
// There may be secure stops, depending on if there were keys
|
||||
// loaded and unloaded previously. Clear them to get to a known
|
||||
// state, then make sure there are none.
|
||||
|
@ -635,6 +670,7 @@ TEST_P(DrmHalVendorPluginTest, GetSecureStops) {
|
|||
* an empty ssid is provided.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, GetSecureStopEmptySSID) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SecureStopId ssid;
|
||||
auto res = drmPlugin->getSecureStop(
|
||||
ssid, [&](Status status, const SecureStop&) {
|
||||
|
@ -648,6 +684,7 @@ TEST_P(DrmHalVendorPluginTest, GetSecureStopEmptySSID) {
|
|||
* or is completed successfully
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ReleaseAllSecureStops) {
|
||||
RETURN_IF_SKIPPED;
|
||||
Status status = drmPlugin->releaseAllSecureStops();
|
||||
EXPECT_TRUE(status == Status::OK ||
|
||||
status == Status::ERROR_DRM_CANNOT_HANDLE);
|
||||
|
@ -659,6 +696,7 @@ TEST_P(DrmHalVendorPluginTest, ReleaseAllSecureStops) {
|
|||
* This is an optional API so it can also return CANNOT_HANDLE.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopSequenceError) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SecureStopId ssid = {1, 2, 3, 4};
|
||||
Status status = drmPlugin->releaseSecureStop(ssid);
|
||||
EXPECT_TRUE(status == Status::ERROR_DRM_INVALID_STATE ||
|
||||
|
@ -671,6 +709,7 @@ TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopSequenceError) {
|
|||
* CANNOT_HANDLE.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopEmptySSID) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SecureStopId ssid;
|
||||
Status status = drmPlugin->releaseSecureStop(ssid);
|
||||
EXPECT_TRUE(status == Status::BAD_VALUE ||
|
||||
|
@ -683,6 +722,7 @@ TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopEmptySSID) {
|
|||
* the plugin.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, GetVendorProperty) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getPropertyString(
|
||||
"vendor", [&](Status status, const hidl_string& value) {
|
||||
EXPECT_EQ(Status::OK, status);
|
||||
|
@ -692,6 +732,7 @@ TEST_P(DrmHalVendorPluginTest, GetVendorProperty) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GetVersionProperty) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getPropertyString(
|
||||
"version", [&](Status status, const hidl_string& value) {
|
||||
EXPECT_EQ(Status::OK, status);
|
||||
|
@ -701,6 +742,7 @@ TEST_P(DrmHalVendorPluginTest, GetVersionProperty) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GetDescriptionProperty) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getPropertyString(
|
||||
"description", [&](Status status, const hidl_string& value) {
|
||||
EXPECT_EQ(Status::OK, status);
|
||||
|
@ -710,6 +752,7 @@ TEST_P(DrmHalVendorPluginTest, GetDescriptionProperty) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GetAlgorithmsProperty) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getPropertyString(
|
||||
"algorithms", [&](Status status, const hidl_string& value) {
|
||||
if (status == Status::OK) {
|
||||
|
@ -722,6 +765,7 @@ TEST_P(DrmHalVendorPluginTest, GetAlgorithmsProperty) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GetPropertyUniqueDeviceID) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getPropertyByteArray(
|
||||
"deviceUniqueId",
|
||||
[&](Status status, const hidl_vec<uint8_t>& value) {
|
||||
|
@ -739,6 +783,7 @@ TEST_P(DrmHalVendorPluginTest, GetPropertyUniqueDeviceID) {
|
|||
* properties returns the documented error code.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, GetInvalidStringProperty) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getPropertyString(
|
||||
"invalid", [&](Status status, const hidl_string&) {
|
||||
EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
|
||||
|
@ -747,6 +792,7 @@ TEST_P(DrmHalVendorPluginTest, GetInvalidStringProperty) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GetInvalidByteArrayProperty) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto res = drmPlugin->getPropertyByteArray(
|
||||
"invalid", [&](Status status, const hidl_vec<uint8_t>&) {
|
||||
EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
|
||||
|
@ -759,11 +805,13 @@ TEST_P(DrmHalVendorPluginTest, GetInvalidByteArrayProperty) {
|
|||
* the expected status value.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetStringPropertyNotSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
EXPECT_EQ(drmPlugin->setPropertyString("awefijaeflijwef", "value"),
|
||||
Status::ERROR_DRM_CANNOT_HANDLE);
|
||||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, SetByteArrayPropertyNotSupported) {
|
||||
RETURN_IF_SKIPPED;
|
||||
hidl_vec<uint8_t> value;
|
||||
EXPECT_EQ(drmPlugin->setPropertyByteArray("awefijaeflijwef", value),
|
||||
Status::ERROR_DRM_CANNOT_HANDLE);
|
||||
|
@ -774,6 +822,7 @@ TEST_P(DrmHalVendorPluginTest, SetByteArrayPropertyNotSupported) {
|
|||
* the expected status value.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetCipherInvalidAlgorithm) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session = openSession();
|
||||
hidl_string algorithm;
|
||||
Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
|
||||
|
@ -786,6 +835,7 @@ TEST_P(DrmHalVendorPluginTest, SetCipherInvalidAlgorithm) {
|
|||
* the expected status value.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithmNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
hidl_string algorithm = "AES/CBC/NoPadding";
|
||||
Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
|
||||
|
@ -799,6 +849,7 @@ TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithmNoSession) {
|
|||
* either accept it or return ERROR_DRM_CANNOT_HANDLE
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithm) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session = openSession();
|
||||
;
|
||||
hidl_string algorithm = "AES/CBC/NoPadding";
|
||||
|
@ -813,6 +864,7 @@ TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithm) {
|
|||
* the expected status value.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetMacInvalidAlgorithm) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session = openSession();
|
||||
hidl_string algorithm;
|
||||
Status status = drmPlugin->setMacAlgorithm(session, algorithm);
|
||||
|
@ -825,6 +877,7 @@ TEST_P(DrmHalVendorPluginTest, SetMacInvalidAlgorithm) {
|
|||
* the expected status value.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetMacNullAlgorithmNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
hidl_string algorithm = "HmacSHA256";
|
||||
Status status = drmPlugin->setMacAlgorithm(session, algorithm);
|
||||
|
@ -838,6 +891,7 @@ TEST_P(DrmHalVendorPluginTest, SetMacNullAlgorithmNoSession) {
|
|||
* either accept it or return ERROR_DRM_CANNOT_HANDLE
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetMacAlgorithm) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session = openSession();
|
||||
hidl_string algorithm = "HmacSHA256";
|
||||
Status status = drmPlugin->setMacAlgorithm(session, algorithm);
|
||||
|
@ -858,6 +912,7 @@ TEST_P(DrmHalVendorPluginTest, SetMacAlgorithm) {
|
|||
* inputs, e.g. empty sessionId
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, GenericEncryptNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
hidl_vec<uint8_t> keyId, input, iv;
|
||||
auto res = drmPlugin->encrypt(
|
||||
|
@ -869,6 +924,7 @@ TEST_P(DrmHalVendorPluginTest, GenericEncryptNoSession) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GenericDecryptNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
hidl_vec<uint8_t> keyId, input, iv;
|
||||
auto res = drmPlugin->decrypt(
|
||||
|
@ -880,6 +936,7 @@ TEST_P(DrmHalVendorPluginTest, GenericDecryptNoSession) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GenericSignNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
hidl_vec<uint8_t> keyId, message;
|
||||
auto res = drmPlugin->sign(
|
||||
|
@ -891,6 +948,7 @@ TEST_P(DrmHalVendorPluginTest, GenericSignNoSession) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GenericVerifyNoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
hidl_vec<uint8_t> keyId, message, signature;
|
||||
auto res = drmPlugin->verify(
|
||||
|
@ -901,6 +959,7 @@ TEST_P(DrmHalVendorPluginTest, GenericVerifyNoSession) {
|
|||
}
|
||||
|
||||
TEST_P(DrmHalVendorPluginTest, GenericSignRSANoSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId session;
|
||||
hidl_string algorithm;
|
||||
hidl_vec<uint8_t> message, wrappedKey;
|
||||
|
@ -921,6 +980,7 @@ TEST_P(DrmHalVendorPluginTest, GenericSignRSANoSession) {
|
|||
* Verify that requiresSecureDecoderComponent handles empty mimetype.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderEmptyMimeType) {
|
||||
RETURN_IF_SKIPPED;
|
||||
EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent(""));
|
||||
}
|
||||
|
||||
|
@ -928,6 +988,7 @@ TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderEmptyMimeType) {
|
|||
* Verify that requiresSecureDecoderComponent handles invalid mimetype.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderInvalidMimeType) {
|
||||
RETURN_IF_SKIPPED;
|
||||
EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent("bad"));
|
||||
}
|
||||
|
||||
|
@ -936,6 +997,7 @@ TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderInvalidMimeType) {
|
|||
* configurations
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderConfig) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
for (auto key : config.keys) {
|
||||
if (key.isSecure) {
|
||||
|
@ -1007,6 +1069,7 @@ public:
|
|||
* gets them.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ListenerEvents) {
|
||||
RETURN_IF_SKIPPED;
|
||||
sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
|
||||
drmPlugin->setListener(listener);
|
||||
auto sessionId = openSession();
|
||||
|
@ -1033,6 +1096,7 @@ TEST_P(DrmHalVendorPluginTest, ListenerEvents) {
|
|||
* the listener gets them.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ListenerExpirationUpdate) {
|
||||
RETURN_IF_SKIPPED;
|
||||
sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
|
||||
drmPlugin->setListener(listener);
|
||||
auto sessionId = openSession();
|
||||
|
@ -1050,6 +1114,7 @@ TEST_P(DrmHalVendorPluginTest, ListenerExpirationUpdate) {
|
|||
* the listener gets them.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, ListenerKeysChange) {
|
||||
RETURN_IF_SKIPPED;
|
||||
sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
|
||||
drmPlugin->setListener(listener);
|
||||
auto sessionId = openSession();
|
||||
|
@ -1075,6 +1140,7 @@ TEST_P(DrmHalVendorPluginTest, ListenerKeysChange) {
|
|||
* listener set.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, NotListening) {
|
||||
RETURN_IF_SKIPPED;
|
||||
sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
|
||||
drmPlugin->setListener(listener);
|
||||
drmPlugin->setListener(nullptr);
|
||||
|
@ -1100,6 +1166,7 @@ TEST_P(DrmHalVendorPluginTest, NotListening) {
|
|||
* just call the method for coverage.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, NotifyResolution) {
|
||||
RETURN_IF_SKIPPED;
|
||||
cryptoPlugin->notifyResolution(1920, 1080);
|
||||
}
|
||||
|
||||
|
@ -1139,6 +1206,7 @@ sp<IMemory> DrmHalVendorPluginTest::getDecryptMemory(size_t size,
|
|||
* is used to associate a drm session with a crypto session.
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetMediaDrmSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
Status status = cryptoPlugin->setMediaDrmSession(sessionId);
|
||||
EXPECT_EQ(Status::OK, status);
|
||||
|
@ -1149,6 +1217,7 @@ TEST_P(DrmHalVendorPluginTest, SetMediaDrmSession) {
|
|||
* setMediaDrmSession with a closed session id
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetMediaDrmSessionClosedSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
closeSession(sessionId);
|
||||
Status status = cryptoPlugin->setMediaDrmSession(sessionId);
|
||||
|
@ -1159,6 +1228,7 @@ TEST_P(DrmHalVendorPluginTest, SetMediaDrmSessionClosedSession) {
|
|||
* setMediaDrmSession with a empty session id: BAD_VALUE
|
||||
*/
|
||||
TEST_P(DrmHalVendorPluginTest, SetMediaDrmSessionEmptySession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId sessionId;
|
||||
Status status = cryptoPlugin->setMediaDrmSession(sessionId);
|
||||
EXPECT_EQ(Status::BAD_VALUE, status);
|
||||
|
@ -1352,6 +1422,7 @@ void DrmHalVendorDecryptTest::aes_cbc_decrypt(uint8_t* dest, uint8_t* src,
|
|||
* Test key status with empty session id, should return BAD_VALUE
|
||||
*/
|
||||
TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusInvalidSession) {
|
||||
RETURN_IF_SKIPPED;
|
||||
SessionId sessionId;
|
||||
auto res = drmPlugin->queryKeyStatus(sessionId,
|
||||
[&](Status status, KeyedVector /* info */) {
|
||||
|
@ -1365,6 +1436,7 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusInvalidSession) {
|
|||
* Test key status. There should be no key status prior to loading keys
|
||||
*/
|
||||
TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusWithNoKeys) {
|
||||
RETURN_IF_SKIPPED;
|
||||
auto sessionId = openSession();
|
||||
auto keyStatus = queryKeyStatus(sessionId);
|
||||
EXPECT_EQ(0u, keyStatus.size());
|
||||
|
@ -1376,6 +1448,7 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusWithNoKeys) {
|
|||
* Test key status. There should be key status after loading keys.
|
||||
*/
|
||||
TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
auto sessionId = openSession();
|
||||
loadKeys(sessionId, config);
|
||||
|
@ -1389,6 +1462,7 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
|
|||
* Positive decrypt test. "Decrypt" a single clear segment and verify.
|
||||
*/
|
||||
TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
for (auto key : config.keys) {
|
||||
const size_t kSegmentSize = 1024;
|
||||
|
@ -1416,6 +1490,7 @@ TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
|
|||
* Verify data matches.
|
||||
*/
|
||||
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
for (auto key : config.keys) {
|
||||
const size_t kSegmentSize = 1024;
|
||||
|
@ -1442,6 +1517,7 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
|
|||
* Negative decrypt test. Decrypt without loading keys.
|
||||
*/
|
||||
TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
for (auto key : config.keys) {
|
||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||
|
@ -1468,6 +1544,7 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
|
|||
* decryption can't be performed.
|
||||
*/
|
||||
TEST_P(DrmHalVendorDecryptTest, AttemptDecryptWithKeysRemoved) {
|
||||
RETURN_IF_SKIPPED;
|
||||
for (auto config : contentConfigurations) {
|
||||
for (auto key : config.keys) {
|
||||
vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
|
||||
|
|
Loading…
Reference in a new issue