secure_element: vts: Fix openBasicChannel and transmit test case

Status Response for basic channel can be only 2 bytes as well.
Update the test to test for 2 or more bytes.
Basic Channel if opened successfully should be closed.

Transmit test case should specify the channel number in the command.

Test: atest VtsHalSecureElementV1_0TargetTest
Bug: 109833790
Change-Id: I91c943b4297067f6ae6872efb038f1295f92f5c8
Merged-In: I91c943b4297067f6ae6872efb038f1295f92f5c8
This commit is contained in:
Ruchi Kandoi
2018-06-06 15:21:41 -07:00
parent 913c071391
commit 0845d32131

View File

@@ -134,6 +134,7 @@ TEST_F(SecureElementHidlTest, transmit) {
EXPECT_LE((unsigned int)2, response.selectResponse.size());
EXPECT_LE(1, response.channelNumber);
std::vector<uint8_t> command = DATA_APDU;
command[0] |= response.channelNumber;
std::vector<uint8_t> transmitResponse;
se_->transmit(command, [&transmitResponse](std::vector<uint8_t> res) {
transmitResponse.resize(res.size());
@@ -168,7 +169,8 @@ TEST_F(SecureElementHidlTest, openBasicChannel) {
}
});
if (statusReturned == SecureElementStatus::SUCCESS) {
EXPECT_LE((unsigned int)3, response.size());
EXPECT_LE((unsigned int)2, response.size());
se_->closeChannel(0);
return;
}
EXPECT_EQ(SecureElementStatus::UNSUPPORTED_OPERATION, statusReturned);