summaryrefslogtreecommitdiffstats
path: root/ir
diff options
context:
space:
mode:
authorZhuoyao Zhang2018-02-11 00:07:52 -0600
committerandroid-build-merger2018-02-11 00:07:52 -0600
commit3a2fa4da5c8ba0ed3caef7dfb7b9ed8e0e75da64 (patch)
tree7c159c62eaff7cbbb315686d0371f208f840ea21 /ir
parent22b413bdd8d724a48b15e95793965283a88c9240 (diff)
parent2896c30cfb374f684381f9cd1851a017ba876cdc (diff)
downloadplatform-hardware-interfaces-3a2fa4da5c8ba0ed3caef7dfb7b9ed8e0e75da64.tar.gz
platform-hardware-interfaces-3a2fa4da5c8ba0ed3caef7dfb7b9ed8e0e75da64.tar.xz
platform-hardware-interfaces-3a2fa4da5c8ba0ed3caef7dfb7b9ed8e0e75da64.zip
Merge "Convert ir hal test to use VtsHalHidlTargetTestEnvBase" am: e5c6cdccba am: 462255199b
am: 2896c30cfb Change-Id: I7f1e233de9108dc500e77f43b491ff9b045cbb0f
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;