mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Convert bluetooth hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181
Test: make vts
vts-tradefed run vts -m VtsHalBluetoothV1_0Target
Change-Id: Ib6030ab0191913362ce54262c7ec8baa1f0bd147
This commit is contained in:
committed by
Myles Watson
parent
03086cfea4
commit
7a727ff3ec
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <VtsHalHidlTargetCallbackBase.h>
|
#include <VtsHalHidlTargetCallbackBase.h>
|
||||||
#include <VtsHalHidlTargetTestBase.h>
|
#include <VtsHalHidlTargetTestBase.h>
|
||||||
|
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
using ::android::hardware::bluetooth::V1_0::IBluetoothHci;
|
using ::android::hardware::bluetooth::V1_0::IBluetoothHci;
|
||||||
@@ -126,6 +127,23 @@ class ThroughputLogger {
|
|||||||
std::chrono::steady_clock::time_point start_time_;
|
std::chrono::steady_clock::time_point start_time_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Test environment for Bluetooth HIDL HAL.
|
||||||
|
class BluetoothHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
|
||||||
|
public:
|
||||||
|
// get the test environment singleton
|
||||||
|
static BluetoothHidlEnvironment* Instance() {
|
||||||
|
static BluetoothHidlEnvironment* instance = new BluetoothHidlEnvironment;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void registerTestServices() override {
|
||||||
|
registerTestService<IBluetoothHci>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
BluetoothHidlEnvironment() {}
|
||||||
|
};
|
||||||
|
|
||||||
// The main test class for Bluetooth HIDL HAL.
|
// The main test class for Bluetooth HIDL HAL.
|
||||||
class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||||
public:
|
public:
|
||||||
@@ -251,15 +269,6 @@ class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||||||
int max_sco_data_packets;
|
int max_sco_data_packets;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A class for test environment setup (kept since this file is a template).
|
|
||||||
class BluetoothHidlEnvironment : public ::testing::Environment {
|
|
||||||
public:
|
|
||||||
virtual void SetUp() {}
|
|
||||||
virtual void TearDown() {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
// Receive and check status events until a COMMAND_COMPLETE is received.
|
// Receive and check status events until a COMMAND_COMPLETE is received.
|
||||||
void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
|
void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
|
||||||
// Allow intermediate COMMAND_STATUS events
|
// Allow intermediate COMMAND_STATUS events
|
||||||
@@ -662,8 +671,9 @@ TEST_F(BluetoothHidlTest, LoopbackModeBandwidth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
::testing::AddGlobalTestEnvironment(new BluetoothHidlEnvironment);
|
::testing::AddGlobalTestEnvironment(BluetoothHidlEnvironment::Instance());
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
BluetoothHidlEnvironment::Instance()->init(&argc, argv);
|
||||||
int status = RUN_ALL_TESTS();
|
int status = RUN_ALL_TESTS();
|
||||||
ALOGI("Test result = %d", status);
|
ALOGI("Test result = %d", status);
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
Reference in New Issue
Block a user