summaryrefslogtreecommitdiffstats
path: root/boot
diff options
context:
space:
mode:
authorZhuoyao Zhang2017-12-04 19:16:53 -0600
committerandroid-build-merger2017-12-04 19:16:53 -0600
commitcc0933aa4502fb293798fcf95e263a8818baf0cb (patch)
tree0b88c42102f1c5714c00f48d16e6f45ffc41b2a3 /boot
parent85a3fa9d65223a8960c025325d8a7b852e1be94a (diff)
parent6ab5305323f59510e7e83be06bf5ef5d8331453b (diff)
downloadplatform-hardware-interfaces-cc0933aa4502fb293798fcf95e263a8818baf0cb.tar.gz
platform-hardware-interfaces-cc0933aa4502fb293798fcf95e263a8818baf0cb.tar.xz
platform-hardware-interfaces-cc0933aa4502fb293798fcf95e263a8818baf0cb.zip
Merge "Convert boot, memtrack and power hal to use service name aware testing." am: b9515d9d3f am: a713584847
am: 6ab5305323 Change-Id: I0f8598253e34b08e73b8b65ff7fe91d937d5d8ad
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}