#include "device/bluetooth/test/bluetooth_test.h"
#include <iterator>
#include <memory>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_common.h"
namespace device {
BluetoothTestBase::LowEnergyDeviceData::LowEnergyDeviceData() = default;
BluetoothTestBase::LowEnergyDeviceData::LowEnergyDeviceData(
LowEnergyDeviceData&& data) = default;
BluetoothTestBase::LowEnergyDeviceData::~LowEnergyDeviceData() = default;
const char BluetoothTestBase::kTestAdapterName[] = …;
const char BluetoothTestBase::kTestAdapterAddress[] = …;
const char BluetoothTestBase::kTestDeviceName[] = …;
const char BluetoothTestBase::kTestDeviceNameEmpty[] = …;
const char BluetoothTestBase::kTestDeviceNameU2f[] = …;
const char BluetoothTestBase::kTestDeviceNameCable[] = …;
const char BluetoothTestBase::kTestDeviceAddress1[] = …;
const char BluetoothTestBase::kTestDeviceAddress2[] = …;
const char BluetoothTestBase::kTestDeviceAddress3[] = …;
const char BluetoothTestBase::kTestUUIDGenericAccess[] = …;
const char BluetoothTestBase::kTestUUIDGenericAttribute[] = …;
const char BluetoothTestBase::kTestUUIDImmediateAlert[] = …;
const char BluetoothTestBase::kTestUUIDLinkLoss[] = …;
const char BluetoothTestBase::kTestUUIDHeartRate[] = …;
const char BluetoothTestBase::kTestUUIDU2f[] = …;
const char BluetoothTestBase::kTestUUIDDeviceName[] = …;
const char BluetoothTestBase::kTestUUIDAppearance[] = …;
const char BluetoothTestBase::kTestUUIDReconnectionAddress[] = …;
const char BluetoothTestBase::kTestUUIDHeartRateMeasurement[] = …;
const char BluetoothTestBase::kTestUUIDU2fControlPointLength[] = …;
const char BluetoothTestBase::kTestUUIDCharacteristicUserDescription[] = …;
const char BluetoothTestBase::kTestUUIDClientCharacteristicConfiguration[] = …;
const char BluetoothTestBase::kTestUUIDServerCharacteristicConfiguration[] = …;
const char BluetoothTestBase::kTestUUIDCharacteristicPresentationFormat[] = …;
const char BluetoothTestBase::kTestUUIDCableAdvertisement[] = …;
const uint16_t BluetoothTestBase::kTestManufacturerId = …;
const uint8_t BluetoothTestBase::kTestCableEid[] = …;
const char BluetoothTestBase::kTestUuidFormattedClientEid[] = …;
BluetoothTestBase::BluetoothTestBase() { … }
BluetoothTestBase::~BluetoothTestBase() = default;
void BluetoothTestBase::StartLowEnergyDiscoverySession() { … }
void BluetoothTestBase::StartLowEnergyDiscoverySessionExpectedToFail() { … }
void BluetoothTestBase::TearDown() { … }
bool BluetoothTestBase::DenyPermission() { … }
BluetoothDevice* BluetoothTestBase::SimulateLowEnergyDevice(
int device_ordinal) { … }
void BluetoothTestBase::SimulateLowEnergyDiscoveryFailure() { … }
BluetoothDevice* BluetoothTestBase::SimulateClassicDevice() { … }
bool BluetoothTestBase::ConnectGatt(
BluetoothDevice* device,
std::optional<BluetoothUUID> service_uuid,
std::optional<base::OnceCallback<void(BluetoothDevice*)>>
simulate_callback) { … }
std::optional<BluetoothUUID> BluetoothTestBase::GetTargetGattService(
BluetoothDevice* device) { … }
void BluetoothTestBase::SimulateDeviceBreaksConnection(
BluetoothDevice* device) { … }
bool BluetoothTestBase::SimulateLocalGattCharacteristicNotificationsRequest(
BluetoothDevice* device,
BluetoothLocalGattCharacteristic* characteristic,
bool start) { … }
std::vector<uint8_t> BluetoothTestBase::LastNotifactionValueForCharacteristic(
BluetoothLocalGattCharacteristic* characteristic) { … }
void BluetoothTestBase::ExpectedChangeNotifyValueAttempts(int attempts) { … }
void BluetoothTestBase::ExpectedNotifyValue(
NotifyValueState expected_value_state) { … }
std::vector<BluetoothLocalGattService*>
BluetoothTestBase::RegisteredGattServices() { … }
void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { … }
void BluetoothTestBase::Callback(Call expected) { … }
void BluetoothTestBase::CreateAdvertisementCallback(
Call expected,
scoped_refptr<BluetoothAdvertisement> advertisement) { … }
void BluetoothTestBase::DiscoverySessionCallback(
Call expected,
std::unique_ptr<BluetoothDiscoverySession> discovery_session) { … }
void BluetoothTestBase::GattConnectionCallback(
Call expected,
Result expected_result,
std::unique_ptr<BluetoothGattConnection> connection,
std::optional<BluetoothDevice::ConnectErrorCode> error_code) { … }
void BluetoothTestBase::NotifyCallback(
Call expected,
std::unique_ptr<BluetoothGattNotifySession> notify_session) { … }
void BluetoothTestBase::NotifyCheckForPrecedingCalls(
int num_of_preceding_calls,
std::unique_ptr<BluetoothGattNotifySession> notify_session) { … }
void BluetoothTestBase::StopNotifyCallback(Call expected) { … }
void BluetoothTestBase::StopNotifyCheckForPrecedingCalls(
int num_of_preceding_calls) { … }
void BluetoothTestBase::ReadValueCallback(
Call expected,
Result expected_result,
std::optional<BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>& value) { … }
void BluetoothTestBase::ErrorCallback(Call expected) { … }
void BluetoothTestBase::AdvertisementErrorCallback(
Call expected,
BluetoothAdvertisement::ErrorCode error_code) { … }
void BluetoothTestBase::GattErrorCallback(
Call expected,
BluetoothGattService::GattErrorCode error_code) { … }
void BluetoothTestBase::ReentrantStartNotifySessionSuccessCallback(
Call expected,
BluetoothRemoteGattCharacteristic* characteristic,
std::unique_ptr<BluetoothGattNotifySession> notify_session) { … }
void BluetoothTestBase::ReentrantStartNotifySessionErrorCallback(
Call expected,
BluetoothRemoteGattCharacteristic* characteristic,
bool error_in_reentrant,
BluetoothGattService::GattErrorCode error_code) { … }
base::OnceClosure BluetoothTestBase::GetCallback(Call expected) { … }
BluetoothAdapter::CreateAdvertisementCallback
BluetoothTestBase::GetCreateAdvertisementCallback(Call expected) { … }
BluetoothAdapter::DiscoverySessionCallback
BluetoothTestBase::GetDiscoverySessionCallback(Call expected) { … }
BluetoothDevice::GattConnectionCallback
BluetoothTestBase::GetGattConnectionCallback(Call expected,
Result expected_result) { … }
BluetoothRemoteGattCharacteristic::NotifySessionCallback
BluetoothTestBase::GetNotifyCallback(Call expected) { … }
BluetoothRemoteGattCharacteristic::NotifySessionCallback
BluetoothTestBase::GetNotifyCheckForPrecedingCalls(int num_of_preceding_calls) { … }
base::OnceClosure BluetoothTestBase::GetStopNotifyCallback(Call expected) { … }
base::OnceClosure BluetoothTestBase::GetStopNotifyCheckForPrecedingCalls(
int num_of_preceding_calls) { … }
BluetoothRemoteGattCharacteristic::ValueCallback
BluetoothTestBase::GetReadValueCallback(Call expected, Result expected_result) { … }
BluetoothAdapter::ErrorCallback BluetoothTestBase::GetErrorCallback(
Call expected) { … }
BluetoothAdapter::AdvertisementErrorCallback
BluetoothTestBase::GetAdvertisementErrorCallback(Call expected) { … }
base::OnceCallback<void(BluetoothGattService::GattErrorCode)>
BluetoothTestBase::GetGattErrorCallback(Call expected) { … }
BluetoothRemoteGattCharacteristic::NotifySessionCallback
BluetoothTestBase::GetReentrantStartNotifySessionSuccessCallback(
Call expected,
BluetoothRemoteGattCharacteristic* characteristic) { … }
base::OnceCallback<void(BluetoothGattService::GattErrorCode)>
BluetoothTestBase::GetReentrantStartNotifySessionErrorCallback(
Call expected,
BluetoothRemoteGattCharacteristic* characteristic,
bool error_in_reentrant) { … }
void BluetoothTestBase::ResetEventCounts() { … }
void BluetoothTestBase::RemoveTimedOutDevices() { … }
BluetoothTestBase::LowEnergyDeviceData
BluetoothTestBase::GetLowEnergyDeviceData(int device_ordinal) const { … }
}