change all vts hidl tests to use VtsHalHidlTargetBaseTest (internal master)

Bug: 33385836
Test: mma
Change-Id: Ide3ebc4a9db76257f33bcfb0c1f13d2ee33eeaa8
This commit is contained in:
Yuexi Ma
2017-02-28 01:46:51 -08:00
parent 48c9837a55
commit 50d7e27b3c
44 changed files with 92 additions and 134 deletions

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalAudioEffectV2_0TargetTest",
gtest: true,
srcs: ["VtsHalAudioEffectV2_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.audio.effect@2.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -21,7 +21,7 @@
#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
#include <android/hardware/audio/effect/2.0/types.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
using ::android::hardware::audio::common::V2_0::Uuid;
using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
@@ -35,10 +35,10 @@ using ::android::hardware::hidl_vec;
using ::android::sp;
// The main test class for Audio Effect HIDL HAL.
class AudioEffectHidlTest : public ::testing::Test {
class AudioEffectHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
effectsFactory = IEffectsFactory::getService();
effectsFactory = ::testing::VtsHalHidlTargetBaseTest::getService<IEffectsFactory>();
ASSERT_NE(effectsFactory, nullptr);
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalBiometricsFingerprintV2_1TargetTest",
gtest: true,
srcs: ["VtsHalBiometricsFingerprintV2_1TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -27,7 +26,7 @@ cc_test {
"libutils",
"android.hardware.biometrics.fingerprint@2.1",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -20,7 +20,7 @@
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprintClientCallback.h>
#include <chrono>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
@@ -34,7 +34,7 @@ using android::hardware::Return;
#define SERVICE_NAME "fingerprint_hal"
class FingerprintHidlTest : public ::testing::Test,
class FingerprintHidlTest : public ::testing::VtsHalHidlTargetBaseTest,
public IBiometricsFingerprintClientCallback {
protected:
@@ -49,7 +49,7 @@ public:
err(FingerprintError::ERROR_NO_ERROR), threshold(1) {}
virtual void SetUp() override {
service = IBiometricsFingerprint::getService(SERVICE_NAME);
service = ::testing::VtsHalHidlTargetBaseTest::getService<IBiometricsFingerprint>(SERVICE_NAME);
ASSERT_NE(service, nullptr);
clearErr();

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalBootV1_0TargetTest",
gtest: true,
srcs: ["VtsHalBootV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -27,7 +26,7 @@ cc_test {
"libutils",
"android.hardware.boot@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -21,7 +21,7 @@
#include <android/hardware/boot/1.0/IBootControl.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
using ::android::hardware::boot::V1_0::IBootControl;
using ::android::hardware::boot::V1_0::CommandResult;
@@ -32,10 +32,10 @@ using ::android::hardware::Return;
using ::android::sp;
// The main test class for the Boot HIDL HAL.
class BootHidlTest : public ::testing::Test {
class BootHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
boot = IBootControl::getService();
boot = ::testing::VtsHalHidlTargetBaseTest::getService<IBootControl>();
ASSERT_NE(boot, nullptr);
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalBroadcastradioV1_0TargetTest",
gtest: true,
srcs: ["VtsHalBroadcastradioV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.broadcastradio@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -15,7 +15,7 @@
*/
#define LOG_TAG "BroadcastRadioHidlHalTest"
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <android-base/logging.h>
#include <cutils/native_handle.h>
#include <cutils/properties.h>
@@ -50,20 +50,11 @@ using ::android::hardware::broadcastradio::V1_0::MetaData;
// The main test class for Broadcast Radio HIDL HAL.
class BroadcastRadioHidlTest : public ::testing::Test {
class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
protected:
virtual void SetUp() override {
bool getStub = false;
char getsubProperty[PROPERTY_VALUE_MAX];
if (property_get("vts.hidl.get_stub", getsubProperty, "") > 0) {
if (!strcmp(getsubProperty, "true") ||
!strcmp(getsubProperty, "True") ||
!strcmp(getsubProperty, "1")) {
getStub = true;
}
}
sp<IBroadcastRadioFactory> factory =
IBroadcastRadioFactory::getService(getStub);
::testing::VtsHalHidlTargetBaseTest::getService<IBroadcastRadioFactory>();
if (factory != 0) {
factory->connectModule(Class::AM_FM,
[&](Result retval, const ::android::sp<IBroadcastRadio>& result) {
@@ -74,7 +65,6 @@ class BroadcastRadioHidlTest : public ::testing::Test {
}
mTunerCallback = new MyCallback(this);
ASSERT_NE(nullptr, mRadio.get());
ASSERT_EQ(!getStub, mRadio->isRemote());
ASSERT_NE(nullptr, mTunerCallback.get());
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalBroadcastradioV1_1TargetTest",
gtest: true,
srcs: ["VtsHalBroadcastradioV1_1TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -29,7 +28,7 @@ cc_test {
"android.hardware.broadcastradio@1.0",
"android.hardware.broadcastradio@1.1",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -15,7 +15,7 @@
*/
#define LOG_TAG "BroadcastRadioHidlHalTest"
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <android-base/logging.h>
#include <cutils/native_handle.h>
#include <cutils/properties.h>
@@ -52,19 +52,10 @@ using ::android::hardware::broadcastradio::V1_1::Result;
// The main test class for Broadcast Radio HIDL HAL.
class BroadcastRadioHidlTest : public ::testing::Test {
class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
protected:
virtual void SetUp() override {
bool getStub = false;
char getsubProperty[PROPERTY_VALUE_MAX];
if (property_get("vts.hidl.get_stub", getsubProperty, "") > 0) {
if (!strcmp(getsubProperty, "true") ||
!strcmp(getsubProperty, "True") ||
!strcmp(getsubProperty, "1")) {
getStub = true;
}
}
auto factory = IBroadcastRadioFactory::getService(getStub);
auto factory = ::testing::VtsHalHidlTargetBaseTest::getService<IBroadcastRadioFactory>();
if (factory != 0) {
factory->connectModule(Class::AM_FM,
[&](Result retval, const ::android::sp<IBroadcastRadio>& result) {
@@ -75,7 +66,6 @@ class BroadcastRadioHidlTest : public ::testing::Test {
}
mTunerCallback = new MyCallback(this);
ASSERT_NE(nullptr, mRadio.get());
ASSERT_EQ(!getStub, mRadio->isRemote());
ASSERT_NE(nullptr, mTunerCallback.get());
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalCameraProviderV2_4TargetTest",
gtest: true,
srcs: ["VtsHalCameraProviderV2_4TargetTest.cpp"],
shared_libs: [
"liblog",
@@ -29,7 +28,7 @@ cc_test {
"libcamera_metadata",
"libui"
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -19,7 +19,7 @@
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
#include <android/log.h>
#include <ui/GraphicBuffer.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <regex>
#include "system/camera_metadata.h"
#include <hardware/gralloc.h>
@@ -131,7 +131,7 @@ private:
void CameraHidlEnvironment::SetUp() {
// TODO: test the binderized mode
mProvider = ICameraProvider::getService(CAMERA_PASSTHROUGH_SERVICE_NAME);
mProvider = ::testing::VtsHalHidlTargetBaseTest::getService<ICameraProvider>(CAMERA_PASSTHROUGH_SERVICE_NAME);
// TODO: handle the device doesn't have any camera case
ALOGI_IF(mProvider, "provider is not nullptr, %p", mProvider.get());
ASSERT_NE(mProvider, nullptr);
@@ -142,7 +142,7 @@ void CameraHidlEnvironment::TearDown() {
}
// The main test class for camera HIDL HAL.
class CameraHidlTest : public ::testing::Test {
class CameraHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {}
virtual void TearDown() override {}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalContexthubV1_0TargetTest",
gtest: true,
srcs: ["VtsHalContexthubV1_0TargetTest.cpp"],
shared_libs: [
"liblog",
@@ -25,7 +24,7 @@ cc_test {
"libutils",
"android.hardware.contexthub@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -21,7 +21,7 @@
#include <android/hardware/contexthub/1.0/IContexthubCallback.h>
#include <android/hardware/contexthub/1.0/types.h>
#include <android/log.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <cinttypes>
#include <future>
@@ -80,7 +80,7 @@ std::vector<uint32_t> getHubIds() {
static std::vector<uint32_t> hubIds;
if (hubIds.size() == 0) {
sp<IContexthub> hubApi = IContexthub::getService(CONTEXTHUB_SERVICE_NAME);
sp<IContexthub> hubApi = ::testing::VtsHalHidlTargetBaseTest::getService<IContexthub>(CONTEXTHUB_SERVICE_NAME);
if (hubApi != nullptr) {
for (ContextHub hub : getHubsSync(hubApi)) {
@@ -95,10 +95,10 @@ std::vector<uint32_t> getHubIds() {
// Base test fixture that initializes the HAL and makes the context hub API
// handle available
class ContexthubHidlTestBase : public ::testing::Test {
class ContexthubHidlTestBase : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
hubApi = IContexthub::getService(CONTEXTHUB_SERVICE_NAME);
hubApi = ::testing::VtsHalHidlTargetBaseTest::getService<IContexthub>(CONTEXTHUB_SERVICE_NAME);
ASSERT_NE(hubApi, nullptr);
// getHubs() must be called at least once for proper initialization of the

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalGatekeeperV1_0TargetTest",
gtest: true,
srcs: ["VtsHalGatekeeperV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.gatekeeper@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -30,7 +30,7 @@
#include <android/hardware/gatekeeper/1.0/IGatekeeper.h>
#include <android/hardware/gatekeeper/1.0/types.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
@@ -76,7 +76,7 @@ static const hw_auth_token_t *toAuthToken(GatekeeperResponse &rsp) {
}
// The main test class for Gatekeeper HIDL HAL.
class GatekeeperHidlTest : public ::testing::Test {
class GatekeeperHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
protected:
void setUid(uint32_t uid) { uid_ = uid; }
@@ -187,7 +187,7 @@ class GatekeeperHidlTest : public ::testing::Test {
GatekeeperHidlTest() : uid_(0) {}
virtual void SetUp() override {
GatekeeperResponse rsp;
gatekeeper_ = IGatekeeper::getService();
gatekeeper_ = ::testing::VtsHalHidlTargetBaseTest::getService<IGatekeeper>();
ASSERT_NE(nullptr, gatekeeper_.get());
doDeleteAllUsers(rsp);
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalGnssV1_0TargetTest",
gtest: true,
srcs: ["VtsHalGnssV1_0TargetTest.cpp"],
shared_libs: [
"android.hardware.gnss@1.0",
@@ -28,7 +27,7 @@ cc_test {
"libnativehelper",
"libutils",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -18,7 +18,7 @@
#include <android/hardware/gnss/1.0/IGnss.h>
#include <android/log.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <chrono>
#include <condition_variable>
@@ -36,7 +36,7 @@ using android::sp;
#define TIMEOUT_SECONDS 5 // for basic commands/responses
// The main test class for GNSS HAL.
class GnssHalTest : public ::testing::Test {
class GnssHalTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
/* TODO(b/35678469): Setup the init.rc for VTS such that there's a
@@ -45,7 +45,7 @@ class GnssHalTest : public ::testing::Test {
* callbacks trigger.
*/
gnss_hal_ = IGnss::getService();
gnss_hal_ = ::testing::VtsHalHidlTargetBaseTest::getService<IGnss>();
ASSERT_NE(gnss_hal_, nullptr);
gnss_cb_ = new GnssCallback(*this);

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalGraphicsAllocatorV2_0TargetTest",
gtest: true,
srcs: ["VtsHalGraphicsAllocatorV2_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.graphics.allocator@2.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -20,7 +20,7 @@
#include <android-base/logging.h>
#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
namespace android {
namespace hardware {
@@ -69,10 +69,10 @@ class TempDescriptor {
BufferDescriptor mDescriptor;
};
class GraphicsAllocatorHidlTest : public ::testing::Test {
class GraphicsAllocatorHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
protected:
void SetUp() override {
mAllocator = IAllocator::getService();
mAllocator = ::testing::VtsHalHidlTargetBaseTest::getService<IAllocator>();
ASSERT_NE(mAllocator, nullptr);
mAllocator->createClient([this](const auto& error, const auto& client) {

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalGraphicsComposerV2_1TargetTest",
gtest: true,
srcs: ["VtsHalGraphicsComposerV2_1TargetTest.cpp"],
shared_libs: [
"android.hardware.graphics.allocator@2.0",
@@ -32,7 +31,7 @@ cc_test {
"libsync",
"libutils",
],
static_libs: ["libgtest", "libhwcomposer-command-buffer"],
static_libs: ["VtsHalHidlTargetBaseTest", "libhwcomposer-command-buffer"],
cflags: [
"-O0",
"-g",

View File

@@ -22,7 +22,7 @@
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <android/hardware/graphics/mapper/2.0/IMapper.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <unistd.h>
#include <algorithm>
@@ -131,10 +131,10 @@ class GraphicsComposerCallback : public IComposerCallback {
int mInvalidVsyncCount = 0;
};
class GraphicsComposerHidlTest : public ::testing::Test {
class GraphicsComposerHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
protected:
void SetUp() override {
mComposer = IComposer::getService();
mComposer = ::testing::VtsHalHidlTargetBaseTest::getService<IComposer>();
ASSERT_NE(nullptr, mComposer.get());
mComposerClient = createClient();
@@ -749,7 +749,7 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest {
private:
void SetUpGralloc() {
mAllocator = IAllocator::getService();
mAllocator = ::testing::VtsHalHidlTargetBaseTest::getService<IAllocator>();
ASSERT_NE(nullptr, mAllocator.get());
mAllocator->createClient([this](const auto& error, const auto& client) {
@@ -759,7 +759,7 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest {
});
ASSERT_NE(nullptr, mAllocatorClient.get());
mMapper = IMapper::getService();
mMapper = ::testing::VtsHalHidlTargetBaseTest::getService<IMapper>();
ASSERT_NE(nullptr, mMapper.get());
ASSERT_FALSE(mMapper->isRemote());
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalGraphicsMapperV2_0TargetTest",
gtest: true,
srcs: ["VtsHalGraphicsMapperV2_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -31,7 +30,7 @@ cc_test {
"android.hardware.graphics.mapper@2.0",
"android.hardware.graphics.common@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -19,7 +19,7 @@
#include <android-base/logging.h>
#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
#include <android/hardware/graphics/mapper/2.0/IMapper.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <sync/sync.h>
namespace android {
@@ -33,10 +33,10 @@ namespace {
using namespace android::hardware::graphics::allocator::V2_0;
using namespace android::hardware::graphics::common::V1_0;
class GraphicsMapperHidlTest : public ::testing::Test {
class GraphicsMapperHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
protected:
void SetUp() override {
mAllocator = IAllocator::getService();
mAllocator = ::testing::VtsHalHidlTargetBaseTest::getService<IAllocator>();
ASSERT_NE(mAllocator, nullptr);
mAllocator->createClient([this](const auto& error, const auto& client) {
@@ -46,7 +46,7 @@ class GraphicsMapperHidlTest : public ::testing::Test {
});
ASSERT_NE(mAllocatorClient, nullptr);
mMapper = IMapper::getService();
mMapper = ::testing::VtsHalHidlTargetBaseTest::getService<IMapper>();
ASSERT_NE(nullptr, mMapper.get());
ASSERT_FALSE(mMapper->isRemote());

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalLightV2_0TargetTest",
gtest: true,
srcs: ["VtsHalLightV2_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -25,7 +24,7 @@ cc_test {
"libutils",
"android.hardware.light@2.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -19,7 +19,7 @@
#include <android-base/logging.h>
#include <android/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/types.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <set>
#include <unistd.h>
@@ -72,10 +72,10 @@ const static std::set<Type> kAllTypes = {
Type::WIFI
};
class LightHidlTest : public ::testing::Test {
class LightHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
light = ILight::getService();
light = ::testing::VtsHalHidlTargetBaseTest::getService<ILight>();
ASSERT_NE(light, nullptr);
LOG(INFO) << "Test is remote " << light->isRemote();

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalMemtrackV1_0TargetTest",
gtest: true,
srcs: ["VtsHalMemtrackV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -27,7 +26,7 @@ cc_test {
"libutils",
"android.hardware.memtrack@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -18,7 +18,7 @@
#include <android-base/logging.h>
#include <android/hardware/memtrack/1.0/IMemtrack.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <algorithm>
#include <vector>
@@ -34,10 +34,10 @@ using ::android::sp;
using std::vector;
using std::count_if;
class MemtrackHidlTest : public ::testing::Test {
class MemtrackHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
memtrack = IMemtrack::getService();
memtrack = ::testing::VtsHalHidlTargetBaseTest::getService<IMemtrack>();
ASSERT_NE(memtrack, nullptr);
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalPowerV1_0TargetTest",
gtest: true,
srcs: ["VtsHalPowerV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.power@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -22,7 +22,7 @@
#include <android-base/unique_fd.h>
#include <android/hardware/power/1.0/IPower.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <algorithm>
@@ -43,10 +43,10 @@ using std::vector;
#define AVAILABLE_GOVERNORS_PATH \
"/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"
class PowerHidlTest : public ::testing::Test {
class PowerHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
power = IPower::getService();
power = ::testing::VtsHalHidlTargetBaseTest::getService<IPower>();
ASSERT_NE(power, nullptr);
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalSensorsV1_0TargetTest",
gtest: true,
srcs: ["VtsHalSensorsV1_0TargetTest.cpp"],
shared_libs: [
"android.hardware.sensors@1.0",
@@ -25,7 +24,7 @@ cc_test {
"liblog",
"libutils",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -20,7 +20,7 @@
#include <android/hardware/sensors/1.0/types.h>
#include <android/log.h>
#include <cutils/ashmem.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <hardware/sensors.h> // for sensor type strings
#include <algorithm>
@@ -80,7 +80,7 @@ class SensorsHidlEnvironment : public ::testing::Environment {
};
void SensorsHidlEnvironment::SetUp() {
sensors = ISensors::getService();
sensors = ::testing::VtsHalHidlTargetBaseTest::getService<ISensors>();
ALOGI_IF(sensors, "sensors is not nullptr, %p", sensors.get());
ASSERT_NE(sensors, nullptr);
@@ -309,7 +309,7 @@ SensorsTestSharedMemory* SensorsTestSharedMemory::create(SharedMemType type, siz
}
// The main test class for SENSORS HIDL HAL.
class SensorsHidlTest : public ::testing::Test {
class SensorsHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalSoundtriggerV2_0TargetTest",
gtest: true,
srcs: ["VtsHalSoundtriggerV2_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.soundtrigger@2.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -22,7 +22,7 @@
#include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
#include <android/hardware/soundtrigger/2.0/types.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
using ::android::hardware::audio::common::V2_0::AudioDevice;
using ::android::hardware::soundtrigger::V2_0::SoundModelHandle;
@@ -37,10 +37,10 @@ using ::android::hardware::Void;
using ::android::sp;
// The main test class for Sound Trigger HIDL HAL.
class SoundTriggerHidlTest : public ::testing::Test {
class SoundTriggerHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
mSoundTriggerHal = ISoundTriggerHw::getService("sound_trigger.primary");
mSoundTriggerHal = ::testing::VtsHalHidlTargetBaseTest::getService<ISoundTriggerHw>("sound_trigger.primary");
ASSERT_NE(nullptr, mSoundTriggerHal.get());
mCallback = new MyCallback();
ASSERT_NE(nullptr, mCallback.get());

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalThermalV1_0TargetTest",
gtest: true,
srcs: ["VtsHalThermalV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.thermal@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -24,7 +24,7 @@
#include <android-base/logging.h>
#include <android/hardware/thermal/1.0/IThermal.h>
#include <android/hardware/thermal/1.0/types.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <unistd.h>
using ::android::hardware::hidl_string;
@@ -46,10 +46,10 @@ using ::android::sp;
#define MAX_FAN_SPEED 20000
// The main test class for THERMAL HIDL HAL.
class ThermalHidlTest : public ::testing::Test {
class ThermalHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
thermal_ = IThermal::getService();
thermal_ = ::testing::VtsHalHidlTargetBaseTest::getService<IThermal>();
ASSERT_NE(thermal_, nullptr);
baseSize_ = 0;
names_.clear();

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalTvInputV1_0TargetTest",
gtest: true,
srcs: ["VtsHalTvInputV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.tv.input@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -21,7 +21,7 @@
#include <android/hardware/tv/input/1.0/ITvInput.h>
#include <android/hardware/tv/input/1.0/ITvInputCallback.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <utils/KeyedVector.h>
#include <mutex>
#include <vector>
@@ -43,10 +43,10 @@ using ::android::sp;
#define DEFAULT_ID INT32_MIN
/* The main test class for TV Input HIDL HAL. */
class TvInputHidlTest : public ::testing::Test {
class TvInputHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
tv_input_ = ITvInput::getService();
tv_input_ = ::testing::VtsHalHidlTargetBaseTest::getService<ITvInput>();
ASSERT_NE(tv_input_, nullptr);
tv_input_callback_ = new TvInputCallback(*this);
ASSERT_NE(tv_input_callback_, nullptr);

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalUsbV1_0TargetTest",
gtest: true,
srcs: ["VtsHalUsbV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -28,7 +27,7 @@ cc_test {
"libutils",
"android.hardware.usb@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -21,7 +21,7 @@
#include <android/hardware/usb/1.0/IUsbCallback.h>
#include <android/hardware/usb/1.0/types.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <stdlib.h>
#include <chrono>
#include <condition_variable>
@@ -50,7 +50,7 @@ using ::android::sp;
#define USB_SERVICE_NAME "usb_hal"
// The main test class for the USB hidl HAL
class UsbHidlTest : public ::testing::Test {
class UsbHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
// Callback class for the USB HIDL hal.
// Usb Hal will call this object upon role switch or port query.
@@ -97,7 +97,7 @@ class UsbHidlTest : public ::testing::Test {
virtual void SetUp() override {
ALOGI("Setup");
usb = IUsb::getService(USB_SERVICE_NAME);
usb = ::testing::VtsHalHidlTargetBaseTest::getService<IUsb>(USB_SERVICE_NAME);
ASSERT_NE(usb, nullptr);
usb_cb_2 = new UsbCallback(*this, 2);

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalVibratorV1_0TargetTest",
gtest: true,
srcs: ["VtsHalVibratorV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
@@ -25,7 +24,7 @@ cc_test {
"libutils",
"android.hardware.vibrator@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -19,7 +19,7 @@
#include <android-base/logging.h>
#include <android/hardware/vibrator/1.0/IVibrator.h>
#include <android/hardware/vibrator/1.0/types.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <unistd.h>
using ::android::hardware::vibrator::V1_0::IVibrator;
@@ -29,10 +29,10 @@ using ::android::hardware::Void;
using ::android::sp;
// The main test class for VIBRATOR HIDL HAL.
class VibratorHidlTest : public ::testing::Test {
class VibratorHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
virtual void SetUp() override {
vibrator = IVibrator::getService();
vibrator = ::testing::VtsHalHidlTargetBaseTest::getService<IVibrator>();
ASSERT_NE(vibrator, nullptr);
}

View File

@@ -16,7 +16,6 @@
cc_test {
name: "VtsHalVrV1_0TargetTest",
gtest: true,
srcs: ["VtsHalVrV1_0TargetTest.cpp"],
shared_libs: [
"liblog",
@@ -24,7 +23,7 @@ cc_test {
"libutils",
"android.hardware.vr@1.0",
],
static_libs: ["libgtest"],
static_libs: ["VtsHalHidlTargetBaseTest"],
cflags: [
"-O0",
"-g",

View File

@@ -18,7 +18,7 @@
#include <android-base/logging.h>
#include <android/hardware/vr/1.0/IVr.h>
#include <android/log.h>
#include <gtest/gtest.h>
#include <VtsHalHidlTargetBaseTest.h>
#include <hardware/vr.h>
using ::android::hardware::vr::V1_0::IVr;
@@ -27,10 +27,10 @@ using ::android::hardware::Void;
using ::android::sp;
// The main test class for VR HIDL HAL.
class VrHidlTest : public ::testing::Test {
class VrHidlTest : public ::testing::VtsHalHidlTargetBaseTest {
public:
void SetUp() override {
vr = IVr::getService();
vr = ::testing::VtsHalHidlTargetBaseTest::getService<IVr>();
ASSERT_NE(vr, nullptr);
}