summaryrefslogtreecommitdiffstats
path: root/boot
diff options
context:
space:
mode:
authorZhuoyao Zhang2017-12-04 17:12:04 -0600
committerGerrit Code Review2017-12-04 17:12:04 -0600
commitb9515d9d3ff3b21c5466623380946693d5227769 (patch)
tree09069f1809d506edff029b4db0fa6538967d106f /boot
parentf8c89c44e56a2b188f74d1728df1976fb4c9520f (diff)
parent2aba02af56bee0cb756ee4a47cf77b54d380476f (diff)
downloadplatform-hardware-interfaces-b9515d9d3ff3b21c5466623380946693d5227769.tar.gz
platform-hardware-interfaces-b9515d9d3ff3b21c5466623380946693d5227769.tar.xz
platform-hardware-interfaces-b9515d9d3ff3b21c5466623380946693d5227769.zip
Merge "Convert boot, memtrack and power hal to use service name aware testing."
Diffstat (limited to 'boot')
-rw-r--r--boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
index f48a95d8..d1d7f73b 100644
--- a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
+++ b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
@@ -22,6 +22,7 @@
22#include <android/hardware/boot/1.0/IBootControl.h> 22#include <android/hardware/boot/1.0/IBootControl.h>
23 23
24#include <VtsHalHidlTargetTestBase.h> 24#include <VtsHalHidlTargetTestBase.h>
25#include <VtsHalHidlTargetTestEnvBase.h>
25 26
26using ::android::hardware::boot::V1_0::IBootControl; 27using ::android::hardware::boot::V1_0::IBootControl;
27using ::android::hardware::boot::V1_0::CommandResult; 28using ::android::hardware::boot::V1_0::CommandResult;
@@ -33,12 +34,25 @@ using ::android::sp;
33using std::string; 34using std::string;
34using std::vector; 35using std::vector;
35 36
37// Test environment for Boot HIDL HAL.
38class BootHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
39 public:
40 // get the test environment singleton
41 static BootHidlEnvironment* Instance() {
42 static BootHidlEnvironment* instance = new BootHidlEnvironment;
43 return instance;
44 }
45
46 virtual void registerTestServices() override { registerTestService<IBootControl>(); }
47};
48
36// The main test class for the Boot HIDL HAL. 49// The main test class for the Boot HIDL HAL.
37class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase { 50class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase {
38 public: 51 public:
39 virtual void SetUp() override { 52 virtual void SetUp() override {
40 boot = ::testing::VtsHalHidlTargetTestBase::getService<IBootControl>(); 53 boot = ::testing::VtsHalHidlTargetTestBase::getService<IBootControl>(
41 ASSERT_NE(boot, nullptr); 54 BootHidlEnvironment::Instance()->getServiceName<IBootControl>());
55 ASSERT_NE(boot, nullptr);
42 } 56 }
43 57
44 virtual void TearDown() override {} 58 virtual void TearDown() override {}
@@ -171,8 +185,10 @@ TEST_F(BootHidlTest, GetSuffix) {
171} 185}
172 186
173int main(int argc, char **argv) { 187int main(int argc, char **argv) {
174 ::testing::InitGoogleTest(&argc, argv); 188 ::testing::AddGlobalTestEnvironment(BootHidlEnvironment::Instance());
175 int status = RUN_ALL_TESTS(); 189 ::testing::InitGoogleTest(&argc, argv);
176 LOG(INFO) << "Test result = " << status; 190 BootHidlEnvironment::Instance()->init(&argc, argv);
177 return status; 191 int status = RUN_ALL_TESTS();
192 LOG(INFO) << "Test result = " << status;
193 return status;
178} 194}