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

Commit 91d50482 authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge "Enhance and refactoring the Tuner VTS on searching frontend by type test" into rvc-dev

parents b82cdd09 050bf786
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ Return<Result> Frontend::close() {
    ALOGV("%s", __FUNCTION__);
    // Reset callback
    mCallback = nullptr;
    mIsLocked = false;

    return Result::SUCCESS;
}
@@ -64,6 +65,7 @@ Return<Result> Frontend::tune(const FrontendSettings& /* settings */) {
    }

    mCallback->onEvent(FrontendEventType::LOCKED);
    mIsLocked = false;
    return Result::SUCCESS;
}

@@ -71,16 +73,35 @@ Return<Result> Frontend::stopTune() {
    ALOGV("%s", __FUNCTION__);

    mTunerService->frontendStopTune(mId);
    mIsLocked = false;

    return Result::SUCCESS;
}

Return<Result> Frontend::scan(const FrontendSettings& /* settings */, FrontendScanType /* type */) {
Return<Result> 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<Result> Frontend::scan(const FrontendSettings& /* settings */, FrontendSc
Return<Result> Frontend::stopScan() {
    ALOGV("%s", __FUNCTION__);

    mIsLocked = false;
    return Result::SUCCESS;
}

+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ class Frontend : public IFrontend {
    sp<Tuner> mTunerService;
    FrontendType mType = FrontendType::UNDEFINED;
    FrontendId mId = 0;
    bool mIsLocked = false;

    const string FRONTEND_STREAM_FILE = "/vendor/etc/dumpTs3.ts";
    std::ifstream mFrontendData;
+46 −32
Original line number Diff line number Diff line
@@ -106,9 +106,20 @@ Return<void> Tuner::openDescrambler(openDescrambler_cb _hidl_cb) {
    return Void();
}

Return<void> Tuner::getFrontendInfo(FrontendId /*frontendId*/, getFrontendInfo_cb _hidl_cb) {
Return<void> Tuner::getFrontendInfo(FrontendId frontendId, getFrontendInfo_cb _hidl_cb) {
    ALOGV("%s", __FUNCTION__);

    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<FrontendStatusType> statusCaps = {
                    FrontendStatusType::DEMOD_LOCK,
                    FrontendStatusType::SNR,
@@ -124,12 +135,13 @@ Return<void> Tuner::getFrontendInfo(FrontendId /*frontendId*/, getFrontendInfo_c
                    .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,
                    .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{
            info = {
                    .type = FrontendType::ISDBT,
                    .minFrequency = 139,
                    .maxFrequency = 1139,
@@ -140,6 +152,8 @@ Return<void> Tuner::getFrontendInfo(FrontendId /*frontendId*/, getFrontendInfo_c
                    .statusCaps = statusCaps,
                    .frontendCaps = frontendCaps,
            };
            break;
    }

    _hidl_cb(Result::SUCCESS, info);
    return Void();
+109 −240
Original line number Diff line number Diff line
@@ -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<std::string> {

    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<std::string> {
                                       RecordSettings recordSetting,
                                       vector<string> goldenOutputFiles);
    AssertionResult broadcastDataFlowTest(vector<string> 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<IFrontend>& 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<string> /*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> 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,139 +1443,39 @@ 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]));
    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());
        break;
    }
}

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]));
    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(mFeIds[i]));
    ASSERT_TRUE(setDemuxFrontendDataSource(feId));
    ASSERT_TRUE(openFilterInDemux(filterArray[TS_VIDEO0].type));
    uint32_t filterId;
    ASSERT_TRUE(getNewlyOpenedFilterId(filterId));
@@ -1546,8 +1486,6 @@ TEST_P(TunerHidlTest, StartFilterInDemux) {
    ASSERT_TRUE(closeFilter(filterId));
    ASSERT_TRUE(closeDemux());
    ASSERT_TRUE(closeFrontend());
        break;
    }
}
/*============================ 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