mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Convert tv input hal test to use VtsHalHidlTargetTestEnvBase"
This commit is contained in:
@@ -42,11 +42,27 @@ using ::android::sp;
|
|||||||
#define WAIT_FOR_EVENT_TIMEOUT 5
|
#define WAIT_FOR_EVENT_TIMEOUT 5
|
||||||
#define DEFAULT_ID INT32_MIN
|
#define DEFAULT_ID INT32_MIN
|
||||||
|
|
||||||
|
// Test environment for TvInput HIDL HAL.
|
||||||
|
class TvInputHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
|
||||||
|
public:
|
||||||
|
// get the test environment singleton
|
||||||
|
static TvInputHidlEnvironment* Instance() {
|
||||||
|
static TvInputHidlEnvironment* instance = new TvInputHidlEnvironment;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void registerTestServices() override { registerTestService<ITvInput>(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
TvInputHidlEnvironment() {}
|
||||||
|
};
|
||||||
|
|
||||||
/* The main test class for TV Input HIDL HAL. */
|
/* The main test class for TV Input HIDL HAL. */
|
||||||
class TvInputHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
class TvInputHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() override {
|
virtual void SetUp() override {
|
||||||
tv_input_ = ::testing::VtsHalHidlTargetTestBase::getService<ITvInput>();
|
tv_input_ = ::testing::VtsHalHidlTargetTestBase::getService<ITvInput>(
|
||||||
|
TvInputHidlEnvironment::Instance()->getServiceName<ITvInput>());
|
||||||
ASSERT_NE(tv_input_, nullptr);
|
ASSERT_NE(tv_input_, nullptr);
|
||||||
tv_input_callback_ = new TvInputCallback(*this);
|
tv_input_callback_ = new TvInputCallback(*this);
|
||||||
ASSERT_NE(tv_input_callback_, nullptr);
|
ASSERT_NE(tv_input_callback_, nullptr);
|
||||||
@@ -187,15 +203,6 @@ class TvInputHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* A class for test environment setup. */
|
|
||||||
class TvInputHidlEnvironment : public ::testing::Environment {
|
|
||||||
public:
|
|
||||||
virtual void SetUp() {}
|
|
||||||
virtual void TearDown() {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GetStreamConfigTest:
|
* GetStreamConfigTest:
|
||||||
* Calls updateStreamConfigurations() for each existing device
|
* Calls updateStreamConfigurations() for each existing device
|
||||||
@@ -354,8 +361,9 @@ TEST_F(TvInputHidlTest, CloseStreamBeforeOpenTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
::testing::AddGlobalTestEnvironment(new TvInputHidlEnvironment);
|
::testing::AddGlobalTestEnvironment(TvInputHidlEnvironment::Instance());
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
TvInputHidlEnvironment::Instance()->init(&argc, argv);
|
||||||
int status = RUN_ALL_TESTS();
|
int status = RUN_ALL_TESTS();
|
||||||
ALOGI("Test result = %d", status);
|
ALOGI("Test result = %d", status);
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
Reference in New Issue
Block a user