CEC: Add VTS test to get port info am: 0098a8d3d5

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1579866

Change-Id: I0ee48e76b5741a2b7770571f3950ee3fd30e971e
This commit is contained in:
Shraddha Basantwani 2021-03-30 11:20:32 +00:00 committed by Automerger Merge Worker
commit 5437ca198c

View file

@ -27,9 +27,12 @@
using ::android::sp;
using ::android::hardware::hidl_death_recipient;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::tv::cec::V1_0::CecLogicalAddress;
using ::android::hardware::tv::cec::V1_0::CecMessage;
using ::android::hardware::tv::cec::V1_0::HdmiPortInfo;
using ::android::hardware::tv::cec::V1_0::HdmiPortType;
using ::android::hardware::tv::cec::V1_0::IHdmiCec;
using ::android::hardware::tv::cec::V1_0::OptionKey;
using ::android::hardware::tv::cec::V1_0::Result;
@ -96,6 +99,23 @@ TEST_P(HdmiCecTest, VendorId) {
EXPECT_NE(ret, INCORRECT_VENDOR_ID);
}
TEST_P(HdmiCecTest, GetPortInfo) {
hidl_vec<HdmiPortInfo> ports;
Return<void> ret =
hdmiCec->getPortInfo([&ports](hidl_vec<HdmiPortInfo> list) { ports = list; });
EXPECT_TRUE(ret.isOk());
bool cecSupportedOnDevice = false;
for (size_t i = 0; i < ports.size(); ++i) {
EXPECT_TRUE((ports[i].type == HdmiPortType::OUTPUT) ||
(ports[i].type == HdmiPortType::INPUT));
if (ports[i].portId == 0) {
ALOGW("%s: Port id should start from 1", __func__);
}
cecSupportedOnDevice = cecSupportedOnDevice | ports[i].cecSupported;
}
EXPECT_NE(cecSupportedOnDevice, false) << "At least one port should support CEC";
}
TEST_P(HdmiCecTest, SetOption) {
Return<void> ret;
ret = hdmiCec->setOption(OptionKey::WAKEUP, false);