summaryrefslogtreecommitdiffstats
path: root/authsecret
diff options
context:
space:
mode:
authorZhuoyao Zhang <zhuoyao@google.com>2018-02-28 18:04:10 -0800
committerZhuoyao Zhang <zhuoyao@google.com>2018-02-28 18:05:31 -0800
commit3c3b000d28eb35ff31c4983feaa4fe74dc7481f5 (patch)
tree5859f62183ac90750728f9f968a7fd52da4a6219 /authsecret
parentccacc1ded521db2e430ebf1b561eb14e808b1de4 (diff)
downloadandroid_hardware_interfaces-3c3b000d28eb35ff31c4983feaa4fe74dc7481f5.tar.gz
android_hardware_interfaces-3c3b000d28eb35ff31c4983feaa4fe74dc7481f5.tar.bz2
android_hardware_interfaces-3c3b000d28eb35ff31c4983feaa4fe74dc7481f5.zip
Convert auth secret hal test to use VtsHalHidlTargetTestEnvBase
Test: make vts vts-tradefed run vts-hal -m VtsHalAuthSecretV1_0Target Change-Id: Ib66e101a78b4b6d66a426c36112b1cf0b95afda3
Diffstat (limited to 'authsecret')
-rw-r--r--authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp b/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp
index a610a755b..255d4de3f 100644
--- a/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp
+++ b/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp
@@ -17,18 +17,35 @@
#include <android/hardware/authsecret/1.0/IAuthSecret.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using ::android::hardware::hidl_vec;
using ::android::hardware::authsecret::V1_0::IAuthSecret;
using ::android::sp;
+// Test environment for Boot HIDL HAL.
+class AuthSecretHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static AuthSecretHidlEnvironment* Instance() {
+ static AuthSecretHidlEnvironment* instance = new AuthSecretHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IAuthSecret>(); }
+
+ private:
+ AuthSecretHidlEnvironment() {}
+};
+
/**
* There is no expected behaviour that can be tested so these tests check the
* HAL doesn't crash with different execution orders.
*/
struct AuthSecretHidlTest : public ::testing::VtsHalHidlTargetTestBase {
virtual void SetUp() override {
- authsecret = ::testing::VtsHalHidlTargetTestBase::getService<IAuthSecret>();
+ authsecret = ::testing::VtsHalHidlTargetTestBase::getService<IAuthSecret>(
+ AuthSecretHidlEnvironment::Instance()->getServiceName<IAuthSecret>());
ASSERT_NE(authsecret, nullptr);
// All tests must enroll the correct secret first as this cannot be changed
@@ -69,3 +86,12 @@ TEST_F(AuthSecretHidlTest, provisionPrimaryUserCredentialAndWrongSecret) {
// Secret provisioned by SetUp()
authsecret->primaryUserCredential(WRONG_SECRET);
}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(AuthSecretHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ AuthSecretHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}