summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
authorAmy Zhang <amyjojo@google.com>2020-07-15 14:27:32 -0700
committerAmy Zhang <amyjojo@google.com>2020-07-20 18:12:54 +0000
commitde1d2b6cbeebb9c28d6288e1e358e645e9cee951 (patch)
tree6b7d44561f63938c67300599363da6321ee1928e /tv
parentb6d3dc86a5ceb32ccbbb331eaa0ab0479c0be30e (diff)
downloadplatform_hardware_interfaces-de1d2b6cbeebb9c28d6288e1e358e645e9cee951.tar.gz
platform_hardware_interfaces-de1d2b6cbeebb9c28d6288e1e358e645e9cee951.tar.bz2
platform_hardware_interfaces-de1d2b6cbeebb9c28d6288e1e358e645e9cee951.zip
Fix bugs in the Tuner HAL 1.0 VTS
The previous implementation did not check some of the Descrambler API test results to stop the test. And the test itself was also implemented in a wrong way. Test: atest VtsHalTvTunerV1_0TargetTest Bug: 150987138 Change-Id: Ie26db0ec1b231062d0314631eebec319382da1bc (cherry picked from commit 6d774c89a1112c36ad14c9c0b95ee8816cb176f2)
Diffstat (limited to 'tv')
-rw-r--r--tv/tuner/1.0/vts/functional/DescramblerTests.cpp16
-rw-r--r--tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp18
2 files changed, 17 insertions, 17 deletions
diff --git a/tv/tuner/1.0/vts/functional/DescramblerTests.cpp b/tv/tuner/1.0/vts/functional/DescramblerTests.cpp
index d7440bc135..2e27475e71 100644
--- a/tv/tuner/1.0/vts/functional/DescramblerTests.cpp
+++ b/tv/tuner/1.0/vts/functional/DescramblerTests.cpp
@@ -102,13 +102,13 @@ AssertionResult DescramblerTests::openDescrambler(uint32_t demuxId) {
AssertionResult DescramblerTests::setKeyToken(TunerKeyToken token) {
Result status;
- if (mDescrambler) {
+ if (!mDescrambler) {
ALOGW("[vts] Descrambler is not opened yet.");
return failure();
}
status = mDescrambler->setKeyToken(token);
- if (status == Result::SUCCESS) {
+ if (status != Result::SUCCESS) {
ALOGW("[vts] setKeyToken failed.");
return failure();
}
@@ -118,13 +118,13 @@ AssertionResult DescramblerTests::setKeyToken(TunerKeyToken token) {
AssertionResult DescramblerTests::addPid(DemuxPid pid, sp<IFilter> optionalSourceFilter) {
Result status;
- if (mDescrambler) {
+ if (!mDescrambler) {
ALOGW("[vts] Descrambler is not opened yet.");
return failure();
}
status = mDescrambler->addPid(pid, optionalSourceFilter);
- if (status == Result::SUCCESS) {
+ if (status != Result::SUCCESS) {
ALOGW("[vts] addPid failed.");
return failure();
}
@@ -134,13 +134,13 @@ AssertionResult DescramblerTests::addPid(DemuxPid pid, sp<IFilter> optionalSourc
AssertionResult DescramblerTests::removePid(DemuxPid pid, sp<IFilter> optionalSourceFilter) {
Result status;
- if (mDescrambler) {
+ if (!mDescrambler) {
ALOGW("[vts] Descrambler is not opened yet.");
return failure();
}
status = mDescrambler->removePid(pid, optionalSourceFilter);
- if (status == Result::SUCCESS) {
+ if (status != Result::SUCCESS) {
ALOGW("[vts] removePid failed.");
return failure();
}
@@ -150,14 +150,14 @@ AssertionResult DescramblerTests::removePid(DemuxPid pid, sp<IFilter> optionalSo
AssertionResult DescramblerTests::closeDescrambler() {
Result status;
- if (mDescrambler) {
+ if (!mDescrambler) {
ALOGW("[vts] Descrambler is not opened yet.");
return failure();
}
status = mDescrambler->close();
mDescrambler = nullptr;
- if (status == Result::SUCCESS) {
+ if (status != Result::SUCCESS) {
ALOGW("[vts] close Descrambler failed.");
return failure();
}
diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
index 6819659915..2be68b8fc0 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
@@ -292,18 +292,18 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m
ASSERT_TRUE(mFilterTests.configFilter((*config).settings, filterId));
filterIds.insert(filterId);
}
- mDescramblerTests.openDescrambler(demuxId);
+ ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId));
TunerKeyToken token;
ASSERT_TRUE(mDescramblerTests.getKeyToken(descConfig.casSystemId, descConfig.provisionStr,
descConfig.hidlPvtData, token));
- mDescramblerTests.setKeyToken(token);
+ ASSERT_TRUE(mDescramblerTests.setKeyToken(token));
vector<DemuxPid> pids;
DemuxPid pid;
for (config = mediaFilterConfs.begin(); config != mediaFilterConfs.end(); config++) {
ASSERT_TRUE(mDescramblerTests.getDemuxPidFromFilterSettings((*config).type,
(*config).settings, pid));
pids.push_back(pid);
- mDescramblerTests.addPid(pid, nullptr);
+ ASSERT_TRUE(mDescramblerTests.addPid(pid, nullptr));
}
for (id = filterIds.begin(); id != filterIds.end(); id++) {
ASSERT_TRUE(mFilterTests.startFilter(*id));
@@ -316,9 +316,9 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m
ASSERT_TRUE(mFilterTests.stopFilter(*id));
}
for (auto pid : pids) {
- mDescramblerTests.removePid(pid, nullptr);
+ ASSERT_TRUE(mDescramblerTests.removePid(pid, nullptr));
}
- mDescramblerTests.closeDescrambler();
+ ASSERT_TRUE(mDescramblerTests.closeDescrambler());
for (id = filterIds.begin(); id != filterIds.end(); id++) {
ASSERT_TRUE(mFilterTests.closeFilter(*id));
}
@@ -410,9 +410,9 @@ TEST_P(TunerDemuxHidlTest, getAvSyncTime) {
filterArray[TS_PCR0].bufferSize));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(pcrFilterId));
ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_PCR0].settings, pcrFilterId));
- mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId);
+ ASSERT_TRUE(mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId));
ASSERT_TRUE(pcrFilterId == avSyncHwId);
- mDemuxTests.getAvSyncTime(pcrFilterId);
+ ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId));
ASSERT_TRUE(mFilterTests.closeFilter(pcrFilterId));
ASSERT_TRUE(mFilterTests.closeFilter(mediaFilterId));
ASSERT_TRUE(mDemuxTests.closeDemux());
@@ -519,8 +519,8 @@ TEST_P(TunerDescramblerHidlTest, CreateDescrambler) {
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
- mDescramblerTests.openDescrambler(demuxId);
- mDescramblerTests.closeDescrambler();
+ ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId));
+ ASSERT_TRUE(mDescramblerTests.closeDescrambler());
ASSERT_TRUE(mDemuxTests.closeDemux());
ASSERT_TRUE(mFrontendTests.closeFrontend());
}