Use GTEST_SKIP for non keybox devices

Bug: 251240681
Merged from https://widevine-internal-review.googlesource.com/179090

Change-Id: I8c539bfbccde7f22fb732951a95715935935858f
This commit is contained in:
Vicky Min
2023-07-20 23:10:44 +00:00
committed by Robert Shih
parent 30669a7b67
commit a012466156
5 changed files with 16 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
#include "create_test_file_system.h" #include "create_test_file_system.h"
#include "crypto_session.h" #include "crypto_session.h"
#include "oec_device_features.h"
#include "properties.h" #include "properties.h"
#include "provisioning_holder.h" #include "provisioning_holder.h"
#include "test_base.h" #include "test_base.h"
@@ -22,6 +23,9 @@ namespace wvcdm {
class CdmOtaKeyboxTest : public ::testing::Test { class CdmOtaKeyboxTest : public ::testing::Test {
public: public:
void SetUp() override { void SetUp() override {
if (wvoec::global_features.provisioning_method != OEMCrypto_Keybox) {
GTEST_SKIP() << "Test for Prov 2.0 devices only.";
}
::testing::Test::SetUp(); ::testing::Test::SetUp();
Properties::Init(); Properties::Init();
const ::testing::TestInfo* const test_info = const ::testing::TestInfo* const test_info =

View File

@@ -153,7 +153,6 @@ void DeviceFeatures::Initialize() {
std::string DeviceFeatures::RestrictFilter(const std::string& initial_filter) { std::string DeviceFeatures::RestrictFilter(const std::string& initial_filter) {
std::string filter = initial_filter; std::string filter = initial_filter;
// clang-format off // clang-format off
if (!uses_keybox) FilterOut(&filter, "*KeyboxTest*");
// TODO(b/197141970): Need to revisit OEMCryptoLoadsCert* tests for // TODO(b/197141970): Need to revisit OEMCryptoLoadsCert* tests for
// provisioning 4. Disabled here temporarily. // provisioning 4. Disabled here temporarily.
if (!loads_certificate || if (!loads_certificate ||

View File

@@ -85,6 +85,9 @@ void TestMaxKeys(SessionUtil* util, size_t num_keys_per_session) {
} }
TEST_F(OEMCryptoSessionTestKeyboxTest, TestKeyboxIsValid) { TEST_F(OEMCryptoSessionTestKeyboxTest, TestKeyboxIsValid) {
if (global_features.provisioning_method != OEMCrypto_Keybox) {
GTEST_SKIP() << "Test for Prov 2.0 devices only.";
}
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_IsKeyboxValid()); ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_IsKeyboxValid());
} }

View File

@@ -791,6 +791,9 @@ TEST_F(OEMCryptoLoadsCertificate, CertificateProvisionBadRange5Prov30_API16) {
// TODO(b/144186970): This test should also run on Prov 3.0 devices. // TODO(b/144186970): This test should also run on Prov 3.0 devices.
TEST_F(OEMCryptoLoadsCertificate, TEST_F(OEMCryptoLoadsCertificate,
CertificateProvisionBadSignatureKeyboxTestAPI16) { CertificateProvisionBadSignatureKeyboxTestAPI16) {
if (global_features.provisioning_method != OEMCrypto_Keybox) {
GTEST_SKIP() << "Test for Prov 2.0 devices only.";
}
Session s; Session s;
ProvisioningRoundTrip provisioning_messages(&s, encoded_rsa_key_); ProvisioningRoundTrip provisioning_messages(&s, encoded_rsa_key_);
provisioning_messages.PrepareSession(keybox_); provisioning_messages.PrepareSession(keybox_);
@@ -834,6 +837,9 @@ TEST_F(OEMCryptoLoadsCertificate, CertificateProvisionBadRSAKey) {
// TODO(b/144186970): This test should also run on Prov 3.0 devices. // TODO(b/144186970): This test should also run on Prov 3.0 devices.
TEST_F(OEMCryptoLoadsCertificate, TEST_F(OEMCryptoLoadsCertificate,
CertificateProvisionBadRSAKeyKeyboxTestAPI16) { CertificateProvisionBadRSAKeyKeyboxTestAPI16) {
if (global_features.provisioning_method != OEMCrypto_Keybox) {
GTEST_SKIP() << "Test for Prov 2.0 devices only.";
}
Session s; Session s;
ProvisioningRoundTrip provisioning_messages(&s, encoded_rsa_key_); ProvisioningRoundTrip provisioning_messages(&s, encoded_rsa_key_);
provisioning_messages.PrepareSession(keybox_); provisioning_messages.PrepareSession(keybox_);

View File

@@ -22,6 +22,9 @@ namespace wvoec {
class OEMCryptoKeyboxTest : public OEMCryptoClientTest { class OEMCryptoKeyboxTest : public OEMCryptoClientTest {
void SetUp() override { void SetUp() override {
OEMCryptoClientTest::SetUp(); OEMCryptoClientTest::SetUp();
if (global_features.provisioning_method != OEMCrypto_Keybox) {
GTEST_SKIP() << "Test for Prov 2.0 devices only.";
}
OEMCryptoResult sts = OEMCrypto_IsKeyboxValid(); OEMCryptoResult sts = OEMCrypto_IsKeyboxValid();
// If the production keybox is valid, use it for these tests. Most of the // If the production keybox is valid, use it for these tests. Most of the
// other tests will use a test keybox anyway, but it's nice to check the // other tests will use a test keybox anyway, but it's nice to check the