mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:34:35 +00:00
Add VTS tests for Context Hub HAL 1.2
Also updates the compatibility matrix. Bug: 166845383 Test: Run test on device with HAL 1.2 implemented, verify pass Change-Id: Iac53e755cfa38fbd1322421279475de76b4bb572
This commit is contained in:
@@ -177,7 +177,7 @@
|
||||
</hal>
|
||||
<hal format="hidl" optional="true">
|
||||
<name>android.hardware.contexthub</name>
|
||||
<version>1.0-1</version>
|
||||
<version>1.0-2</version>
|
||||
<interface>
|
||||
<name>IContexthub</name>
|
||||
<instance>default</instance>
|
||||
|
||||
31
contexthub/1.2/vts/functional/Android.bp
Normal file
31
contexthub/1.2/vts/functional/Android.bp
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright (C) 2020 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: "VtsHalContexthubV1_2TargetTest",
|
||||
defaults: ["VtsHalTargetTestDefaults"],
|
||||
srcs: ["VtsHalContexthubV1_2TargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.contexthub@1.0",
|
||||
"android.hardware.contexthub@1.1",
|
||||
"android.hardware.contexthub@1.2",
|
||||
"VtsHalContexthubUtils",
|
||||
],
|
||||
test_suites: [
|
||||
"general-tests",
|
||||
"vts",
|
||||
],
|
||||
}
|
||||
8
contexthub/1.2/vts/functional/OWNERS
Normal file
8
contexthub/1.2/vts/functional/OWNERS
Normal file
@@ -0,0 +1,8 @@
|
||||
#Context Hub team
|
||||
arthuri@google.com
|
||||
bduddie@google.com
|
||||
stange@google.com
|
||||
|
||||
#VTS team
|
||||
dshi@google.com
|
||||
trong@google.com
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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 "contexthub_hidl_hal_test"
|
||||
|
||||
#include "ContexthubCallbackBase.h"
|
||||
#include "ContexthubHidlTestBase.h"
|
||||
#include "VtsHalContexthubUtils.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/contexthub/1.0/IContexthub.h>
|
||||
#include <android/hardware/contexthub/1.1/IContexthub.h>
|
||||
#include <android/hardware/contexthub/1.2/IContexthub.h>
|
||||
#include <android/log.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
using ::android::hardware::contexthub::V1_1::SettingValue;
|
||||
using ::android::hardware::contexthub::V1_2::IContexthub;
|
||||
using ::android::hardware::contexthub::V1_2::Setting;
|
||||
using ::android::hardware::contexthub::vts_utils::ContexthubCallbackBase;
|
||||
using ::android::hardware::contexthub::vts_utils::ContexthubHidlTestBase;
|
||||
using ::android::hardware::contexthub::vts_utils::getHalAndHubIdList;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<std::tuple<std::string, std::string>> kTestParameters =
|
||||
getHalAndHubIdList<IContexthub>();
|
||||
|
||||
class ContexthubHidlTest : public ContexthubHidlTestBase<IContexthub> {};
|
||||
|
||||
// In VTS, we only test that sending the values doesn't cause things to blow up - other test
|
||||
// suites verify the expected E2E behavior in CHRE
|
||||
TEST_P(ContexthubHidlTest, TestOnWifiSettingChanged) {
|
||||
ASSERT_OK(registerCallback(new ContexthubCallbackBase()));
|
||||
hubApi->onSettingChanged_1_2(Setting::WIFI_AVAILABLE, SettingValue::DISABLED);
|
||||
hubApi->onSettingChanged_1_2(Setting::WIFI_AVAILABLE, SettingValue::ENABLED);
|
||||
ASSERT_OK(registerCallback(nullptr));
|
||||
}
|
||||
|
||||
TEST_P(ContexthubHidlTest, TestOnAirplaneModeSettingChanged) {
|
||||
ASSERT_OK(registerCallback(new ContexthubCallbackBase()));
|
||||
hubApi->onSettingChanged_1_2(Setting::AIRPLANE_MODE, SettingValue::DISABLED);
|
||||
hubApi->onSettingChanged_1_2(Setting::AIRPLANE_MODE, SettingValue::ENABLED);
|
||||
ASSERT_OK(registerCallback(nullptr));
|
||||
}
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ContexthubHidlTest);
|
||||
INSTANTIATE_TEST_SUITE_P(HubIdSpecificTests, ContexthubHidlTest, testing::ValuesIn(kTestParameters),
|
||||
android::hardware::PrintInstanceTupleNameToString<>);
|
||||
|
||||
} // anonymous namespace
|
||||
Reference in New Issue
Block a user