From e7017475b794d26ea7ccdeb1450c90d27c8e88e1 Mon Sep 17 00:00:00 2001 From: Vicky Min Date: Thu, 27 Jul 2023 19:01:24 +0000 Subject: [PATCH] Use GTEST_SKIP for generic crypto tests Bug: 251240681 Merged from https://widevine-internal-review.googlesource.com/180050 Change-Id: I5aebcf10f9c8bad5ff21c22bc882040ecd0b390a --- .../cdm/core/test/generic_crypto_unittest.cpp | 3 +++ .../oemcrypto/test/oec_device_features.cpp | 1 - .../oemcrypto/test/oemcrypto_usage_table_test.cpp | 12 ++++++++++++ .../oemcrypto/test/oemcrypto_usage_table_test.h | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libwvdrmengine/cdm/core/test/generic_crypto_unittest.cpp b/libwvdrmengine/cdm/core/test/generic_crypto_unittest.cpp index 0829dc38..90e2de18 100644 --- a/libwvdrmengine/cdm/core/test/generic_crypto_unittest.cpp +++ b/libwvdrmengine/cdm/core/test/generic_crypto_unittest.cpp @@ -37,6 +37,9 @@ class WvGenericCryptoTest : public WvCdmTestBaseWithEngine { void SetUp() override { WvCdmTestBase::SetUp(); + if (!wvoec::global_features.generic_crypto) { + GTEST_SKIP() << "Test for devices with generic crypto API only"; + } EnsureProvisioned(); ASSERT_NO_FATAL_FAILURE(holder_.OpenSession()); ASSERT_NO_FATAL_FAILURE(holder_.FetchLicense()); diff --git a/libwvdrmengine/oemcrypto/test/oec_device_features.cpp b/libwvdrmengine/oemcrypto/test/oec_device_features.cpp index e6affcac..cfb742b7 100644 --- a/libwvdrmengine/oemcrypto/test/oec_device_features.cpp +++ b/libwvdrmengine/oemcrypto/test/oec_device_features.cpp @@ -148,7 +148,6 @@ void DeviceFeatures::Initialize() { std::string DeviceFeatures::RestrictFilter(const std::string& initial_filter) { std::string filter = initial_filter; // clang-format off - if (!generic_crypto) FilterOut(&filter, "*GenericCrypto*"); if (api_version < 17) FilterOut(&filter, "*API17*"); if (api_version < 18) FilterOut(&filter, "*API18*"); // clang-format on diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.cpp index 77c62400..ff15b240 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.cpp @@ -440,6 +440,9 @@ TEST_P(OEMCryptoUsageTableTest, LoadEntryInMultipleSessions) { // Test generic encrypt when the license uses a PST. TEST_P(OEMCryptoUsageTableTest, GenericCryptoEncrypt) { + if (!wvoec::global_features.generic_crypto) { + GTEST_SKIP() << "Test for devices with generic crypto API only"; + } LicenseWithUsageEntry entry; entry.license_messages().set_api_version(license_api_version_); entry.set_generic_crypto(true); @@ -479,6 +482,9 @@ TEST_P(OEMCryptoUsageTableTest, GenericCryptoEncrypt) { // Test generic decrypt when the license uses a PST. TEST_P(OEMCryptoUsageTableTest, GenericCryptoDecrypt) { + if (!wvoec::global_features.generic_crypto) { + GTEST_SKIP() << "Test for devices with generic crypto API only"; + } LicenseWithUsageEntry entry; entry.license_messages().set_api_version(license_api_version_); entry.set_generic_crypto(true); @@ -516,6 +522,9 @@ TEST_P(OEMCryptoUsageTableTest, GenericCryptoDecrypt) { // Test generic sign when the license uses a PST. TEST_P(OEMCryptoUsageTableTest, GenericCryptoSign) { + if (!wvoec::global_features.generic_crypto) { + GTEST_SKIP() << "Test for devices with generic crypto API only"; + } LicenseWithUsageEntry entry; entry.license_messages().set_api_version(license_api_version_); entry.set_generic_crypto(true); @@ -565,6 +574,9 @@ TEST_P(OEMCryptoUsageTableTest, GenericCryptoSign) { // Test generic verify when the license uses a PST. TEST_P(OEMCryptoUsageTableTest, GenericCryptoVerify) { + if (!wvoec::global_features.generic_crypto) { + GTEST_SKIP() << "Test for devices with generic crypto API only"; + } LicenseWithUsageEntry entry; entry.license_messages().set_api_version(license_api_version_); entry.set_generic_crypto(true); diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.h b/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.h index ce5d7ab9..b36404a5 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.h +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_usage_table_test.h @@ -28,6 +28,9 @@ class OEMCryptoGenericCryptoTest : public OEMCryptoRefreshTest { void SetUp() override { OEMCryptoRefreshTest::SetUp(); + if (!wvoec::global_features.generic_crypto) { + GTEST_SKIP() << "Test for devices with generic crypto API only"; + } ASSERT_NO_FATAL_FAILURE(license_messages_.SignAndVerifyRequest()); ASSERT_NO_FATAL_FAILURE( license_messages_.CreateResponseWithGenericCryptoKeys());