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

Commit 8d3cb52e authored by Bruno Carneiro's avatar Bruno Carneiro Committed by Roshan Pius
Browse files

Improve OpenAfterOpen VTS test



A callback should be executed every time the NFC interface is opened,
even in OpenAfterOpen scenarios. If a callback is not executed, a
crash may occur where the NfcService hangs while waiting for an
OPEN_CPLT event.

Bug: 327582461
Merged-In: Idd78c0dae944e3d39a6828b43db5a608adbaf1d9
Change-Id: Idd78c0dae944e3d39a6828b43db5a608adbaf1d9
Signed-off-by: default avatarBruno Carneiro <bccunha@motorola.com>
(cherry picked from commit 056aa140)
parent 59aeb318
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -562,7 +562,18 @@ TEST_P(NfcHidlTest, CloseAfterClose) {
 */
TEST_P(NfcHidlTest, OpenAfterOpen) {
  EXPECT_EQ(NfcStatus::OK, nfc_->open(nfc_cb_));
  // Wait for OPEN_CPLT event
  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
  EXPECT_TRUE(res.no_timeout);
  EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);

  EXPECT_EQ(NfcStatus::OK, nfc_->open(nfc_cb_));
  // Wait for OPEN_CPLT event
  res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
  EXPECT_TRUE(res.no_timeout);
  EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
}

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(NfcHidlTest);