Extend broadcast radio VTS tests by tuner reopening scenario.
Bug: b/33779707, b/33382424
Test: VTS
Change-Id: Icd60ed9109a379d7c7ae385f479c08fd5011ed7f
diff --git a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
index 4212729..0e5f1fb 100644
--- a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
+++ b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
@@ -305,6 +305,40 @@
}
/**
+ * Test IBroadcastRadio::openTuner() after ITuner disposal.
+ *
+ * Verifies that:
+ * - ITuner destruction gets propagated through HAL
+ * - the openTuner method works well when called for the second time
+ */
+TEST_F(BroadcastRadioHidlTest, ReopenTuner) {
+ EXPECT_TRUE(openTuner());
+ mTuner.clear();
+ EXPECT_TRUE(openTuner());
+}
+
+/**
+ * Test IBroadcastRadio::openTuner() method called twice.
+ *
+ * Verifies that:
+ * - the openTuner method fails when called for the second time without deleting previous
+ * ITuner instance
+ */
+TEST_F(BroadcastRadioHidlTest, OpenTunerTwice) {
+ EXPECT_TRUE(openTuner());
+
+ Result halResult = Result::NOT_INITIALIZED;
+ Return<void> hidlReturn =
+ mRadio->openTuner(mHalProperties.bands[0], true, mTunerCallback,
+ [&](Result result, const sp<ITuner>&) {
+ halResult = result;
+ });
+ EXPECT_TRUE(hidlReturn.isOk());
+ EXPECT_EQ(Result::INVALID_STATE, halResult);
+ EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
+}
+
+/**
* Test ITuner::setConfiguration() and getConfiguration methods
*
* Verifies that: