chromium/device/bluetooth/test/test_bluetooth_adapter_observer.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "device/bluetooth/test/test_bluetooth_adapter_observer.h"

#include <string>
#include <vector>

#include "base/run_loop.h"
#include "build/build_config.h"
#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor.h"
#include "device/bluetooth/bluetooth_remote_gatt_service.h"
#include "test_bluetooth_adapter_observer.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace device {

TestBluetoothAdapterObserver::TestBluetoothAdapterObserver(
    scoped_refptr<BluetoothAdapter> adapter)
    :{}

TestBluetoothAdapterObserver::~TestBluetoothAdapterObserver() {}

void TestBluetoothAdapterObserver::Reset() {}

void TestBluetoothAdapterObserver::set_quit_closure(
    base::OnceClosure quit_closure) {}

void TestBluetoothAdapterObserver::AdapterPresentChanged(
    BluetoothAdapter* adapter,
    bool present) {}

void TestBluetoothAdapterObserver::AdapterPoweredChanged(
    BluetoothAdapter* adapter,
    bool powered) {}

void TestBluetoothAdapterObserver::AdapterDiscoverableChanged(
    BluetoothAdapter* adapter,
    bool discoverable) {}

void TestBluetoothAdapterObserver::AdapterDiscoveringChanged(
    BluetoothAdapter* adapter,
    bool discovering) {}

void TestBluetoothAdapterObserver::RegisterDiscoveringChangedWatcher(
    base::RepeatingClosure callback) {}

void TestBluetoothAdapterObserver::RegisterDiscoveryChangeCompletedWatcher(
    base::RepeatingClosure callback) {}

void TestBluetoothAdapterObserver::DeviceAdded(BluetoothAdapter* adapter,
                                               BluetoothDevice* device) {}

void TestBluetoothAdapterObserver::DiscoveryChangeCompletedForTesting() {}

void TestBluetoothAdapterObserver::DeviceChanged(BluetoothAdapter* adapter,
                                                 BluetoothDevice* device) {}

void TestBluetoothAdapterObserver::DeviceAddressChanged(
    device::BluetoothAdapter* adapter,
    device::BluetoothDevice* device,
    const std::string& old_address) {}

void TestBluetoothAdapterObserver::DeviceAdvertisementReceived(
    const std::string& device_address,
    const std::optional<std::string>& device_name,
    const std::optional<std::string>& advertisement_name,
    std::optional<int8_t> rssi,
    std::optional<int8_t> tx_power,
    std::optional<uint16_t> appearance,
    const device::BluetoothDevice::UUIDList& advertised_uuids,
    const device::BluetoothDevice::ServiceDataMap& service_data_map,
    const device::BluetoothDevice::ManufacturerDataMap& manufacturer_data_map) {}

#if BUILDFLAG(IS_CHROMEOS)
void TestBluetoothAdapterObserver::DeviceBondedChanged(
    device::BluetoothAdapter* adapter,
    device::BluetoothDevice* device,
    bool new_bonded_status) {
  ++device_bonded_changed_count_;
  last_device_ = device;
  device_new_bonded_status_ = new_bonded_status;

  QuitMessageLoop();
}
#endif

#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
void TestBluetoothAdapterObserver::DevicePairedChanged(
    device::BluetoothAdapter* adapter,
    device::BluetoothDevice* device,
    bool new_paired_status) {}

void TestBluetoothAdapterObserver::DeviceMTUChanged(
    device::BluetoothAdapter* adapter,
    device::BluetoothDevice* device,
    uint16_t mtu) {}

void TestBluetoothAdapterObserver::DeviceAdvertisementReceived(
    device::BluetoothAdapter* adapter,
    device::BluetoothDevice* device,
    int16_t rssi,
    const std::vector<uint8_t>& eir) {}

void TestBluetoothAdapterObserver::DeviceConnectedStateChanged(
    device::BluetoothAdapter* adapter,
    device::BluetoothDevice* device,
    bool is_now_connected) {}
#endif

void TestBluetoothAdapterObserver::DeviceRemoved(BluetoothAdapter* adapter,
                                                 BluetoothDevice* device) {}

void TestBluetoothAdapterObserver::GattServiceAdded(
    BluetoothAdapter* adapter,
    BluetoothDevice* device,
    BluetoothRemoteGattService* service) {}

void TestBluetoothAdapterObserver::GattServiceRemoved(
    BluetoothAdapter* adapter,
    BluetoothDevice* device,
    BluetoothRemoteGattService* service) {}

void TestBluetoothAdapterObserver::GattServicesDiscovered(
    BluetoothAdapter* adapter,
    BluetoothDevice* device) {}

void TestBluetoothAdapterObserver::GattDiscoveryCompleteForService(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattService* service) {}

void TestBluetoothAdapterObserver::GattServiceChanged(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattService* service) {}

void TestBluetoothAdapterObserver::GattCharacteristicAdded(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattCharacteristic* characteristic) {}

void TestBluetoothAdapterObserver::GattCharacteristicRemoved(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattCharacteristic* characteristic) {}

void TestBluetoothAdapterObserver::GattDescriptorAdded(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattDescriptor* descriptor) {}

void TestBluetoothAdapterObserver::GattDescriptorRemoved(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattDescriptor* descriptor) {}

void TestBluetoothAdapterObserver::GattCharacteristicValueChanged(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattCharacteristic* characteristic,
    const std::vector<uint8_t>& value) {}

void TestBluetoothAdapterObserver::GattDescriptorValueChanged(
    BluetoothAdapter* adapter,
    BluetoothRemoteGattDescriptor* descriptor,
    const std::vector<uint8_t>& value) {}

#if BUILDFLAG(IS_CHROMEOS)
void TestBluetoothAdapterObserver::
    LowEnergyScanSessionHardwareOffloadingStatusChanged(
        BluetoothAdapter::LowEnergyScanSessionHardwareOffloadingStatus status) {
  last_low_energy_scan_session_hardware_offloading_status_ = status;
  QuitMessageLoop();
}
#endif  // BUILDFLAG(IS_CHROMEOS)

void TestBluetoothAdapterObserver::QuitMessageLoop() {}

}  // namespace device