mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 10:05:19 +00:00
Merge "Add Broadcast and Record tests for Frontend with Lnb am: cda23ea38e am: 0946c7228c am: 44b67cc34d" into rvc-qpr-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
16078612d3
@@ -254,7 +254,9 @@ Return<Result> Frontend::setLna(bool /* bEnable */) {
|
||||
|
||||
Return<Result> Frontend::setLnb(uint32_t /* lnb */) {
|
||||
ALOGV("%s", __FUNCTION__);
|
||||
|
||||
if (!supportsSatellite()) {
|
||||
return Result::INVALID_STATE;
|
||||
}
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -270,6 +272,10 @@ string Frontend::getSourceFile() {
|
||||
return FRONTEND_STREAM_FILE;
|
||||
}
|
||||
|
||||
bool Frontend::supportsSatellite() {
|
||||
return mType == FrontendType::DVBS || mType == FrontendType::ISDBS ||
|
||||
mType == FrontendType::ISDBS3;
|
||||
}
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace tuner
|
||||
|
||||
@@ -70,6 +70,7 @@ class Frontend : public IFrontend {
|
||||
|
||||
private:
|
||||
virtual ~Frontend();
|
||||
bool supportsSatellite();
|
||||
sp<IFrontendCallback> mCallback;
|
||||
sp<Tuner> mTunerService;
|
||||
FrontendType mType = FrontendType::UNDEFINED;
|
||||
|
||||
@@ -371,6 +371,14 @@ AssertionResult FrontendTests::tuneFrontend(FrontendConfig config) {
|
||||
return AssertionResult(true);
|
||||
}
|
||||
|
||||
AssertionResult FrontendTests::setLnb(uint32_t lnbId) {
|
||||
if (!mFrontendCallback) {
|
||||
ALOGW("[vts] open and set frontend callback first.");
|
||||
return failure();
|
||||
}
|
||||
return AssertionResult(mFrontend->setLnb(lnbId) == Result::SUCCESS);
|
||||
}
|
||||
|
||||
AssertionResult FrontendTests::stopTuneFrontend() {
|
||||
EXPECT_TRUE(mFrontend) << "Test with openFrontendById first.";
|
||||
Result status;
|
||||
|
||||
@@ -109,6 +109,7 @@ class FrontendTests {
|
||||
AssertionResult scanFrontend(FrontendConfig config, FrontendScanType type);
|
||||
AssertionResult stopScanFrontend();
|
||||
AssertionResult tuneFrontend(FrontendConfig config);
|
||||
AssertionResult setLnb(uint32_t lnbId);
|
||||
void verifyFrontendStatus(vector<FrontendStatusType> statusTypes,
|
||||
vector<FrontendStatus> expectStatuses);
|
||||
AssertionResult stopTuneFrontend();
|
||||
@@ -119,6 +120,9 @@ class FrontendTests {
|
||||
void scanTest(FrontendConfig frontend, FrontendScanType type);
|
||||
|
||||
protected:
|
||||
static AssertionResult failure() { return ::testing::AssertionFailure(); }
|
||||
static AssertionResult success() { return ::testing::AssertionSuccess(); }
|
||||
|
||||
sp<IFrontend> mFrontend;
|
||||
FrontendInfo mFrontendInfo;
|
||||
sp<FrontendCallback> mFrontendCallback;
|
||||
|
||||
@@ -72,6 +72,9 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
|
||||
}
|
||||
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
|
||||
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
|
||||
if (mLnbId) {
|
||||
ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId));
|
||||
}
|
||||
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
|
||||
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
|
||||
mFilterTests.setDemux(demux);
|
||||
@@ -90,6 +93,26 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
|
||||
ASSERT_TRUE(mFrontendTests.closeFrontend());
|
||||
}
|
||||
|
||||
void TunerBroadcastHidlTest::broadcastSingleFilterTestWithLnb(FilterConfig filterConf,
|
||||
FrontendConfig frontendConf,
|
||||
LnbConfig lnbConf) {
|
||||
vector<uint32_t> ids;
|
||||
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
|
||||
if (!lnbConf.usingLnb) {
|
||||
return;
|
||||
}
|
||||
ASSERT_TRUE(ids.size() > 0);
|
||||
ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
|
||||
*mLnbId = ids[0];
|
||||
ASSERT_TRUE(mLnbTests.setLnbCallback());
|
||||
ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
|
||||
ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone));
|
||||
ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position));
|
||||
broadcastSingleFilterTest(filterConf, frontendConf);
|
||||
ASSERT_TRUE(mLnbTests.closeLnb());
|
||||
mLnbId = nullptr;
|
||||
}
|
||||
|
||||
void TunerPlaybackHidlTest::playbackSingleFilterTest(FilterConfig filterConf, DvrConfig dvrConf) {
|
||||
uint32_t demuxId;
|
||||
sp<IDemux> demux;
|
||||
@@ -129,6 +152,9 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf,
|
||||
ASSERT_TRUE(feId != INVALID_ID);
|
||||
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
|
||||
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
|
||||
if (mLnbId) {
|
||||
ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId));
|
||||
}
|
||||
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
|
||||
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
|
||||
mFilterTests.setDemux(demux);
|
||||
@@ -159,6 +185,26 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf,
|
||||
ASSERT_TRUE(mFrontendTests.closeFrontend());
|
||||
}
|
||||
|
||||
void TunerRecordHidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf,
|
||||
FrontendConfig frontendConf,
|
||||
DvrConfig dvrConf, LnbConfig lnbConf) {
|
||||
vector<uint32_t> ids;
|
||||
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
|
||||
if (!lnbConf.usingLnb) {
|
||||
return;
|
||||
}
|
||||
ASSERT_TRUE(ids.size() > 0);
|
||||
ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
|
||||
*mLnbId = ids[0];
|
||||
ASSERT_TRUE(mLnbTests.setLnbCallback());
|
||||
ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
|
||||
ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone));
|
||||
ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position));
|
||||
recordSingleFilterTest(filterConf, frontendConf, dvrConf);
|
||||
ASSERT_TRUE(mLnbTests.closeLnb());
|
||||
mLnbId = nullptr;
|
||||
}
|
||||
|
||||
void TunerRecordHidlTest::attachSingleFilterToRecordDvrTest(FilterConfig filterConf,
|
||||
FrontendConfig frontendConf,
|
||||
DvrConfig dvrConf) {
|
||||
@@ -279,9 +325,10 @@ TEST_P(TunerLnbHidlTest, SendDiseqcMessageToLnb) {
|
||||
description("Open and configure an Lnb with specific settings then send a diseqc msg to it.");
|
||||
vector<uint32_t> ids;
|
||||
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
|
||||
if (ids.size() == 0) {
|
||||
if (!lnbArray[LNB0].usingLnb) {
|
||||
return;
|
||||
}
|
||||
ASSERT_TRUE(ids.size() > 0);
|
||||
ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
|
||||
ASSERT_TRUE(mLnbTests.setLnbCallback());
|
||||
ASSERT_TRUE(mLnbTests.setVoltage(lnbArray[LNB0].voltage));
|
||||
@@ -379,21 +426,26 @@ TEST_P(TunerFilterHidlTest, SetFilterLinkage) {
|
||||
|
||||
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowVideoFilterTest) {
|
||||
description("Test Video Filter functionality in Broadcast use case.");
|
||||
broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBS]);
|
||||
broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBT]);
|
||||
}
|
||||
|
||||
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowAudioFilterTest) {
|
||||
description("Test Audio Filter functionality in Broadcast use case.");
|
||||
broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[DVBS]);
|
||||
broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[DVBT]);
|
||||
}
|
||||
|
||||
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowSectionFilterTest) {
|
||||
description("Test Section Filter functionality in Broadcast use case.");
|
||||
broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[DVBS]);
|
||||
broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[DVBT]);
|
||||
}
|
||||
|
||||
TEST_P(TunerBroadcastHidlTest, IonBufferTest) {
|
||||
description("Test the av filter data bufferring.");
|
||||
broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBT]);
|
||||
}
|
||||
|
||||
TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) {
|
||||
description("Test Video Filter functionality in Broadcast with Lnb use case.");
|
||||
broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBS]);
|
||||
}
|
||||
|
||||
@@ -414,6 +466,11 @@ TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) {
|
||||
recordSingleFilterTest(filterArray[TS_RECORD0], frontendArray[DVBT], dvrArray[DVR_RECORD0]);
|
||||
}
|
||||
|
||||
TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) {
|
||||
description("Feed ts data from Fe with Lnb to recording and test with ts record filter");
|
||||
recordSingleFilterTest(filterArray[TS_RECORD0], frontendArray[DVBS], dvrArray[DVR_RECORD0]);
|
||||
}
|
||||
|
||||
TEST_P(TunerDescramblerHidlTest, CreateDescrambler) {
|
||||
description("Create Descrambler");
|
||||
uint32_t feId;
|
||||
|
||||
@@ -144,6 +144,7 @@ class TunerBroadcastHidlTest : public testing::TestWithParam<std::string> {
|
||||
mFrontendTests.setService(mService);
|
||||
mDemuxTests.setService(mService);
|
||||
mFilterTests.setService(mService);
|
||||
mLnbTests.setService(mService);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -155,10 +156,16 @@ class TunerBroadcastHidlTest : public testing::TestWithParam<std::string> {
|
||||
FrontendTests mFrontendTests;
|
||||
DemuxTests mDemuxTests;
|
||||
FilterTests mFilterTests;
|
||||
LnbTests mLnbTests;
|
||||
|
||||
AssertionResult filterDataOutputTest(vector<string> goldenOutputFiles);
|
||||
|
||||
void broadcastSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf);
|
||||
void broadcastSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf,
|
||||
LnbConfig lnbConf);
|
||||
|
||||
private:
|
||||
uint32_t* mLnbId = nullptr;
|
||||
};
|
||||
|
||||
class TunerPlaybackHidlTest : public testing::TestWithParam<std::string> {
|
||||
@@ -201,6 +208,7 @@ class TunerRecordHidlTest : public testing::TestWithParam<std::string> {
|
||||
mDemuxTests.setService(mService);
|
||||
mFilterTests.setService(mService);
|
||||
mDvrTests.setService(mService);
|
||||
mLnbTests.setService(mService);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -212,12 +220,18 @@ class TunerRecordHidlTest : public testing::TestWithParam<std::string> {
|
||||
DvrConfig dvrConf);
|
||||
void recordSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf,
|
||||
DvrConfig dvrConf);
|
||||
void recordSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf,
|
||||
DvrConfig dvrConf, LnbConfig lnbConf);
|
||||
|
||||
sp<ITuner> mService;
|
||||
FrontendTests mFrontendTests;
|
||||
DemuxTests mDemuxTests;
|
||||
FilterTests mFilterTests;
|
||||
DvrTests mDvrTests;
|
||||
LnbTests mLnbTests;
|
||||
|
||||
private:
|
||||
uint32_t* mLnbId = nullptr;
|
||||
};
|
||||
|
||||
class TunerDescramblerHidlTest : public testing::TestWithParam<std::string> {
|
||||
|
||||
@@ -139,6 +139,7 @@ struct FrontendConfig {
|
||||
};
|
||||
|
||||
struct LnbConfig {
|
||||
bool usingLnb;
|
||||
LnbVoltage voltage;
|
||||
LnbTone tone;
|
||||
LnbPosition position;
|
||||
@@ -221,6 +222,7 @@ inline void initFrontendScanConfig() {
|
||||
|
||||
/** Configuration array for the Lnb test */
|
||||
inline void initLnbConfig() {
|
||||
lnbArray[LNB0].usingLnb = true;
|
||||
lnbArray[LNB0].voltage = LnbVoltage::VOLTAGE_12V;
|
||||
lnbArray[LNB0].tone = LnbTone::NONE;
|
||||
lnbArray[LNB0].position = LnbPosition::UNDEFINED;
|
||||
|
||||
Reference in New Issue
Block a user