From 36193658d22841d4aec1c9ce1353580cac6ac43e Mon Sep 17 00:00:00 2001 From: Ruchi Kandoi Date: Thu, 15 Jun 2017 13:22:51 -0700 Subject: Nfc: Vts: modify WriteInvalidAndThenValidCommand Invalid Data packets are ignored by the NFC controller in case there isn't an active RF Interface. The test expects response for the invalid data packet without any active RF Interface. This patch modifies the test to send an invalid command instead which will guarantee a response. Test: run vts test Bug: 62400568 Change-Id: I7db1d5209b6ef2240ac248f3aba0e27e0a285018 Signed-off-by: Ruchi Kandoi (cherry picked from commit c86df4dcb74224ea7befc2cb610e43d0df6814ae) --- nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp index 094e8a16ea..e67f94f723 100644 --- a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp +++ b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp @@ -46,8 +46,6 @@ using ::android::sp; { 0x20, 0x01, 0x00 } #define INVALID_COMMAND \ { 0x20, 0x00, 0x00 } -#define FAULTY_DATA_PACKET \ - { 0x00, 0x00, 0xFF } #define LOOP_BACK_HEADER_SIZE 3 #define SYNTAX_ERROR 5 @@ -271,8 +269,8 @@ TEST_F(NfcHidlTest, WriteInvalidCommand) { /* * WriteInvalidAndThenValidCommand: - * Sends an Faulty Data Packet - * Waits for CORE_INTERFACE_ERROR_NTF + * Sends an Invalid command + * Waits for response * Checks SYNTAX_ERROR status * Repeat for 100 times appending 0xFF each time to the packet * Send CORE_CONN_CREATE_CMD for loop-back mode @@ -303,7 +301,7 @@ TEST_F(NfcHidlTest, WriteInvalidAndThenValidCommand) { EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]); // Send an Error Data Packet - cmd = FAULTY_DATA_PACKET; + cmd = INVALID_COMMAND; data = cmd; size_t size = data.size(); @@ -311,13 +309,10 @@ TEST_F(NfcHidlTest, WriteInvalidAndThenValidCommand) { data.resize(++size); data[size - 1] = 0xFF; EXPECT_EQ(data.size(), nfc_->write(data)); - // Wait for CORE_INTERFACE_ERROR_NTF + // Wait for response with SYNTAX_ERROR res = nfc_cb_->WaitForCallback(kCallbackNameSendData); EXPECT_TRUE(res.no_timeout); - EXPECT_EQ(5ul, res.args->last_data_.size()); - EXPECT_EQ(0x60, res.args->last_data_[0]); - EXPECT_EQ(0x08, res.args->last_data_[1]); - EXPECT_EQ(0x02, res.args->last_data_[2]); + EXPECT_EQ(4ul, res.args->last_data_.size()); EXPECT_EQ(SYNTAX_ERROR, res.args->last_data_[3]); } -- cgit v1.2.3