Merge "Convert evs hal test to use VtsHalHidlTargetTestEnvBase" am: 9be06304d6

am: 7e4209ee06

Change-Id: I42c8114080d5253e602820c6dea22b9dc077c5a2
This commit is contained in:
Zhuoyao Zhang 2018-02-21 22:29:22 +00:00 committed by android-build-merger
commit 02d339c90f

View file

@ -54,7 +54,7 @@ static const float kNanoToSeconds = 0.000000001f;
#include <android/hardware/automotive/evs/1.0/IEvsDisplay.h>
#include <VtsHalHidlTargetTestBase.h>
#include <VtsHalHidlTargetTestEnvBase.h>
using namespace ::android::hardware::automotive::evs::V1_0;
using ::android::hardware::Return;
@ -64,13 +64,28 @@ using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_string;
using ::android::sp;
// Test environment for Evs HIDL HAL.
class EvsHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
public:
// get the test environment singleton
static EvsHidlEnvironment* Instance() {
static EvsHidlEnvironment* instance = new EvsHidlEnvironment;
return instance;
}
virtual void registerTestServices() override { registerTestService<IEvsEnumerator>(); }
private:
EvsHidlEnvironment() {}
};
// The main test class for EVS
class EvsHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
// Make sure we can connect to the enumerator
pEnumerator = IEvsEnumerator::getService(kEnumeratorName);
pEnumerator = getService<IEvsEnumerator>(
EvsHidlEnvironment::Instance()->getServiceName<IEvsEnumerator>(kEnumeratorName));
ASSERT_NE(pEnumerator.get(), nullptr);
}
@ -480,3 +495,12 @@ TEST_F(EvsHidlTest, CameraToDisplayRoundTrip) {
// Explicitly release the display
pEnumerator->closeDisplay(pDisplay);
}
int main(int argc, char** argv) {
::testing::AddGlobalTestEnvironment(EvsHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
EvsHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
return status;
}