mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Convert VtsHalCasV1_2TargetTest to parameterized gtest
bug: 148815882 Test: Manual Change-Id: I9f8de920867d8eb78819ad6efbe0f0d559c99c60
This commit is contained in:
@@ -31,6 +31,8 @@ cc_test {
|
||||
shared_libs: [
|
||||
"libbinder",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: [
|
||||
"general-tests",
|
||||
"vts-core",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
#define LOG_TAG "mediacas_hidl_hal_test"
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/cas/1.0/IDescramblerBase.h>
|
||||
#include <android/hardware/cas/1.0/types.h>
|
||||
@@ -28,8 +26,11 @@
|
||||
#include <android/hardware/cas/native/1.0/IDescrambler.h>
|
||||
#include <android/hardware/cas/native/1.0/types.h>
|
||||
#include <binder/MemoryDealer.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <hidlmemory/FrameworkUtils.h>
|
||||
#include <utils/Condition.h>
|
||||
@@ -293,27 +294,14 @@ void MediaCasListener::testStatusUpdate(sp<ICas>& mediaCas, std::vector<uint8_t>
|
||||
EXPECT_EQ(mEventArg, static_cast<int32_t>(mode));
|
||||
}
|
||||
|
||||
// Test environment for Cas HIDL HAL.
|
||||
class CasHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static CasHidlEnvironment* Instance() {
|
||||
static CasHidlEnvironment* instance = new CasHidlEnvironment;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override { registerTestService<IMediaCasService>(); }
|
||||
};
|
||||
|
||||
class MediaCasHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class MediaCasHidlTest : public testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
mService = ::testing::VtsHalHidlTargetTestBase::getService<IMediaCasService>(
|
||||
CasHidlEnvironment::Instance()->getServiceName<IMediaCasService>());
|
||||
mService = IMediaCasService::getService(GetParam());
|
||||
ASSERT_NE(mService, nullptr);
|
||||
}
|
||||
|
||||
sp<IMediaCasService> mService;
|
||||
sp<IMediaCasService> mService = nullptr;
|
||||
|
||||
protected:
|
||||
static void description(const std::string& description) {
|
||||
@@ -497,7 +485,7 @@ class MediaCasHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
return ::testing::AssertionResult(returnVoid.isOk());
|
||||
}
|
||||
|
||||
TEST_F(MediaCasHidlTest, TestClearKeyApisWithSession) {
|
||||
TEST_P(MediaCasHidlTest, TestClearKeyApisWithSession) {
|
||||
description("Test that valid call sequences with SessionEvent send and receive");
|
||||
|
||||
ASSERT_TRUE(createCasPlugin(CLEAR_KEY_SYSTEM_ID));
|
||||
@@ -609,11 +597,7 @@ TEST_F(MediaCasHidlTest, TestClearKeyApisWithSession) {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(CasHidlEnvironment::Instance());
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
CasHidlEnvironment::Instance()->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, MediaCasHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IMediaCasService::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
||||
Reference in New Issue
Block a user