From afbbad9aa5e133e127c2bfe8b7a14a76cbbc4f17 Mon Sep 17 00:00:00 2001 From: Vicky Min Date: Thu, 27 Jul 2023 18:38:18 +0000 Subject: [PATCH] Use GTEST_SKIP for session tests Bug: 251240681 Merged from https://widevine-internal-review.googlesource.com/180010 Change-Id: I39e5c0365a5e0c2ddf62e6f68426f6baa3ddd1a1 --- libwvdrmengine/cdm/core/test/cdm_session_unittest.cpp | 5 +++++ libwvdrmengine/oemcrypto/test/oec_device_features.cpp | 1 - libwvdrmengine/oemcrypto/test/oemcrypto_decrypt_test.h | 4 ++++ libwvdrmengine/oemcrypto/test/oemcrypto_license_test.h | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libwvdrmengine/cdm/core/test/cdm_session_unittest.cpp b/libwvdrmengine/cdm/core/test/cdm_session_unittest.cpp index 0e553f53..876c5f7e 100644 --- a/libwvdrmengine/cdm/core/test/cdm_session_unittest.cpp +++ b/libwvdrmengine/cdm/core/test/cdm_session_unittest.cpp @@ -12,6 +12,7 @@ #include "cdm_usage_table.h" #include "crypto_key.h" #include "crypto_wrapped_key.h" +#include "oec_device_features.h" #include "properties.h" #include "service_certificate.h" #include "string_conversions.h" @@ -215,6 +216,10 @@ class CdmSessionTest : public WvCdmTestBase { protected: void SetUp() override { WvCdmTestBase::SetUp(); + if (wvoec::global_features.derive_key_method == + wvoec::DeviceFeatures::NO_METHOD) { + GTEST_SKIP() << "Test for devices that can derive session keys only."; + } metrics_ = std::make_shared(); cdm_session_.reset(new CdmSession(nullptr, metrics_)); // Inject testing mocks. diff --git a/libwvdrmengine/oemcrypto/test/oec_device_features.cpp b/libwvdrmengine/oemcrypto/test/oec_device_features.cpp index 3fcc2d79..27c2951a 100644 --- a/libwvdrmengine/oemcrypto/test/oec_device_features.cpp +++ b/libwvdrmengine/oemcrypto/test/oec_device_features.cpp @@ -149,7 +149,6 @@ std::string DeviceFeatures::RestrictFilter(const std::string& initial_filter) { std::string filter = initial_filter; // clang-format off if (!generic_crypto) FilterOut(&filter, "*GenericCrypto*"); - if (derive_key_method == NO_METHOD) FilterOut(&filter, "*SessionTest*"); if (!supports_rsa_3072) FilterOut(&filter, "*RSAKey3072*"); if (api_version < 17) FilterOut(&filter, "*API17*"); if (api_version < 18) FilterOut(&filter, "*API18*"); diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_decrypt_test.h b/libwvdrmengine/oemcrypto/test/oemcrypto_decrypt_test.h index 9f9b5005..36a249c8 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_decrypt_test.h +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_decrypt_test.h @@ -98,6 +98,10 @@ class OEMCryptoSessionTestsDecryptTests protected: void SetUp() override { OEMCryptoLicenseTestAPI16::SetUp(); + if (wvoec::global_features.derive_key_method == + wvoec::DeviceFeatures::NO_METHOD) { + GTEST_SKIP() << "Test for devices that can derive session keys only."; + } pattern_ = ::testing::get<0>(GetParam()); cipher_mode_ = ::testing::get<1>(GetParam()); decrypt_inplace_ = ::testing::get<2>(GetParam()).decrypt_inplace; diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_license_test.h b/libwvdrmengine/oemcrypto/test/oemcrypto_license_test.h index a2860503..66ef2cbf 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_license_test.h +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_license_test.h @@ -39,6 +39,10 @@ class OEMCryptoSessionTests : public OEMCryptoClientTest { void SetUp() override { OEMCryptoClientTest::SetUp(); + if (wvoec::global_features.derive_key_method == + wvoec::DeviceFeatures::NO_METHOD) { + GTEST_SKIP() << "Test for devices that can derive session keys only."; + } EnsureTestROT(); if (global_features.usage_table) { CreateUsageTableHeader();