diff options
author | Ryan Campbell <ryanjcampbell@google.com> | 2017-02-22 11:15:35 -0800 |
---|---|---|
committer | Ryan Campbell <ryanjcampbell@google.com> | 2017-02-22 16:49:01 -0800 |
commit | b7a7754028df16ef29c1fe197b75fc5c2273704a (patch) | |
tree | a9786b97e5cdd207a0c85d6226c083f8f62b5dda /gatekeeper | |
parent | d94a7d2df94fffba0bc59221fad40fc32139110b (diff) | |
download | platform_hardware_interfaces-b7a7754028df16ef29c1fe197b75fc5c2273704a.tar.gz platform_hardware_interfaces-b7a7754028df16ef29c1fe197b75fc5c2273704a.tar.bz2 platform_hardware_interfaces-b7a7754028df16ef29c1fe197b75fc5c2273704a.zip |
Add test case to gatekeeper VTS tests.
Add negative test case for delete user.
Test: run vts -m VtsHalGatekeeperV1_0Target
Bug: 32021941
Change-Id: I0a4c27561761dd83b2e6e30eecca027f3dfa010a
Diffstat (limited to 'gatekeeper')
-rw-r--r-- | gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp b/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp index 67b448222b..7da229318d 100644 --- a/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp +++ b/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp @@ -281,7 +281,6 @@ TEST_F(GatekeeperHidlTest, TrustedReenroll) { */ TEST_F(GatekeeperHidlTest, UntrustedReenroll) { GatekeeperResponse enrollRsp; - GatekeeperRequest reenrollReq; GatekeeperResponse reenrollRsp; GatekeeperResponse verifyRsp; GatekeeperResponse reenrollVerifyRsp; @@ -349,6 +348,37 @@ TEST_F(GatekeeperHidlTest, DeleteUserTest) { } /** + * Ensure we can not delete a user that does not exist + */ +TEST_F(GatekeeperHidlTest, DeleteInvalidUserTest) { + hidl_vec<uint8_t> password; + GatekeeperResponse enrollRsp; + GatekeeperResponse verifyRsp; + GatekeeperResponse delRsp1; + GatekeeperResponse delRsp2; + ALOGI("Testing deleteUser (expected failure)"); + setUid(10002); + generatePassword(password, 0); + enrollNewPassword(password, enrollRsp, true); + verifyPassword(password, enrollRsp.data, 0, verifyRsp, true); + ALOGI("Enroll+Verify done"); + + // Delete the user + doDeleteUser(delRsp1); + EXPECT_EQ(UINT32_C(0), delRsp1.data.size()); + EXPECT_TRUE(delRsp1.code == GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED || + delRsp1.code == GatekeeperStatusCode::STATUS_OK); + + // Delete the user again + doDeleteUser(delRsp2); + EXPECT_EQ(UINT32_C(0), delRsp2.data.size()); + EXPECT_TRUE(delRsp2.code == GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED || + delRsp2.code == GatekeeperStatusCode::ERROR_GENERAL_FAILURE); + ALOGI("DeleteUser done"); + ALOGI("Testing deleteUser done: rsp=%" PRIi32, delRsp2.code); +} + +/** * Ensure we can not verify passwords after we enrolled them and then deleted * all users */ |