Convert gatekeeper hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181 Test: make vts vts-tradefed run vts -m VtsHalGatekeeperV1_0Target Change-Id: I55aa7abbb8c5ffa504aac1ed79a07de1139d606b
This commit is contained in:
parent
8f7ff5730b
commit
fce6cdc995
1 changed files with 19 additions and 1 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <log/log.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
@ -77,6 +78,20 @@ static const hw_auth_token_t *toAuthToken(GatekeeperResponse &rsp) {
|
|||
return auth_token;
|
||||
}
|
||||
|
||||
// Test environment for Gatekeeper HIDL HAL.
|
||||
class GatekeeperHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static GatekeeperHidlEnvironment* Instance() {
|
||||
static GatekeeperHidlEnvironment* instance = new GatekeeperHidlEnvironment;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override { registerTestService<IGatekeeper>(); }
|
||||
private:
|
||||
GatekeeperHidlEnvironment() {}
|
||||
};
|
||||
|
||||
// The main test class for Gatekeeper HIDL HAL.
|
||||
class GatekeeperHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
protected:
|
||||
|
@ -189,7 +204,8 @@ class GatekeeperHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
GatekeeperHidlTest() : uid_(0) {}
|
||||
virtual void SetUp() override {
|
||||
GatekeeperResponse rsp;
|
||||
gatekeeper_ = ::testing::VtsHalHidlTargetTestBase::getService<IGatekeeper>();
|
||||
gatekeeper_ = ::testing::VtsHalHidlTargetTestBase::getService<IGatekeeper>(
|
||||
GatekeeperHidlEnvironment::Instance()->getServiceName<IGatekeeper>());
|
||||
ASSERT_NE(nullptr, gatekeeper_.get());
|
||||
doDeleteAllUsers(rsp);
|
||||
}
|
||||
|
@ -433,7 +449,9 @@ TEST_F(GatekeeperHidlTest, DeleteAllUsersTest) {
|
|||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::AddGlobalTestEnvironment(GatekeeperHidlEnvironment::Instance());
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
GatekeeperHidlEnvironment::Instance()->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
return status;
|
||||
|
|
Loading…
Reference in a new issue