summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorZhuoyao Zhang <zhuoyao@google.com>2018-02-08 21:16:16 -0800
committerZhuoyao Zhang <zhuoyao@google.com>2018-02-08 21:53:09 -0800
commitff7abc09d1f640a32a7e1632b63e6422ef49fa56 (patch)
tree00ea59813949f552a79fe8245dd40be48aeb7347 /weaver
parent8f7ff5730b152542d476b039b15601785e3b777a (diff)
downloadplatform_hardware_interfaces-ff7abc09d1f640a32a7e1632b63e6422ef49fa56.tar.gz
platform_hardware_interfaces-ff7abc09d1f640a32a7e1632b63e6422ef49fa56.tar.bz2
platform_hardware_interfaces-ff7abc09d1f640a32a7e1632b63e6422ef49fa56.zip
onvert weaver hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181 Test: make vts vts-tradefed run vts -m VtsHalWeaverV1_0Target Change-Id: I6d59b2b1cdf166fba706edea30bf1e0f0e8f33e6
Diffstat (limited to 'weaver')
-rw-r--r--weaver/1.0/vts/functional/VtsHalWeaverV1_0TargetTest.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/weaver/1.0/vts/functional/VtsHalWeaverV1_0TargetTest.cpp b/weaver/1.0/vts/functional/VtsHalWeaverV1_0TargetTest.cpp
index 372d78715b..de2a1de861 100644
--- a/weaver/1.0/vts/functional/VtsHalWeaverV1_0TargetTest.cpp
+++ b/weaver/1.0/vts/functional/VtsHalWeaverV1_0TargetTest.cpp
@@ -19,6 +19,7 @@
#include <limits>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using ::android::hardware::weaver::V1_0::IWeaver;
using ::android::hardware::weaver::V1_0::WeaverConfig;
@@ -33,9 +34,22 @@ const std::vector<uint8_t> WRONG_KEY{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
const std::vector<uint8_t> VALUE{16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
const std::vector<uint8_t> OTHER_VALUE{0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 255, 255};
+// Test environment for Weaver HIDL HAL.
+class WeaverHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static WeaverHidlEnvironment* Instance() {
+ static WeaverHidlEnvironment* instance = new WeaverHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IWeaver>(); }
+};
+
struct WeaverHidlTest : public ::testing::VtsHalHidlTargetTestBase {
virtual void SetUp() override {
- weaver = ::testing::VtsHalHidlTargetTestBase::getService<IWeaver>();
+ weaver = ::testing::VtsHalHidlTargetTestBase::getService<IWeaver>(
+ WeaverHidlEnvironment::Instance()->getServiceName<IWeaver>());
ASSERT_NE(weaver, nullptr);
}
@@ -334,3 +348,12 @@ TEST_F(WeaverHidlTest, ReadWithTooLargeKeyFails) {
EXPECT_TRUE(readValue.empty());
EXPECT_EQ(timeout, 0u);
}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(WeaverHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ WeaverHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}