summaryrefslogtreecommitdiff
path: root/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp')
-rw-r--r--power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp b/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp
index dc843f49d8..4427b1550e 100644
--- a/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp
+++ b/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp
@@ -19,6 +19,7 @@
#include <android/hardware/power/1.1/IPower.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using ::android::hardware::power::V1_1::IPower;
using ::android::hardware::power::V1_1::PowerStateSubsystem;
@@ -28,11 +29,24 @@ using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::sp;
+// Test environment for Power HIDL HAL.
+class PowerHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static PowerHidlEnvironment* Instance() {
+ static PowerHidlEnvironment* instance = new PowerHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IPower>(); }
+};
+
class PowerHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- power = ::testing::VtsHalHidlTargetTestBase::getService<IPower>();
- ASSERT_NE(power, nullptr);
+ power = ::testing::VtsHalHidlTargetTestBase::getService<IPower>(
+ PowerHidlEnvironment::Instance()->getServiceName<IPower>());
+ ASSERT_NE(power, nullptr);
}
virtual void TearDown() override {}
@@ -91,8 +105,10 @@ TEST_F(PowerHidlTest, PowerHintAsync) {
}
int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
+ ::testing::AddGlobalTestEnvironment(PowerHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ PowerHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
}