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

Commit 0098a8d3 authored by Shraddha Basantwani's avatar Shraddha Basantwani
Browse files

CEC: Add VTS test to get port info

Test: atest VtsHalTvCecV1_0TargetTest
Bug: 172316717
Change-Id: I6c679c38494e28e65b102c9cc3bd0bb02222de76
parent 3857aae7
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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);