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. Change-Id: Idd78c0dae944e3d39a6828b43db5a608adbaf1d9 Signed-off-by: Bruno Carneiro <bccunha@motorola.com>
This commit is contained in:
parent
0f141d1967
commit
056aa140ca
1 changed files with 11 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue