blob: 202eb6c09b488d0f26763ef27d27ba68a144e1d2 [file] [log] [blame]
Nicholas Ambur1e900192019-10-01 13:11:26 -07001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "SoundTriggerHidlHalTest"
18
19#include <android-base/logging.h>
20#include <android/hardware/audio/common/2.0/types.h>
21#include <android/hardware/soundtrigger/2.3/ISoundTriggerHw.h>
22#include <android/hardware/soundtrigger/2.3/types.h>
23#include <gtest/gtest.h>
24#include <hidl/GtestPrinter.h>
25#include <hidl/ServiceManagement.h>
26
27using ::android::sp;
28using ::android::hardware::Return;
29using ::android::hardware::soundtrigger::V2_3::ISoundTriggerHw;
30
31/**
32 * Test class holding the instance of the SoundTriggerHW service to test.
33 * The passed parameter is the registered name of the implementing service
34 * supplied by INSTANTIATE_TEST_SUITE_P() call.
35 */
36class SoundTriggerHidlTest : public testing::TestWithParam<std::string> {
37 public:
38 void SetUp() override {
39 soundtrigger = ISoundTriggerHw::getService(GetParam());
40
41 ASSERT_NE(soundtrigger, nullptr);
42 LOG(INFO) << "Test is remote " << soundtrigger->isRemote();
43 }
44
45 sp<ISoundTriggerHw> soundtrigger;
46};
47
48/**
49 * Empty test is in place to ensure service is initalized.
50 * Due to the nature of SoundTrigger HAL providing an interface for
51 * proprietary or vendor specific implementations, limited testing on
52 * individual APIs is possible.
53 */
54TEST_P(SoundTriggerHidlTest, ServiceIsInstantiated) {}
55
56INSTANTIATE_TEST_SUITE_P(
57 PerInstance, SoundTriggerHidlTest,
58 testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISoundTriggerHw::descriptor)),
59 android::hardware::PrintInstanceNameToString);