Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56abf849 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "secure_element/aidl: update test case transmit" am: 48e57878 am:...

Merge "secure_element/aidl: update test case transmit" am: 48e57878 am: 9f86cee4 am: 3c4dba97 am: 8b0f27d7

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2499635



Change-Id: I8263c4a434e0f66c05f90d6390c2ab19a20c7f9e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 42ec6f38 8b0f27d7
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -284,14 +284,21 @@ TEST_P(SecureElementAidl, closeChannel) {

TEST_P(SecureElementAidl, transmit) {
    std::vector<uint8_t> response;
    LogicalChannelResponse logical_channel_response;

    // transmit called after init shall succeed.
    // Note: no channel is opened for this test and the transmit
    // response will have the status SW_LOGICAL_CHANNEL_NOT_SUPPORTED.
    // The transmit response shall be larger than 2 bytes as it includes the
    // status code.
    EXPECT_OK(secure_element_->transmit(kDataApdu, &response));
    EXPECT_GE(response.size(), 2u);
    // Note: no channel is opened for this test
    // transmit() will return an empty response with the error
    // code CHANNEL_NOT_AVAILABLE when the SE cannot be
    // communicated with.
    EXPECT_ERR(secure_element_->transmit(kDataApdu, &response));

    EXPECT_OK(secure_element_->openLogicalChannel(kSelectableAid, 0x00, &logical_channel_response));
    EXPECT_GE(logical_channel_response.selectResponse.size(), 2u);
    EXPECT_GE(logical_channel_response.channelNumber, 1u);
    EXPECT_LE(logical_channel_response.channelNumber, 19u);

    // transmit called on the logical channel should succeed.
    EXPECT_EQ(transmit(logical_channel_response.channelNumber), 0x9000);
}

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SecureElementAidl);