Merge "Filter keybox tests with GTEST_SKIP" into udc-widevine-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fdf0ed469d
@@ -3,12 +3,14 @@
|
|||||||
// License Agreement.
|
// License Agreement.
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#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"
|
||||||
@@ -24,6 +26,9 @@ class CdmOtaKeyboxTest : public ::testing::Test {
|
|||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
::testing::Test::SetUp();
|
::testing::Test::SetUp();
|
||||||
Properties::Init();
|
Properties::Init();
|
||||||
|
if (wvoec::global_features.provisioning_method != OEMCrypto_Keybox) {
|
||||||
|
GTEST_SKIP() << "Test for Prov 2.0 devices only.";
|
||||||
|
}
|
||||||
const ::testing::TestInfo* const test_info =
|
const ::testing::TestInfo* const test_info =
|
||||||
::testing::UnitTest::GetInstance()->current_test_info();
|
::testing::UnitTest::GetInstance()->current_test_info();
|
||||||
LOGD("Running test %s.%s", test_info->test_case_name(), test_info->name());
|
LOGD("Running test %s.%s", test_info->test_case_name(), test_info->name());
|
||||||
|
|||||||
@@ -148,7 +148,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 ||
|
||||||
|
|||||||
@@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -967,4 +970,4 @@ INSTANTIATE_TEST_SUITE_P(TestAPI16, OEMCryptoRefreshTestAPI16,
|
|||||||
Range<uint32_t>(kCoreMessagesAPI, kCurrentAPI + 1));
|
Range<uint32_t>(kCoreMessagesAPI, kCurrentAPI + 1));
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
} // namespace wvoec
|
} // namespace wvoec
|
||||||
|
|||||||
@@ -825,6 +825,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_);
|
||||||
@@ -868,6 +871,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_);
|
||||||
@@ -1225,4 +1231,4 @@ TEST_F(OEMCryptoUsesCertificate, GenerateDerivedKeysLargeBuffer) {
|
|||||||
enc_context.data(), enc_context.size()));
|
enc_context.data(), enc_context.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace wvoec
|
} // namespace wvoec
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ class OEMCryptoKeyboxTest : public OEMCryptoClientTest {
|
|||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
OEMCryptoClientTest::SetUp();
|
OEMCryptoClientTest::SetUp();
|
||||||
OEMCryptoResult sts = OEMCrypto_IsKeyboxValid();
|
OEMCryptoResult sts = OEMCrypto_IsKeyboxValid();
|
||||||
|
if (global_features.provisioning_method != OEMCrypto_Keybox) {
|
||||||
|
GTEST_SKIP() << "Test for Prov 2.0 devices only.";
|
||||||
|
}
|
||||||
// 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
|
||||||
// device ID for the real keybox if we can.
|
// device ID for the real keybox if we can.
|
||||||
@@ -166,4 +169,4 @@ class OEMCryptoUsesCertificate : public OEMCryptoLoadsCertificate {
|
|||||||
|
|
||||||
} // namespace wvoec
|
} // namespace wvoec
|
||||||
|
|
||||||
#endif // CDM_OEMCRYPTO_PROVISIONING_TEST_
|
#endif // CDM_OEMCRYPTO_PROVISIONING_TEST_
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ class OEMCryptoAndroidLMPTest : public ::testing::Test {
|
|||||||
|
|
||||||
// Android devices must have a keybox, or use provisioning 3.0.
|
// Android devices must have a keybox, or use provisioning 3.0.
|
||||||
TEST_F(OEMCryptoAndroidLMPTest, GetKeyDataImplemented) {
|
TEST_F(OEMCryptoAndroidLMPTest, GetKeyDataImplemented) {
|
||||||
|
if (global_features.provisioning_method != OEMCrypto_Keybox &&
|
||||||
|
global_features.provisioning_method != OEMCrypto_OEMCertificate) {
|
||||||
|
GTEST_SKIP() << "Test for Prov 2.0 and 3.0 devices only.";
|
||||||
|
}
|
||||||
uint8_t key_data[256];
|
uint8_t key_data[256];
|
||||||
size_t key_data_len = sizeof(key_data);
|
size_t key_data_len = sizeof(key_data);
|
||||||
if (OEMCrypto_Keybox == OEMCrypto_GetProvisioningMethod()) {
|
if (OEMCrypto_Keybox == OEMCrypto_GetProvisioningMethod()) {
|
||||||
@@ -62,6 +66,9 @@ TEST_F(OEMCryptoAndroidLMPTest, MinVersionNumber9) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OEMCryptoAndroidLMPTest, ValidKeyboxTest) {
|
TEST_F(OEMCryptoAndroidLMPTest, ValidKeyboxTest) {
|
||||||
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +122,10 @@ TEST_F(OEMCryptoAndroidMNCTest, MinVersionNumber10) {
|
|||||||
// Android devices using Provisioning 2.0 must be able to load a test keybox.
|
// Android devices using Provisioning 2.0 must be able to load a test keybox.
|
||||||
// If they are not using Provisioning 2.0, then they must use Provisioning 3.0.
|
// If they are not using Provisioning 2.0, then they must use Provisioning 3.0.
|
||||||
TEST_F(OEMCryptoAndroidMNCTest, LoadsTestKeyboxImplemented) {
|
TEST_F(OEMCryptoAndroidMNCTest, LoadsTestKeyboxImplemented) {
|
||||||
|
if (global_features.provisioning_method != OEMCrypto_Keybox &&
|
||||||
|
global_features.provisioning_method != OEMCrypto_OEMCertificate) {
|
||||||
|
GTEST_SKIP() << "Test for Prov 2.0 and 3.0 devices only.";
|
||||||
|
}
|
||||||
if (OEMCrypto_Keybox == OEMCrypto_GetProvisioningMethod()) {
|
if (OEMCrypto_Keybox == OEMCrypto_GetProvisioningMethod()) {
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(
|
||||||
OEMCrypto_SUCCESS,
|
OEMCrypto_SUCCESS,
|
||||||
|
|||||||
Reference in New Issue
Block a user