summaryrefslogtreecommitdiffstats
path: root/ir
diff options
context:
space:
mode:
authorZhuoyao Zhang2018-02-09 18:34:41 -0600
committerZhuoyao Zhang2018-02-10 21:35:49 -0600
commit146b8f8093f248fac849304da9b853fb8a994ca4 (patch)
tree2e056dc7fdd5b210790c3b955546baf1d4628bf6 /ir
parent8f7ff5730b152542d476b039b15601785e3b777a (diff)
downloadplatform-hardware-interfaces-146b8f8093f248fac849304da9b853fb8a994ca4.tar.gz
platform-hardware-interfaces-146b8f8093f248fac849304da9b853fb8a994ca4.tar.xz
platform-hardware-interfaces-146b8f8093f248fac849304da9b853fb8a994ca4.zip
Convert ir hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181 Test: make vts vts-tradefed run vts -m VtsHalIrV1_0Target Change-Id: If3f7fcd04ce6d1e2a499a62807e186f36a771748
Diffstat (limited to 'ir')
-rw-r--r--ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
index a0174046..5fd2dd4c 100644
--- a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
+++ b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
@@ -22,6 +22,7 @@
22#include <android/hardware/ir/1.0/types.h> 22#include <android/hardware/ir/1.0/types.h>
23 23
24#include <VtsHalHidlTargetTestBase.h> 24#include <VtsHalHidlTargetTestBase.h>
25#include <VtsHalHidlTargetTestEnvBase.h>
25#include <algorithm> 26#include <algorithm>
26 27
27using ::android::hardware::ir::V1_0::IConsumerIr; 28using ::android::hardware::ir::V1_0::IConsumerIr;
@@ -30,11 +31,26 @@ using ::android::hardware::hidl_vec;
30using ::android::hardware::Return; 31using ::android::hardware::Return;
31using ::android::sp; 32using ::android::sp;
32 33
34// Test environment for Ir
35class ConsumerIrHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
36 public:
37 // get the test environment singleton
38 static ConsumerIrHidlEnvironment* Instance() {
39 static ConsumerIrHidlEnvironment* instance = new ConsumerIrHidlEnvironment;
40 return instance;
41 }
42
43 virtual void registerTestServices() override { registerTestService<IConsumerIr>(); }
44 private:
45 ConsumerIrHidlEnvironment() {}
46};
47
33// The main test class for IR HIDL HAL. 48// The main test class for IR HIDL HAL.
34class ConsumerIrHidlTest : public ::testing::VtsHalHidlTargetTestBase { 49class ConsumerIrHidlTest : public ::testing::VtsHalHidlTargetTestBase {
35 public: 50 public:
36 virtual void SetUp() override { 51 virtual void SetUp() override {
37 ir = ::testing::VtsHalHidlTargetTestBase::getService<IConsumerIr>(); 52 ir = ::testing::VtsHalHidlTargetTestBase::getService<IConsumerIr>(
53 ConsumerIrHidlEnvironment::Instance()->getServiceName<IConsumerIr>());
38 ASSERT_NE(ir, nullptr); 54 ASSERT_NE(ir, nullptr);
39 } 55 }
40 56
@@ -77,7 +93,9 @@ TEST_F(ConsumerIrHidlTest, BadFreqTest) {
77} 93}
78 94
79int main(int argc, char **argv) { 95int main(int argc, char **argv) {
96 ::testing::AddGlobalTestEnvironment(ConsumerIrHidlEnvironment::Instance());
80 ::testing::InitGoogleTest(&argc, argv); 97 ::testing::InitGoogleTest(&argc, argv);
98 ConsumerIrHidlEnvironment::Instance()->init(&argc, argv);
81 int status = RUN_ALL_TESTS(); 99 int status = RUN_ALL_TESTS();
82 LOG(INFO) << "Test result = " << status; 100 LOG(INFO) << "Test result = " << status;
83 return status; 101 return status;