From 050bf7864462aa8db54c93473d75b1829cfd7cd7 Mon Sep 17 00:00:00 2001 From: Amy Zhang Date: Fri, 27 Mar 2020 14:54:48 -0700 Subject: [PATCH] Enhance and refactoring the Tuner VTS on searching frontend by type test Test: atest VtsHalTvTunerV1_0TargetTest on cf and vendor device Bug: 150953857 Change-Id: I9c90e34c6b336d20f5456e7f676ced699f166d54 --- tv/tuner/1.0/default/Frontend.cpp | 24 +- tv/tuner/1.0/default/Frontend.h | 1 + tv/tuner/1.0/default/Tuner.cpp | 78 ++-- .../VtsHalTvTunerV1_0TargetTest.cpp | 349 ++++++------------ 4 files changed, 179 insertions(+), 273 deletions(-) diff --git a/tv/tuner/1.0/default/Frontend.cpp b/tv/tuner/1.0/default/Frontend.cpp index bb0d8dcaf9..2cff9be459 100644 --- a/tv/tuner/1.0/default/Frontend.cpp +++ b/tv/tuner/1.0/default/Frontend.cpp @@ -41,6 +41,7 @@ Return Frontend::close() { ALOGV("%s", __FUNCTION__); // Reset callback mCallback = nullptr; + mIsLocked = false; return Result::SUCCESS; } @@ -64,6 +65,7 @@ Return Frontend::tune(const FrontendSettings& /* settings */) { } mCallback->onEvent(FrontendEventType::LOCKED); + mIsLocked = false; return Result::SUCCESS; } @@ -71,16 +73,35 @@ Return Frontend::stopTune() { ALOGV("%s", __FUNCTION__); mTunerService->frontendStopTune(mId); + mIsLocked = false; return Result::SUCCESS; } -Return Frontend::scan(const FrontendSettings& /* settings */, FrontendScanType /* type */) { +Return Frontend::scan(const FrontendSettings& settings, FrontendScanType type) { ALOGV("%s", __FUNCTION__); + if (mType != FrontendType::DVBT) { + return Result::UNAVAILABLE; + } + FrontendScanMessage msg; + + if (mIsLocked) { + msg.isEnd(true); + mCallback->onScanMessage(FrontendScanMessageType::END, msg); + return Result::SUCCESS; + } + + uint32_t frequency = settings.dvbt().frequency; + if (type == FrontendScanType::SCAN_BLIND) { + frequency += 100; + } + msg.frequencies({frequency}); + mCallback->onScanMessage(FrontendScanMessageType::FREQUENCY, msg); msg.isLocked(true); mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg); + mIsLocked = true; return Result::SUCCESS; } @@ -88,6 +109,7 @@ Return Frontend::scan(const FrontendSettings& /* settings */, FrontendSc Return Frontend::stopScan() { ALOGV("%s", __FUNCTION__); + mIsLocked = false; return Result::SUCCESS; } diff --git a/tv/tuner/1.0/default/Frontend.h b/tv/tuner/1.0/default/Frontend.h index b954639956..8a30b91e87 100644 --- a/tv/tuner/1.0/default/Frontend.h +++ b/tv/tuner/1.0/default/Frontend.h @@ -74,6 +74,7 @@ class Frontend : public IFrontend { sp mTunerService; FrontendType mType = FrontendType::UNDEFINED; FrontendId mId = 0; + bool mIsLocked = false; const string FRONTEND_STREAM_FILE = "/vendor/etc/dumpTs3.ts"; std::ifstream mFrontendData; diff --git a/tv/tuner/1.0/default/Tuner.cpp b/tv/tuner/1.0/default/Tuner.cpp index 8fb506132a..6f9a5cf016 100644 --- a/tv/tuner/1.0/default/Tuner.cpp +++ b/tv/tuner/1.0/default/Tuner.cpp @@ -106,40 +106,54 @@ Return Tuner::openDescrambler(openDescrambler_cb _hidl_cb) { return Void(); } -Return Tuner::getFrontendInfo(FrontendId /*frontendId*/, getFrontendInfo_cb _hidl_cb) { +Return Tuner::getFrontendInfo(FrontendId frontendId, getFrontendInfo_cb _hidl_cb) { ALOGV("%s", __FUNCTION__); - vector statusCaps = { - FrontendStatusType::DEMOD_LOCK, - FrontendStatusType::SNR, - FrontendStatusType::FEC, - FrontendStatusType::MODULATION, - FrontendStatusType::PLP_ID, - FrontendStatusType::LAYER_ERROR, - FrontendStatusType::ATSC3_PLP_INFO, - }; - FrontendInfo::FrontendCapabilities frontendCaps; - FrontendIsdbtCapabilities isdbtCaps{ - .modeCap = FrontendIsdbtMode::MODE_1 | FrontendIsdbtMode::MODE_2, - .bandwidthCap = (unsigned int)FrontendIsdbtBandwidth::BANDWIDTH_6MHZ, - .modulationCap = (unsigned int)FrontendIsdbtModulation::MOD_16QAM, - // ISDBT shares coderate and guard interval with DVBT - .coderateCap = FrontendDvbtCoderate::CODERATE_4_5 | FrontendDvbtCoderate::CODERATE_6_7, - .guardIntervalCap = (unsigned int)FrontendDvbtGuardInterval::INTERVAL_1_128, - }; - frontendCaps.isdbtCaps(isdbtCaps); - // assign randomly selected values for testing. - FrontendInfo info{ - .type = FrontendType::ISDBT, - .minFrequency = 139, - .maxFrequency = 1139, - .minSymbolRate = 45, - .maxSymbolRate = 1145, - .acquireRange = 30, - .exclusiveGroupId = 57, - .statusCaps = statusCaps, - .frontendCaps = frontendCaps, - }; + FrontendInfo info; + if (frontendId >= mFrontendSize) { + _hidl_cb(Result::INVALID_ARGUMENT, info); + return Void(); + } + + switch (mFrontends[frontendId]->getFrontendType()) { + case FrontendType::DVBT: + info.type = FrontendType::DVBT; + break; + default: + vector statusCaps = { + FrontendStatusType::DEMOD_LOCK, + FrontendStatusType::SNR, + FrontendStatusType::FEC, + FrontendStatusType::MODULATION, + FrontendStatusType::PLP_ID, + FrontendStatusType::LAYER_ERROR, + FrontendStatusType::ATSC3_PLP_INFO, + }; + FrontendInfo::FrontendCapabilities frontendCaps; + FrontendIsdbtCapabilities isdbtCaps{ + .modeCap = FrontendIsdbtMode::MODE_1 | FrontendIsdbtMode::MODE_2, + .bandwidthCap = (unsigned int)FrontendIsdbtBandwidth::BANDWIDTH_6MHZ, + .modulationCap = (unsigned int)FrontendIsdbtModulation::MOD_16QAM, + // ISDBT shares coderate and guard interval with DVBT + .coderateCap = + FrontendDvbtCoderate::CODERATE_4_5 | FrontendDvbtCoderate::CODERATE_6_7, + .guardIntervalCap = (unsigned int)FrontendDvbtGuardInterval::INTERVAL_1_128, + }; + frontendCaps.isdbtCaps(isdbtCaps); + // assign randomly selected values for testing. + info = { + .type = FrontendType::ISDBT, + .minFrequency = 139, + .maxFrequency = 1139, + .minSymbolRate = 45, + .maxSymbolRate = 1145, + .acquireRange = 30, + .exclusiveGroupId = 57, + .statusCaps = statusCaps, + .frontendCaps = frontendCaps, + }; + break; + } _hidl_cb(Result::SUCCESS, info); return Void(); diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp index 8f83d82afe..5e98367af6 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp @@ -47,6 +47,7 @@ #include "VtsHalTvTunerV1_0TestConfigurations.h" #define WAIT_TIMEOUT 3000000000 +#define INVALID_ID -1 using android::Condition; using android::IMemory; @@ -214,7 +215,7 @@ class FrontendCallback : public IFrontendCallback { // Helper methods uint32_t getTargetFrequency(FrontendSettings settings, FrontendType type); - void resetBlindScanStartingFrequency(FrontendConfig config, uint32_t resetingFreq); + void resetBlindScanStartingFrequency(FrontendConfig& config, uint32_t resetingFreq); private: bool mEventReceived = false; @@ -340,7 +341,7 @@ uint32_t FrontendCallback::getTargetFrequency(FrontendSettings settings, Fronten } } -void FrontendCallback::resetBlindScanStartingFrequency(FrontendConfig config, +void FrontendCallback::resetBlindScanStartingFrequency(FrontendConfig& config, uint32_t resetingFreq) { switch (config.type) { case FrontendType::ANALOG: @@ -856,7 +857,7 @@ class TunerHidlTest : public testing::TestWithParam { AssertionResult getFrontendIds(); AssertionResult getFrontendInfo(uint32_t frontendId); - AssertionResult openFrontend(uint32_t frontendId); + AssertionResult openFrontendById(uint32_t frontendId); AssertionResult setFrontendCallback(); AssertionResult scanFrontend(FrontendConfig config, FrontendScanType type); AssertionResult stopScanFrontend(); @@ -889,7 +890,10 @@ class TunerHidlTest : public testing::TestWithParam { RecordSettings recordSetting, vector goldenOutputFiles); AssertionResult broadcastDataFlowTest(vector goldenOutputFiles); - void broadcastFilterTest(int selectedFilter, int feId); + + void broadcastSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf); + void getFrontendIdByType(FrontendType feType, uint32_t& feId); + void scanTest(FrontendConfig frontend, FrontendScanType type); FilterEventType getFilterEventType(DemuxFilterType type); }; @@ -913,7 +917,7 @@ AssertionResult TunerHidlTest::getFrontendInfo(uint32_t frontendId) { return AssertionResult(status == Result::SUCCESS); } -AssertionResult TunerHidlTest::openFrontend(uint32_t frontendId) { +AssertionResult TunerHidlTest::openFrontendById(uint32_t frontendId) { Result status; mService->openFrontendById(frontendId, [&](Result result, const sp& frontend) { mFrontend = frontend; @@ -923,7 +927,7 @@ AssertionResult TunerHidlTest::openFrontend(uint32_t frontendId) { } AssertionResult TunerHidlTest::setFrontendCallback() { - EXPECT_TRUE(mFrontend) << "Test with openFrontend first."; + EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; mFrontendCallback = new FrontendCallback(); auto callbackStatus = mFrontend->setCallback(mFrontendCallback); return AssertionResult(callbackStatus.isOk()); @@ -931,7 +935,7 @@ AssertionResult TunerHidlTest::setFrontendCallback() { AssertionResult TunerHidlTest::scanFrontend(FrontendConfig config, FrontendScanType type) { EXPECT_TRUE(mFrontendCallback) - << "test with openFrontend/setFrontendCallback/getFrontendInfo first."; + << "test with openFrontendById/setFrontendCallback/getFrontendInfo first."; EXPECT_TRUE(mFrontendInfo.type == config.type) << "FrontendConfig does not match the frontend info of the given id."; @@ -941,7 +945,7 @@ AssertionResult TunerHidlTest::scanFrontend(FrontendConfig config, FrontendScanT } AssertionResult TunerHidlTest::stopScanFrontend() { - EXPECT_TRUE(mFrontend) << "Test with openFrontend first."; + EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; Result status; status = mFrontend->stopScan(); return AssertionResult(status == Result::SUCCESS); @@ -949,7 +953,7 @@ AssertionResult TunerHidlTest::stopScanFrontend() { AssertionResult TunerHidlTest::tuneFrontend(FrontendConfig config) { EXPECT_TRUE(mFrontendCallback) - << "test with openFrontend/setFrontendCallback/getFrontendInfo first."; + << "test with openFrontendById/setFrontendCallback/getFrontendInfo first."; EXPECT_TRUE(mFrontendInfo.type == config.type) << "FrontendConfig does not match the frontend info of the given id."; @@ -959,14 +963,14 @@ AssertionResult TunerHidlTest::tuneFrontend(FrontendConfig config) { } AssertionResult TunerHidlTest::stopTuneFrontend() { - EXPECT_TRUE(mFrontend) << "Test with openFrontend first."; + EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; Result status; status = mFrontend->stopTune(); return AssertionResult(status == Result::SUCCESS); } AssertionResult TunerHidlTest::closeFrontend() { - EXPECT_TRUE(mFrontend) << "Test with openFrontend first."; + EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; Result status; status = mFrontend->close(); mFrontend = nullptr; @@ -988,7 +992,7 @@ AssertionResult TunerHidlTest::openDemux() { AssertionResult TunerHidlTest::setDemuxFrontendDataSource(uint32_t frontendId) { EXPECT_TRUE(mDemux) << "Test with openDemux first."; - EXPECT_TRUE(mFrontend) << "Test with openFrontend first."; + EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; auto status = mDemux->setFrontendDataSource(frontendId); return AssertionResult(status.isOk()); } @@ -1184,28 +1188,6 @@ AssertionResult TunerHidlTest::broadcastDataFlowTest(vector /*goldenOutp return success(); } -void TunerHidlTest::broadcastFilterTest(int selectedFilter, int feId) { - ASSERT_TRUE(openFrontend(feId)); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(openDemux()); - ASSERT_TRUE(setDemuxFrontendDataSource(feId)); - ASSERT_TRUE(openFilterInDemux(filterArray[selectedFilter].type)); - uint32_t filterId; - ASSERT_TRUE(getNewlyOpenedFilterId(filterId)); - ASSERT_TRUE(configFilter(filterArray[selectedFilter].setting, filterId)); - ASSERT_TRUE(getFilterMQDescriptor(filterId)); - ASSERT_TRUE(startFilter(filterId)); - // tune test - ASSERT_TRUE(tuneFrontend(frontendArray[DVBT])); - // broadcast data flow test - ASSERT_TRUE(broadcastDataFlowTest(goldenOutputFiles)); - ASSERT_TRUE(stopTuneFrontend()); - ASSERT_TRUE(stopFilter(filterId)); - ASSERT_TRUE(closeFilter(filterId)); - ASSERT_TRUE(closeDemux()); - ASSERT_TRUE(closeFrontend()); -} - /* * TODO: re-enable the tests after finalizing the test refactoring. */ @@ -1351,6 +1333,64 @@ AssertionResult TunerHidlTest::recordDataFlowTest(vector filterConf, }*/ /*========================= End Data Flow Tests Implementation =========================*/ +/*================================= Start Test Module =================================*/ +void TunerHidlTest::getFrontendIdByType(FrontendType feType, uint32_t& feId) { + ASSERT_TRUE(getFrontendIds()); + ASSERT_TRUE(mFeIds.size() > 0); + for (size_t i = 0; i < mFeIds.size(); i++) { + ASSERT_TRUE(getFrontendInfo(mFeIds[i])); + if (mFrontendInfo.type != feType) { + continue; + } + feId = mFeIds[i]; + return; + } + feId = INVALID_ID; +} + +void TunerHidlTest::broadcastSingleFilterTest(FilterConfig filterConf, + FrontendConfig frontendConf) { + uint32_t feId; + getFrontendIdByType(frontendConf.type, feId); + if (feId == INVALID_ID) { + // TODO broadcast test on Cuttlefish needs licensed ts input, + // these tests are runnable on vendor device with real frontend module + // or with manual ts installing and use DVBT frontend. + return; + } + ASSERT_TRUE(openFrontendById(feId)); + ASSERT_TRUE(setFrontendCallback()); + ASSERT_TRUE(openDemux()); + ASSERT_TRUE(setDemuxFrontendDataSource(feId)); + ASSERT_TRUE(openFilterInDemux(filterConf.type)); + uint32_t filterId; + ASSERT_TRUE(getNewlyOpenedFilterId(filterId)); + ASSERT_TRUE(configFilter(filterConf.setting, filterId)); + ASSERT_TRUE(getFilterMQDescriptor(filterId)); + ASSERT_TRUE(startFilter(filterId)); + // tune test + ASSERT_TRUE(tuneFrontend(frontendConf)); + // broadcast data flow test + ASSERT_TRUE(broadcastDataFlowTest(goldenOutputFiles)); + ASSERT_TRUE(stopTuneFrontend()); + ASSERT_TRUE(stopFilter(filterId)); + ASSERT_TRUE(closeFilter(filterId)); + ASSERT_TRUE(closeDemux()); + ASSERT_TRUE(closeFrontend()); +} + +void TunerHidlTest::scanTest(FrontendConfig frontendConf, FrontendScanType scanType) { + uint32_t feId; + getFrontendIdByType(frontendConf.type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(openFrontendById(feId)); + ASSERT_TRUE(setFrontendCallback()); + ASSERT_TRUE(scanFrontend(frontendConf, scanType)); + ASSERT_TRUE(stopScanFrontend()); + ASSERT_TRUE(closeFrontend()); +} +/*================================== End Test Module ==================================*/ + /*=============================== Start Helper Functions ===============================*/ FilterEventType TunerHidlTest::getFilterEventType(DemuxFilterType type) { FilterEventType eventType = FilterEventType::UNDEFINED; @@ -1403,151 +1443,49 @@ FilterEventType TunerHidlTest::getFilterEventType(DemuxFilterType type) { /******************************** Start Test Entry **********************************/ /*============================== Start Frontend Tests ==============================*/ -TEST_P(TunerHidlTest, getFrontendIds) { - description("Get Frontend ids and verify frontends exist"); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); -} - -TEST_P(TunerHidlTest, openFrontend) { - description("Open all the existing Frontends and close them"); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(closeFrontend()); - } -} - TEST_P(TunerHidlTest, TuneFrontend) { description("Tune one Frontend with specific setting and check Lock event"); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(tuneFrontend(frontendArray[DVBT])); - ASSERT_TRUE(stopTuneFrontend()); - ASSERT_TRUE(closeFrontend()); - break; - } + uint32_t feId; + getFrontendIdByType(frontendArray[DVBT].type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(openFrontendById(feId)); + ASSERT_TRUE(setFrontendCallback()); + ASSERT_TRUE(tuneFrontend(frontendArray[DVBT])); + ASSERT_TRUE(stopTuneFrontend()); + ASSERT_TRUE(closeFrontend()); } TEST_P(TunerHidlTest, AutoScanFrontend) { description("Run an auto frontend scan with specific setting and check lock scanMessage"); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendScanArray[SCAN_DVBT].type) { - continue; - } - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(scanFrontend(frontendScanArray[SCAN_DVBT], FrontendScanType::SCAN_AUTO)); - ASSERT_TRUE(stopScanFrontend()); - ASSERT_TRUE(closeFrontend()); - break; - } + scanTest(frontendScanArray[SCAN_DVBT], FrontendScanType::SCAN_AUTO); } TEST_P(TunerHidlTest, BlindScanFrontend) { description("Run an blind frontend scan with specific setting and check lock scanMessage"); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendScanArray[SCAN_DVBT].type) { - continue; - } - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(scanFrontend(frontendScanArray[SCAN_DVBT], FrontendScanType::SCAN_BLIND)); - ASSERT_TRUE(stopScanFrontend()); - ASSERT_TRUE(closeFrontend()); - break; - } + scanTest(frontendScanArray[SCAN_DVBT], FrontendScanType::SCAN_BLIND); } /*=============================== End Frontend Tests ===============================*/ /*============================ Start Demux/Filter Tests ============================*/ -TEST_P(TunerHidlTest, OpenDemuxWithFrontendDataSource) { - description("Open Demux with a Frontend as its data source."); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(openDemux()); - ASSERT_TRUE(setDemuxFrontendDataSource(mFeIds[i])); - ASSERT_TRUE(closeDemux()); - ASSERT_TRUE(closeFrontend()); - break; - } -} - -TEST_P(TunerHidlTest, OpenFilterInDemux) { - description("Open a filter in Demux."); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(openDemux()); - ASSERT_TRUE(setDemuxFrontendDataSource(mFeIds[i])); - ASSERT_TRUE(openFilterInDemux(filterArray[TS_VIDEO0].type)); - uint32_t filterId; - ASSERT_TRUE(getNewlyOpenedFilterId(filterId)); - ASSERT_TRUE(closeFilter(filterId)); - ASSERT_TRUE(closeDemux()); - ASSERT_TRUE(closeFrontend()); - break; - } -} - TEST_P(TunerHidlTest, StartFilterInDemux) { description("Open and start a filter in Demux."); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(openDemux()); - ASSERT_TRUE(setDemuxFrontendDataSource(mFeIds[i])); - ASSERT_TRUE(openFilterInDemux(filterArray[TS_VIDEO0].type)); - uint32_t filterId; - ASSERT_TRUE(getNewlyOpenedFilterId(filterId)); - ASSERT_TRUE(configFilter(filterArray[TS_VIDEO0].setting, filterId)); - ASSERT_TRUE(getFilterMQDescriptor(filterId)); - ASSERT_TRUE(startFilter(filterId)); - ASSERT_TRUE(stopFilter(filterId)); - ASSERT_TRUE(closeFilter(filterId)); - ASSERT_TRUE(closeDemux()); - ASSERT_TRUE(closeFrontend()); - break; - } + uint32_t feId; + getFrontendIdByType(frontendArray[DVBT].type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(openFrontendById(feId)); + ASSERT_TRUE(setFrontendCallback()); + ASSERT_TRUE(openDemux()); + ASSERT_TRUE(setDemuxFrontendDataSource(feId)); + ASSERT_TRUE(openFilterInDemux(filterArray[TS_VIDEO0].type)); + uint32_t filterId; + ASSERT_TRUE(getNewlyOpenedFilterId(filterId)); + ASSERT_TRUE(configFilter(filterArray[TS_VIDEO0].setting, filterId)); + ASSERT_TRUE(getFilterMQDescriptor(filterId)); + ASSERT_TRUE(startFilter(filterId)); + ASSERT_TRUE(stopFilter(filterId)); + ASSERT_TRUE(closeFilter(filterId)); + ASSERT_TRUE(closeDemux()); + ASSERT_TRUE(closeFrontend()); } /*============================ End Demux/Filter Tests ============================*/ @@ -1569,64 +1507,28 @@ TEST_P(TunerHidlTest, CloseDescrambler) { /*============================== Start Data Flow Tests ==============================*/ TEST_P(TunerHidlTest, BroadcastDataFlowVideoFilterTest) { description("Test Video Filter functionality in Broadcast use case."); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - broadcastFilterTest(TS_VIDEO1, mFeIds[i]); - break; - } + broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBS]); } TEST_P(TunerHidlTest, BroadcastDataFlowAudioFilterTest) { description("Test Audio Filter functionality in Broadcast use case."); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - broadcastFilterTest(TS_AUDIO0, mFeIds[i]); - break; - } + broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[DVBS]); } TEST_P(TunerHidlTest, BroadcastDataFlowTsFilterTest) { description("Test TS Filter functionality in Broadcast use case."); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - broadcastFilterTest(TS_TS0, mFeIds[i]); - break; - } + broadcastSingleFilterTest(filterArray[TS_TS0], frontendArray[DVBS]); } TEST_P(TunerHidlTest, BroadcastDataFlowSectionFilterTest) { description("Test Section Filter functionality in Broadcast use case."); - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBT].type) { - continue; - } - broadcastFilterTest(TS_SECTION0, mFeIds[i]); - break; - } + broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[DVBS]); } +TEST_P(TunerHidlTest, IonBufferTest) { + description("Test the av filter data bufferring."); + broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBS]); +} /* * TODO: re-enable the tests after finalizing the testing stream. */ @@ -1710,39 +1612,6 @@ TEST_P(TunerHidlTest, RecordDataFlowWithTsRecordFilterTest) { ASSERT_TRUE(recordDataFlowTest(filterConf, recordSetting, goldenOutputFiles)); }*/ - -TEST_P(TunerHidlTest, AvBufferTest) { - description("Test the av filter data bufferring."); - - ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); - - for (size_t i = 0; i < mFeIds.size(); i++) { - ASSERT_TRUE(getFrontendInfo(mFeIds[i])); - if (mFrontendInfo.type != frontendArray[DVBS].type) { - continue; - } - ASSERT_TRUE(openFrontend(mFeIds[i])); - ASSERT_TRUE(setFrontendCallback()); - ASSERT_TRUE(openDemux()); - ASSERT_TRUE(openFilterInDemux(filterArray[TS_VIDEO0].type)); - uint32_t filterId; - ASSERT_TRUE(getNewlyOpenedFilterId(filterId)); - ASSERT_TRUE(configFilter(filterArray[TS_VIDEO0].setting, filterId)); - ASSERT_TRUE(startFilter(filterId)); - ASSERT_TRUE(setDemuxFrontendDataSource(mFeIds[i])); - // tune test - ASSERT_TRUE(tuneFrontend(frontendArray[DVBS])); - // broadcast data flow test - ASSERT_TRUE(broadcastDataFlowTest(goldenOutputFiles)); - ASSERT_TRUE(stopTuneFrontend()); - ASSERT_TRUE(stopFilter(filterId)); - ASSERT_TRUE(closeFilter(filterId)); - ASSERT_TRUE(closeDemux()); - ASSERT_TRUE(closeFrontend()); - break; - } -} /*============================== End Data Flow Tests ==============================*/ /******************************** End Test Entry **********************************/ } // namespace