/* * Copyright (C) 2018 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. */ #ifndef VTS_TREBLE_VINTF_TEST_BASE_H_ #define VTS_TREBLE_VINTF_TEST_BASE_H_ #include #include #include #include #include #include #include "utils.h" namespace android { namespace vintf { namespace testing { using android::sp; using android::hidl::base::V1_0::IBase; using android::hidl::manager::V1_0::IServiceManager; // Base class for many test suites. Provides some utility functions. class VtsTrebleVintfTestBase : public ::testing::Test { public: virtual ~VtsTrebleVintfTestBase() {} virtual void SetUp() override; // Applies given function to each HAL instance in VINTF. static void ForEachAidlHalInstance(const HalManifestPtr &, AidlVerifyFn); static void ForEachHidlHalInstance(const HalManifestPtr &, HidlVerifyFn); // Retrieves an existing HAL service. static sp GetHidlService(const string &fq_name, const string &instance_name, Transport, bool log = true); static sp GetHidlService(const FQName &fq_name, const string &instance_name, Transport, bool log = true); static sp GetAidlService(const std::string &name); static vector GetInstanceNames(const sp &manager, const FQName &fq_name); static vector GetInterfaceChain(const sp &service); static set GetPassthroughHals(HalManifestPtr manifest); static set GetHwbinderHals(HalManifestPtr manifest); Partition GetPartition(sp hal_service); // Default service manager. sp default_manager_; }; } // namespace testing } // namespace vintf } // namespace android #endif // VTS_TREBLE_VINTF_TEST_BASE_H_