mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 05:56:34 +00:00
CEC: Add VTS test to get CEC version am: d79f658b20
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1556540 Change-Id: Ic40b366e6adfd9e7e344d51ae17e50fc1e15683e
This commit is contained in:
committed by
Automerger Merge Worker
commit
63f7f61577
29
tv/cec/1.0/vts/functional/Android.bp
Normal file
29
tv/cec/1.0/vts/functional/Android.bp
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Copyright (C) 2021 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalTvCecV1_0TargetTest",
|
||||
defaults: ["VtsHalTargetTestDefaults"],
|
||||
srcs: ["VtsHalTvCecV1_0TargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.cec@1.0",
|
||||
],
|
||||
test_suites: [
|
||||
"general-tests",
|
||||
"vts",
|
||||
],
|
||||
disable_framework: true,
|
||||
}
|
||||
71
tv/cec/1.0/vts/functional/VtsHalTvCecV1_0TargetTest.cpp
Normal file
71
tv/cec/1.0/vts/functional/VtsHalTvCecV1_0TargetTest.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "HdmiCec_hal_test"
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/tv/cec/1.0/IHdmiCec.h>
|
||||
#include <android/hardware/tv/cec/1.0/types.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_death_recipient;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::tv::cec::V1_0::IHdmiCec;
|
||||
using ::android::hardware::tv::cec::V1_0::Result;
|
||||
|
||||
#define CEC_VERSION 0x05
|
||||
|
||||
// The main test class for TV CEC HAL.
|
||||
class HdmiCecTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
hdmiCec = IHdmiCec::getService(GetParam());
|
||||
ASSERT_NE(hdmiCec, nullptr);
|
||||
ALOGI("%s: getService() for hdmiCec is %s", __func__,
|
||||
hdmiCec->isRemote() ? "remote" : "local");
|
||||
|
||||
hdmiCec_death_recipient = new HdmiCecDeathRecipient();
|
||||
ASSERT_NE(hdmiCec_death_recipient, nullptr);
|
||||
ASSERT_TRUE(hdmiCec->linkToDeath(hdmiCec_death_recipient, 0).isOk());
|
||||
}
|
||||
|
||||
class HdmiCecDeathRecipient : public hidl_death_recipient {
|
||||
public:
|
||||
void serviceDied(uint64_t /*cookie*/,
|
||||
const android::wp<::android::hidl::base::V1_0::IBase>& /*who*/) override {
|
||||
FAIL();
|
||||
}
|
||||
};
|
||||
|
||||
sp<IHdmiCec> hdmiCec;
|
||||
sp<HdmiCecDeathRecipient> hdmiCec_death_recipient;
|
||||
};
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HdmiCecTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, HdmiCecTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IHdmiCec::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
||||
TEST_P(HdmiCecTest, CecVersion) {
|
||||
Return<int32_t> ret = hdmiCec->getCecVersion();
|
||||
EXPECT_GE(ret, CEC_VERSION);
|
||||
}
|
||||
Reference in New Issue
Block a user