summaryrefslogtreecommitdiffstats
path: root/configstore
diff options
context:
space:
mode:
authorZhuoyao Zhang <zhuoyao@google.com>2018-02-08 20:46:32 -0800
committerZhuoyao Zhang <zhuoyao@google.com>2018-02-08 21:31:57 -0800
commitd198ea4c094bf2bbba559a8f7f4e4303440441ab (patch)
treebb1f23b4dc2c48e74855ac8c292b0c0214ab47cc /configstore
parent8f7ff5730b152542d476b039b15601785e3b777a (diff)
downloadplatform_hardware_interfaces-d198ea4c094bf2bbba559a8f7f4e4303440441ab.tar.gz
platform_hardware_interfaces-d198ea4c094bf2bbba559a8f7f4e4303440441ab.tar.bz2
platform_hardware_interfaces-d198ea4c094bf2bbba559a8f7f4e4303440441ab.zip
Convert configstore hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181 Test: make vts vts-tradefed run vts -m VtsHalConfigstoreV1_0Target Change-Id: I4ba993d41e285df790c267e84b484f1564047e1e
Diffstat (limited to 'configstore')
-rw-r--r--configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp b/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp
index e501580935..a1676be2b7 100644
--- a/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp
+++ b/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "ConfigstoreHidlHalTest"
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/logging.h>
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <android/hardware/configstore/1.0/types.h>
@@ -34,13 +35,25 @@ using ::android::sp;
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
+// Test environment for Configstore HIDL HAL.
+class ConfigstoreHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static ConfigstoreHidlEnvironment* Instance() {
+ static ConfigstoreHidlEnvironment* instance = new ConfigstoreHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<ISurfaceFlingerConfigs>(); }
+};
+
class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
sp<ISurfaceFlingerConfigs> sfConfigs;
virtual void SetUp() override {
- sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<
- ISurfaceFlingerConfigs>();
+ sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<ISurfaceFlingerConfigs>(
+ ConfigstoreHidlEnvironment::Instance()->getServiceName<ISurfaceFlingerConfigs>());
ASSERT_NE(sfConfigs, nullptr);
}
@@ -119,7 +132,9 @@ TEST_F(ConfigstoreHidlTest, TestSameReturnValue) {
}
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(ConfigstoreHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ ConfigstoreHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;