summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp')
-rw-r--r--nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp b/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
index a5b40d47..bef412b6 100644
--- a/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
+++ b/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
@@ -25,6 +25,7 @@
25 25
26#include <VtsHalHidlTargetCallbackBase.h> 26#include <VtsHalHidlTargetCallbackBase.h>
27#include <VtsHalHidlTargetTestBase.h> 27#include <VtsHalHidlTargetTestBase.h>
28#include <VtsHalHidlTargetTestEnvBase.h>
28 29
29using ::android::hardware::nfc::V1_1::INfc; 30using ::android::hardware::nfc::V1_1::INfc;
30using ::android::hardware::nfc::V1_1::INfcClientCallback; 31using ::android::hardware::nfc::V1_1::INfcClientCallback;
@@ -78,6 +79,20 @@ class NfcClientCallback : public ::testing::VtsHalHidlTargetCallbackBase<NfcClie
78 }; 79 };
79}; 80};
80 81
82// Test environment for Nfc HIDL HAL.
83class NfcHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
84 public:
85 // get the test environment singleton
86 static NfcHidlEnvironment* Instance() {
87 static NfcHidlEnvironment* instance = new NfcHidlEnvironment;
88 return instance;
89 }
90
91 virtual void registerTestServices() override { registerTestService<INfc>(); }
92 private:
93 NfcHidlEnvironment() {}
94};
95
81// The main test class for NFC HIDL HAL. 96// The main test class for NFC HIDL HAL.
82class NfcHidlTest : public ::testing::VtsHalHidlTargetTestBase { 97class NfcHidlTest : public ::testing::VtsHalHidlTargetTestBase {
83 public: 98 public:
@@ -127,15 +142,6 @@ class NfcHidlTest : public ::testing::VtsHalHidlTargetTestBase {
127 sp<NfcClientCallback> nfc_cb_; 142 sp<NfcClientCallback> nfc_cb_;
128}; 143};
129 144
130// A class for test environment setup (kept since this file is a template).
131class NfcHidlEnvironment : public ::testing::Environment {
132 public:
133 virtual void SetUp() {}
134 virtual void TearDown() {}
135
136 private:
137};
138
139/* 145/*
140 * factoryReset 146 * factoryReset
141 * calls factoryReset() 147 * calls factoryReset()
@@ -204,8 +210,9 @@ TEST_F(NfcHidlTest, CloseForPowerCaseOffAfterClose) {
204} 210}
205 211
206int main(int argc, char** argv) { 212int main(int argc, char** argv) {
207 ::testing::AddGlobalTestEnvironment(new NfcHidlEnvironment); 213 ::testing::AddGlobalTestEnvironment(NfcHidlEnvironment::Instance());
208 ::testing::InitGoogleTest(&argc, argv); 214 ::testing::InitGoogleTest(&argc, argv);
215 NfcHidlEnvironment::Instance()->init(&argc, argv);
209 216
210 std::system("svc nfc disable"); /* Turn off NFC */ 217 std::system("svc nfc disable"); /* Turn off NFC */
211 sleep(5); 218 sleep(5);