diff options
author | Zhuoyao Zhang <zhuoyao@google.com> | 2018-02-24 19:03:12 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-02-24 19:03:12 +0000 |
commit | f9c8a504b8a639f69d154dc4cd85fae19bbfa335 (patch) | |
tree | 2f39322692f936f457796b011a10cf83d215a5f8 /tv | |
parent | 39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a (diff) | |
parent | 8fcb7be38ac07db03dc3e05fce1b6ca2fc43be97 (diff) | |
download | android_hardware_interfaces-f9c8a504b8a639f69d154dc4cd85fae19bbfa335.tar.gz android_hardware_interfaces-f9c8a504b8a639f69d154dc4cd85fae19bbfa335.tar.bz2 android_hardware_interfaces-f9c8a504b8a639f69d154dc4cd85fae19bbfa335.zip |
Merge "Convert tv input hal test to use VtsHalHidlTargetTestEnvBase" am: 184eb86ca0 am: 8bf3afb434
am: 8fcb7be38a
Change-Id: I9f985bad627428dcbd4aa74159f3467b91d5d107
Diffstat (limited to 'tv')
-rw-r--r-- | tv/input/1.0/vts/functional/VtsHalTvInputV1_0TargetTest.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/tv/input/1.0/vts/functional/VtsHalTvInputV1_0TargetTest.cpp b/tv/input/1.0/vts/functional/VtsHalTvInputV1_0TargetTest.cpp index 0d5110e83..573a1d6cb 100644 --- a/tv/input/1.0/vts/functional/VtsHalTvInputV1_0TargetTest.cpp +++ b/tv/input/1.0/vts/functional/VtsHalTvInputV1_0TargetTest.cpp @@ -42,11 +42,27 @@ using ::android::sp; #define WAIT_FOR_EVENT_TIMEOUT 5 #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. */ class TvInputHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: 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); tv_input_callback_ = new TvInputCallback(*this); 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: * Calls updateStreamConfigurations() for each existing device @@ -354,8 +361,9 @@ TEST_F(TvInputHidlTest, CloseStreamBeforeOpenTest) { } int main(int argc, char **argv) { - ::testing::AddGlobalTestEnvironment(new TvInputHidlEnvironment); + ::testing::AddGlobalTestEnvironment(TvInputHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); + TvInputHidlEnvironment::Instance()->init(&argc, argv); int status = RUN_ALL_TESTS(); ALOGI("Test result = %d", status); return status; |